Common UNIX Commands
File Commands
cat filename - displays file on terminal
cat file1 >> file2 - appends file1 to the bottom of file2
cp file1 file2 - copies file1 to file2 (file2 may optionally specify a different director: i.e., moves file to another directory)
mv file1 file2 - renames file1 to file2
rm filename - deletes the file specified
rm –i filename - confirms before deleting files
head filename - displays the first ten lines of the file
tail filename - displays the last ten lines of the file
more filename - to view specified file on the screen
pg filename - similar to "more filename," but will page forward, backward, etc.
file filename - tells you what type of a file it is, whether ASCII or bin, etc.
Directory Commands
cd name_of_directory - goes to the specified directory
cd - takes you back to the home directory
mkdir name_of_directory - creates a sub-directory of that name
pwd - shows the current working directory
rmdir name_of_directory - removes empty directory
rm -r name_of_directory - deletes directory and all sub-files and sub-directories
ls - displays file names.
ls –l - displays file names with permissions, site, owner, etc.
ls -al - displays all files with their permissions, etc., including the hidden files
Help Commands
man commandname - on-line help for the command specified (Use for complete description).
whatis command - displays one line description of what the command does.
dirusage - shows sorted summary of space used by files and directories.
Miscellaneous Commands
who - to list who is currently logged in
last loginname - details of all logins in the last couple of days for the loginname specified
lp –d printername filename - prints the specified file
cal - shows the current calendar month
cal month year - shows the calendar for the specified month and year
date - displays today’s date and current time
finger loginname - displays all information for that user including his/her login shell
name namepart - displays accounts (email addresses) on major NJIT systems where namepart may be a last name/first name/login name.
Mail Commands
pine - A form of menu driven mail system
elm, mail & mush - 3 different types of mail also available on AFS
Note: You may find pine easier to use since it is menu driven. See pine instructions further in this guide. Pick ONE mail reader and use it exclusively. Mixing mail programs can cause data loss.
Editor Commands
pico filename - A menu driven text editor
vi filename - Another form of text editor
Note: You may find pico easier to use since it is menu driven