This is a list of basic Unix command and basic modifiers. Keep in mind that there are hundreds of commands and each command generally has many modifiers, so this is just the tip of the iceberg.

  • %> - Represents the Unix command prompt
  • (file path) - Represents the name of a file (e.g. blah.txt or /temp/Hello.cpp) or a directory (e.g. /auto/home or ../temp)
  • (cmd name) - Represents the name of a command (i.e. mv or rm)
  • (src) - The source directory or filename
  • (dest) - The destination directory or filename
  • (proc id) - The ID of a running process (found using the "ps" command)
  • (uname) - A login username (i.e. csci402)
  • (host) - A host (i.e. aludra.usc.edu)
CommandOptionsSyntaxDescription
ls (none)

-a

-l
%> ls

%> ls -a

%> ls -l
List all the non-hidden files in the current directory to the console

Display all files (hidden and non-hidden) in the current directory

Display the details of all listed files (i.e. ownership, creation time, etc.)
echo (none)

-n
%> echo (string)

%> echo -n (string)
Print (string) followed by '\n', the <LF> character.

Print (string) (without <LF>)
cat (none) %> cat (file path) Dumps the entire contents of a file to the console
more (none) %> more (file path) Will display the contents of the file in the console window. Press 'Enter' to scroll line by line. Press spacebar to scroll by page. Press 'q' to quit.
mkdir (none) %> mkdir (file path) Create a subdirectory named (file path) in the current directory
cd (none) cd (file path) Change directory from the current directory to (file path)
cp (none)

-r
%> cp (src file path) (dest file path)

%> cp -r (src file path) (dest file path)
Copy a file from "src" to "dest"

Copy a file or directory recursively from "src" to "dest"
mv (none) %> mv (src file path) (dest file path) Move a file or directory from "src" to "dest"
pwd (none) %> pwd Displays the current working directory
man (none) %> man (cmd name) Displays the manual page for a given command (e.g. "%> man cp" will display the manual for the "cp" command). Press "q" to quit.
rm (none)

-r
%> rm (file path)

%> rm -r (file path)
Remove the given file.

Remove the given file or directory

BE CAREFUL WITH THIS COMMAND
touch (none) %> touch (file path) If the file does not exist, this will create a new, empty file. If the file does exist, it will update the "last modified time" (do this if you want to force something to recompile).
ps -x %> ps -gx Show all the processes currently running with your username and their associated process IDs (a.k.a. PIDs).
kill (none)

-9

-9 -1
%> kill (proc id)

%> kill -9 (proc id)

%> kill -9 -1
Kill the specified process.

Forcefully terminate the specified process (do this if normal "kill" doesn't work).

Forcefully kill all your processes and log you out (be careful with this).
pico (none) %> pico (file path) Open the specified file using the pico editor. If the specified file does not exist, pico can create it.
vi (none) %> vi (file path) Open the specified file using the vi editor. If the specified file does not exist, vi can create it.
emacs (none) %> emacs (file path) Open the specified file using the emacs editor. If the specified file does not exist, Emacs can create it.
exit (none) %> exit Terminate your current shell or current login.