UNIX COMMANDS ------------- * WARNING: UNIX is case senstive!!! [] - Indicates an optional component. mkdir - Makes a directory - mkdir path-to-desired-new-direcory - Example1 (to make a directory called JUNK): mkdir JUNK - Example2 (to make a sub-directory SYS under directory JUNK): mkdir JUNK/SYS * Note: You can only make sub-directories after you've made the directory. rmdir - Removes a directory - rmdir path-to-direcory-to-remove - Example1 (to remove the JUNK sub-directory SYS): rmdir JUNK/SYS - Example2 (to remove the directory JUNK): rmdir JUNK * Note: You can only remove a directory after you've removed the sub-directories. * Note: The directory must also be empty before it can be removed (see rm below). cd - Changes or moves you to a directory - cd path-to-desired-direcory - Example1 (to move to the JUNK directory): cd JUNK - Example2 (to move to the JUNK sub-directory SYS): cd JUNK/SYS - Example3 (to move "back" 1 directory): cd .. - Example4 (to move "back" 2 directories): cd ../.. ls - Displays the contents of a directory on the screen. - ls [option] [path] [filename(s)] - Example1 (to list the current directory's contents): ls - Example2 (to list the contents of the JUNK directory): ls JUNK - Example3 (to list all ".exe" files in the JUNK directory): ls JUNK/*.exe * Note: The options include -a (all files listed, including hidden files), -l (all file data, long display), and others. cp - Copies a file from 1 location or filename to another. - cp path1/file1 [drive:]path2/file2 - Example1 (to copy a file from the JUNK directory to the SYS directory) cp JUNK/hw1.txt JUNK/SYS/hw1.txt - Example2 (to copy a file from the JUNK directory to the SYS directory and to use a different filename) cp JUNK/hw1.txt JUNK/SYS/hwa.txt - Example3 (to copy a file to another file, if you are in the directory already) cp hw1.txt hwa.txt - Example4 (to copy a file to another file) cp JUNK/hw1.txt JUNK/hwa.txt mv - Moves a file from 1 location/name to another. - mv path1/file1 path2/file2 - Example1 (to move a file from the JUNK directory to the SYS directory) mv JUNK/hw1.txt JUNK/SYS/hw1.txt - Example2 (to move a file from the JUNK directory to the SYS directory and to use a different filename) mv JUNK/hw1.txt JUNK/SYS/hwa.txt - Example3 (to move a file to another file, if you are in the directory already) mv hw1.txt hwa.txt - Example4 (to move a file to another file - rename it) mv JUNK/hw1.txt JUNK/hwa.txt rm - Removes a file from the disk. - rm [option] path/file - Example1 (to remove the file hw.txt from the JUNK directory) rm JUNK/hw.txt - Example 2 (to remove a directory, all sub-directories, and all files - rm recurse directories and force removal of all files) rm -rf JUNK * WARNING: rm -rf is a very dangerous command. You can "wipe" out your entire "disk" if you're not carefull. Never, ever use rm -rf when logged in as "root". Been there, done that, regretted it :( cat - Displays the contents of a file on the screen. - cat path/filename - Example1 (to list the file hw.txt in the current directory): cat hw.txt - Example2 (to list the file hw.txt in the JUNK directory): cat JUNK/hw.txt WILDCARDS * - Word wildcard. ? - Character wildcard. * Note: In all of the above cases, wildcards can be used in place (or in conjunction with) filenames. more - Displays the contents of a file on the screen (only does it page-by-page - you press ANY-KEY to get the next page). More can also be used with cat to do a page-by-page display. For examples see redirect, and pipe below. REDIRECT - REDIRECTING ("<" or ">") is a handy little tool for capturing the screen into a file. - Example1 (to capture the results of a ls command into a file called dir.txt): ls > ls.txt - Example2 (to capture the results of a FORTRAN program (hw1) into a file called output.dat): HW1 > output.dat - Example3 (to get a page-by-page display of a data file called hw5.dat): more < hw5.dat PIPE - PIPING ("|") is another handy little tool for re-routing the output from 1 UNIX command (or some program) directly into another UNIX command (or some other program). - Example1 (to PIPE the results from a ls command into more): ls | more ** The above is only a short list of UNIX commands. Consult the UNIX manual (man) pages for more info on the UNIX commands (i.e. man cat - to get more info on the cat command). Or consult a UNIX book.