Linux Ch6

  1. Different ways to run command-line interface
    • As a terminal session from GUI
    • Start Linux at Run level 3 (no GUI)
    • Start Linux at Run level 1 (emergency)
  2. Default shell for user specified in
  3. Virtual Terminal
    • Linux supports Virtual Terminal (VT) sessions
    • Ususally 6 or 7 sessions by default
    • Access each VT by combination of key strokes
    • CTRL + ALT + Fn (Fn: where “n” is a number)
    • Return to original session: CTRL + ALT + F1
  4. Logging in Remotely
    • Remote access must be enabled using a daemon
    • Use “telnet” or “rlogin” but unsecure
    • “ssh” Secured Shell is best (provides encryption)
    • Configure “ssh” for remote logins
    • Once “ssh” is running on server, client connections can be established:
    • Command:  ssh servername   or
    • ssh IP Address
    • When connected you will be required to login using a valid user account and password
    • “ssh” on client can be used with different O/Ss
    • Once connected user has access as if local
    • When finished, logout
  5. free
    • echo
    • cat
    • free :  show free disk space
    • echo  : $PATH  show the contents of path
    • cat textfile :  show the contents of file
  6. &
    • ctrl+Z, bg #
    • fg #
    • Start in background:  firefox &
    • Move to background:  Ctrl+Z, bg #
    • Move to foreground:  fg #
  7. Using Command Completion
    • Uses tab key
    • Completes commands, filenames, or directory names
  8. Using Command History
    • Use the history command to see all
    • Use the history # to see the last # commands.
    • Press up arrow to see last command.
    • Use various keystrokes to recall and edit
  9. Getting Help
    • Lots of help available
    • Linux commands:
    • –man (pages) sections 1,5,8
    • –info
    • Readme type files
    • Discussion forums
    • Online documentation
    • Ask questions
  10. “whatis” command
    • helpful to get brief information about Linux commands or functions
    • displays man page single line description for command that matches string passed as a command line argument to whatis command
    • picks short description of NAME section of man page of command that matches to input given to the whatis command
    • Example:  whatis passwd
  11. man page section numbers
    • 1. Executable programs and shell commands
    • 5. File formats
    • 8. System administration commands (programs run mostly or exclusively by root)
  12. get help on the file “passwd” not the   command
    • versus
    • get help on the command “passwd”
    • man 5 passwd
    • man passwd
  13. searching man page
    • whatis” command
    • Searches summary information contained in man pages
    • Uses keywords
    • Returns one line summary for every matching man page

    • “apropos” command
    • Performs a more thorough search
    • Searches both Name and Description sections of “man” pages
  14. “less” command
    • A pager command
    • Displays text a screen at a time
    • Move forward and back through the file
    • Search for keywords (highlighted)
    • Can be used to read other text files
  15. “info” Pages
    • A newer documentation system
    • Similar to “man” pages but more features
    • Provides for hypertext linking to other pages
    • Each page is known as a “node”
    • Documentation for a specific command can be split across multiple nodes
    • Link to different nodes then return back (use the”u” key to return”
    • See Table 8.3 page 139 for key functions
    • Man pages do not provide this
  16. rpm
    • find
    • locate
  17. ls -lai
    • -a all files, including hidden(starting with a .)
    • -i i-node numbers
  18. Move to the user’s home directory
    • cd ~  or
    • cd
  19. >
    • >>
    • |
    • <
  20. whatis <command name>
    $ whatis passwd

    finds man page entries for the command
  21. passwd (5)           - the password file
    • passwd (1)           - change user password
    • passwd (1ssl)        - compute password hashes
  22. apropos
    $ apropos passwd

    performs a more thorough search
  23. chgpasswd (8)        - update group passwords in batch mode
    • chpasswd (8)         - update passwords in batch mode
    • fgetpwent_r (3)      - get passwd file entry reentrantly
    • getpwent_r (3)       - get passwd file entry reentrantly
    • gpasswd (1)          - administer /etc/group and /etc/gshadow
  24. whoami
    • mkdir
    • cd
    • touch
    • tree <folder name>
    • ls -la
  25. change the name of report to document

    move all files to parent directory

    remove deleteme from parent dir
    mv report document

    mv * ..

    rm ../deleteme
  26. STDOUT Redirection
    • Issue the following command to redirect STDOUT, instead of writing information to the monitor it will create a file and place the output in the file
    • Command: cat /etc/services > outfile Run the command: ls –l                 you will see the file “outfile”
  27. To add to the end of the file(outfile) created
    • To add to the end of the file created above use the “>>”  
    • Command: ls -l >> outfile
    • Run the command: ls –l                 you will see the file “outfile”
    • Run the command
    •    cat outfile
    • The above command will display the contents of “outfile” you will see the results of both of the previous commands
  28. >
    • >>
    • “>” this means create a new file, if a file exists it will be overwritten            “>>” this means append to the end of a file, if the file does not exist it will be created
  29. To prevent information from scrolling to the end;
    use the pipe “|” and “more”

    Example:      ls –l | more
  30. To search for a specific pattern use
    the “grep” program as follows: Run the command:           ls –l | grep conf
Card Set
Linux Ch6
Linux Ch6