UNIX Commands Cheat Sheet


Function
Command
Copy files cp
Change directory cd
Rename a file mv
Read a text file more/cat
Help man
Directory listing ls
List file permissions ls –l
Display current directory pwd
Display date & time date
Who am I logged in as? whoami
List all logged in users who
List all processes ps –ef
Display file type file
Display disk space df –k
Compare files diff
Make a directory mkdir
Delete a file rm
Delete a directory rm –r
Create a link ln
Search files for string grep
Display last 10 lines of file tail
Display first 10 lines of file head
Search files for string grep
Terminate a process kill
Change file permissions chmod
Change file ownership chown
Become another user su
Print file lp

 
 
Output Redirection

command1|command2

  • command > file
  • Send the output of command to file, create file if it doesn't exist, overwrite if it doesn't exist.
  • Ex.    cat /etc/passwd > users
  • command >> file
  • Send output of command to file, create file if it doesn't exist, append to the file if it doesn't exist.
  • Ex.    cat /etc/group >> users
  • Unix Wildcards
     
    *    Match any character, or no character, except for a dot in the first position

       Match any single character, in that position, except for a dot in the first position

    [ ]    Match whatever is qualified inside of the brackets
     
     
     


    Control Key Sequences

    < cntrl > c    Send an interrupt to program

    < cntrl > d    Send EOF (end of file)
                        Logout of shell

    < cntrl > z    Suspend program

    < cntrl > s    Stop scrolling

    < cntrl > q    Resume scrolling

    < cntrl > u    Erase command line

    < cntrl > w    Erase command line
                        Back to previous space
     
     
     


    <<  Back to Tech Corner


  •