Course Hero Logo

When you are ready to execute a command press the

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 50 - 52 out of 662 pages.

When you are ready to execute a command, press theEnterkey. Type each command on aseparate line. The command output is displayed before the next shell prompt appears.[[email protected]]$whoamiuser[[email protected]]$If you want to type more than one command on a single line, use the semicolon (;) as a commandseparator. A semicolon is a member of a class of characters calledmetacharactersthat havespecial meanings forbash. In this case the output of both commands will be displayed before thenext shell prompt appears.The following example shows how to combine two commands (command1andcommand2) on thecommand line.[[email protected]]$command1;command2Examples of Simple CommandsThedatecommand displays the current date and time. It can also be used by the superuser toset the system clock. An argument that begins with a plus sign (+) specifies a format string for thedate command.[[email protected] ~]$dateSat Jan26 08:13:50 IST 2019[[email protected] ~]$date +%R08:13[[email protected] ~]$date +%x01/26/2019Thepasswdcommand changes a user's own password. The original password for the accountmust be specified before a change is allowed. By default,passwdis configured to require a strongpassword, consisting of lowercase letters, uppercase letters, numbers, and symbols, and is not30RH124-RHEL8.0-en-1-20200501
Chapter 2|Accessing the Command Linebased on a dictionary word. The superuser can use thepasswdcommand to change other users'passwords.[[email protected] ~]$passwdChanging password for user user.Current password:old_passwordNew password:new_passwordRetype new password:new_passwordpasswd: all authentication tokens updated successfully.Linux does not require file name extensions to classify files by type. Thefilecommand scans thebeginning of a file's contents and displays what type it is. The files to be classified are passed asarguments to the command.[[email protected] ~]$file /etc/passwd/etc/passwd: ASCII text[[email protected] ~]$file /bin/passwd/bin/passwd: setuid ELF 64-bit LSB shared object, x86-64, version 1(SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,for GNU/Linux 3.2.0, BuildID[sha1]=a3637110e27e9a48dced9f38b4ae43388d32d0e4,stripped[[email protected] ~]$file /home/home: directoryViewing the Contents of FilesOne of the most simple and frequently used commands in Linux iscat. Thecatcommand allowsyou to create single or multiple files, view the contents of files, concatenate the contents frommultiple files, and redirect contents of the file to a terminal or files.The example shows how to view the contents of the/etc/passwdfile.[[email protected] ~]$cat /etc/passwdroot:x:0:0:root:/root:/bin/bashbin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologin...output omitted...Use the following command to display the contents of multiple files.[[email protected] ~]$cat file1 file2Hello World!!

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 662 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Summer
Professor
N/A
Tags

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture