Commonly Used Linux Commands

The Command What it Means Example Output
man command “Manual.” This displays the help pages for a command. Hit the space bar to scroll through each screen, and hit “q” to quit. man ls Displays help for the command “ls”.
ls “List.” Displays the contents of your current directory (folder). ls A list of file names.
ls -l “List.” The “-l” means “list in long format.” Information such as the time a file was last modified is displayed. ls -l A list of file names with info about each file is displayed.
cd dirname “Change Directory.” Changes your current directory (folder) to ~~dirname~~. cd mySasProgs You are now in folder “mySasProgs.”
pwd “Print Working Directory.” Prints the name of the directory (folder) you are in. pwd Displays the name of a folder.
cd ~ “Change Directory.” Changes your current directory (folder) to your home directory. Your home directory is the folder you are in when you first login. cd ~ You are now in your home directory.
cd .. “Change Directory.” Makes your current directory move up one directory. cd .. If you were in folder “mySasProgs/Prog1/”, after you enter “cd ..”, you will be in “mySasProgs/”.
mkdir dirname “Make Directory.” Makes a new directory (folder) called dirname. mkdir sasPrograms No output, but a directory called “sasPrograms” has been created.
cat filename “Concatenate”. Displays the contents of ~~filename~~. cat prog1.sas The contents of “prog1.sas”
more filename “More”. Displays the contents of ~~filename~~ a screen at a time. Hit the space bar to scroll through each screen, and hit “q” to quit. more prog1.sas Displays “prog1.sas” a screen at a time.
pico filename This is a program to let you edit a file. It is a very basic Word Processor (like Notepad). For more info on how to use this editor, see: http://www.udel.edu/topics/software/general/editors/unix/pico/picotips.html. pico program1.sas Opens “program1.sas” for editing.
!letters Repeats the last command that started with ~~letters~~. !s Repeats the last command that started with s.
cp source destination “Copy”. Copies source to destination (-p : perserve timestamp). cp program1.sas program1Backup.sas Makes a copy of “program1.sas” and calls it “program1Backup.sas”
mv source destination “Move”. Moves source to destination. You can also think of this command as the “Rename” command. mv program1.sas sampleProgram.sas Renames “program1.sas” to “sampleProgram.sas”
rm filename “Remove.” Deletes filename. rm testProgram.sas Removes testProgram.sas
rmdir dirname “Remove Directory.” Deletes the directory (folder) ~~dirname~~. rm temp Removes the directory called “temp.”
msas9 filename Runs SAS in batch mode on file filename. msas9 program1.sas Runs SAS on “program1.sas”.
grep patternfilename Displays all of the lines in filename that contain pattern. grep obs a.log Displays any line in “a.log” that contains the word “obs”
chmod g+s dirname enable sticky bit for group(a: all, u: user) ownership chmod g+s data files created under data/ will now by default share group ownership with data
pts membership username Displays all of the AFS groups of which user username is a member pts membership vanbusum A list of groups, such as “workfirst” and “graduate”
pts membership groupname Displays all the users of the AFS group pts membership workfirst
fs la(sa) dir userid acesslist list (set) access for dir for userid fs la . workfirst rlikwa or fs sa . kum none permission changes
pts adduser uid gid add user to group . .
pts removeuser uid gid remove user to group . .
pts creategroup gid create group group name kum:grp .
pts delete gid delete group group name kum:grp .
ln -s path fn create a symbolic link. when you want to make a direct link to a dir ln -s /afs/isis/projects/workfirst/workfirst/data/ wf a link to paht named fn is created
du -h Disk Usage
df -h Disk status on NFS