Basic Unix Commands you should know how to use

Detailed usage information is available through the "man" command or at many sites on the Internet (Unix 101, Basic Tutorial, Basic Unix, or just google search the command

 

cd   change directories

hostname   display your current hostname (which machine you're on)

ls   short listing of directory contents

ls –l   display a directory listing giving details about directories and files

ls –la   same as ls -l, except include hidden files

mkdir DIRECTORY create the specified directory

rm FILE   remove file or files

rm -r   remove recursive (includes all subdirectories and files in subdirectories)

man COMMAND   display the man (manual) page about the command

mv SOURCE TARGET   move the source file to the target file    

pwd   return the current working directory name

chmod   change the file mode of a file (allow/deny reading/writing/executing by different user classes)

less   display a file in pages, allows forward (ctrl-f) or backward (ctrl-b) scrolling

whereis PROGRAM   locates a program by looking in the standard Unix locations. Prints what it finds

which COMMAND   locate a program on the User's PATH. 

wc   determine the word/line/character or byte count of a file

diff file1 file2   print out any differences in file1 and file2

ftp/sftp   ftp - Internet file transfer program. sftp - secure (encrypted) internet file transfer program

passwd   change the current user's password

ssh   open ssh a secure (encrypted) client. "ssh aServer" attempts a secure remote login on server "aServer". 

grep PATTERN FILE   print lines matching a pattern in the given file

tar   tape archiver. 

      tar cvf FILE.tar * - all contents of the current directory into FILE.tar.

      tar xvf FILE.tar - extract all files from FILE.tar into the current directory. 

gzip/gunzip   compress or uncompress files. (.gz format)

cat FILE   print a file to standard out. Useful to then pipe the file to another command.
           example: cat file.txt | wc    

                    send file.text to the wc (word count) command to determine how many words are in a file

scp   secure copy a file from one machine to another scp user@host1:sourceFile user2@host2:destinationFile

cp SOURCE TARGET   copy a file from source to target

cp –r SOURCE_DIR TARGET_DIR   copy a directory (including all contents) from source to target

wget/curl   download a web location to your local machine. (Some Unix variants only proivide curl, not wget)