Simple Unix Tutorial ==================== In Unix data is organized in a hierarchical fashion using files and directories (folders). In the hierarchy, a forward slash '/' represents the root directory under which all system's files and directories reside. The following are commonly used Unix commands. In the description below a % character represents the Unix prompt. 1. ls ----- Definition: list directory contents. You can use the command with several options. One option you might find useful is -l which provides information like size, and last modification time. Example: (Assuming we have a file called data and a directory call Projects) (The file data has a size of 31 bytes and was modified on Feb 5 15:33) % ls Projects data % ls -l total 6 drwxr-xr-x 3 bb131002 100 2048 Feb 5 15:54 Projects2 -rw-r--r-- 1 bb131002 100 31 Feb 5 15:33 data % 2. pwd ------ Definition: prints the current working directory. Example: % pwd /afs/wam.umd.edu/home/wam/b/b/bb131002/home/Test % 3. mkdir -------- Definition: creates a directory. Example: % mkdir MyHomeworks 4. rmdir -------- Definition: removes a directory. The directory must be empty. Example: % rmdir MyHomeworks 5. cd ----- Definition: changes the working directory. Example: % cd MyHomeworks -> makes MyHomeworks the current directory % cd -> takes you back to your home directory % cd .. -> takes you to the directory above the current directory 6. rm ----- Definition: removes files or directories. Example: % rm data -> removes file named data % rm -f -r MyHomeworks -> removes all the files/directories in the directory MyHomeworks 7. mv ----- Definition: moves files and directories and allows you to rename a file or directory. Example: (Assuming the file data2 does not exist and the directory Projects2 exist). % mv data data2 -> the file name has changed from data to data2 % mv data2 Projects2 -> the data2 file has been moved to Projects2 8. cp ----- Definition: copies files and directories. Example: % cp data data3 -> two files with exact contents 9. pico ------- Definition: simple text editor. Follow the commands description at the bottom of the text editor for more information. Example: % pico data -> creates a file named pico or opens it (if it already exist) 10. less -------- Definition: allows you to browse through a text file. Example: % less data This is a file with some data. % 11. date -------- Definition: generates the current date and time. Example: % date Thu Feb 5 16:04:02 EST 2004 % 12. passwd --------- Definition: allows you to change the account password. Example: % passwd 13. man ------- Definition: displays information about a command. Example: % man less 14. logout ---------- Definition: allows you to exit your account Example: % logout