Unix/Linux : Crib sheet
Remember Unix/Linux is case specific.
Wildcards can be used – * for any combination matching and ? for single character matching.
ls Directory listing of the current directory level
ls directory_name Directory listing of the named directory (e.g. data_92)
ls –l Full information directory listing
ls –lg Full information directory listing including group info
ls –F Directory listing with directories, symbolic links & executables indicated.
ls –s Directory listing including size of each file, in Kbytes
ls –C | more Directory listing, in multi-column format, piped into the more command
cd directory_name Change the current working directory level to the named directory
cd .. Go up one directory level
cd ~userid Change the current working directory level to the home directory of your userid
pwd Check the path of your current working directory.
mkdir directory_name Make a new directory
mv Move or rename a file (mv oldname newname)
cp Copy a file (cp existing_file new_file)
rm filename Remove (delete) a specified file
del files Selectively delete files or directory contents
rmdir directory_name Remove an empty directory
rm –r directory_name Remove, recursively, a full directory and its contents
rm –i Selectively remove files or directory contents
echo Echo a value (e.g. system environment parameter echo $TERM to the screen)
clear clear the screen
more filename List a named file, one page at a time
(pg filename List a named file, one page at a time – used on AIX)
cat filename List a named file
tail filename List the last few lines of the named file
vi filename Edit an existing file or create a new file
chmod filename Change the read, write and execute permissions on a named file (e.g. cmod a+x myexec – add execution permissions to all).
chown filename Change the owner of a named file
chgrp filename Change the group of a named file.
env List all environment variables
alias List all alias settings currently being used in your logged-on session
alias name command_str Set an alias called name for the specified command string (put quotes around the command string if embedded spaces are required)
unalias name Remove the specified alias setting.
lpstat Check the status of jobs queued to all available printers
lpstat –pprinter_name Check the status of jobs queued to the named printer
lpq Display entries in printer queues
lpq – Pprinter_name Display entries in the queue for the named printer
lprm Remove a job from the printer queue
history From a c-shell environment, list the previous commands that have been remembered by this command
man Man pages for help (e.g. man ls)
info Information in the info format
!! Execute the previous command
!nn Execute command nn from history
!-n Execute the command that was executed n commands ago.
passwd used to change the user login password
logout logout from the workstation
rlogin Remote login from one workstation to another
telnet Open a telnet session from one workstation to another
ftp File Transfer methods between workstations and other machines/sites.
.cshrc File executed first on logging in and each time a new shell is opened
.login File executed once on logging in, after .cshrc
.logout File executed on logout
kill terminate background process – need to know the process id
ps –aux Display all running processes
fg Resumes a stopped task or brings a bg task into fg
bg Resumes a stopped background task
jobs Lists background or stopped tasks