CS3240: Data Structures and Algorithms

Unix User Tips


Below is a list of commonly used commands that you will need to know to navigate around the a Unix file system. These are command line statements that you type into a Unix shell.
Change Directory
cd directoryname
cd ..    (takes you up one level)
cd   (takes you to your home directory)
File Listing
ls 
ls -l    (details)
ls -al   (more details)
Create a Directory
mkdir directoryname
Copying and renaming files
cp original_file copy_of_file
mv original_filename new_filename
Path and finding programs
printenv (shows PATH and other env variables)
which program_name (searches for a program)
Process control
ps  (show your running processes)
kill -9 <processID>
where processID is listed in the output of the ps command
 ps -ef  (shows ALL running processes)

Display Files on Screen
 more filename 
(lists one screen-full at a time)
 cat filename 
(lists entire file at one time)
Re-directing screen output the " | " pipe symbol Use to redirect the output
  command1  |  command2 
Takes output from command1 and passes it to command2!!!
Example to control, limit the ammount of information displayed on the screen to a page at a time
  cat filename | more 
This will cat the file so see one screen-full at a time
Searching for a String in a File
  grep "string"  filename
This will look for string in the file filename.
Change File Mode
 chmod a+X  filename 
(see man or help of chmod for options)
 chmod 755 filename 
(this makes it rwxr_xr_x , see man or hgelp of chmod for more details on numerically specifying permission)
FTP
ftp hostname
then use put and get protocols to transfer files
© Lynne Grewe