# Unix commands factpack # Created: 12-29-99 # factpack creator: Sean Hollen cd => Change the current working directory. Syntax: Cd (directory) Where directory is the directory which you want to change to. (".") refers to the current directory, "cd .." the parent directory. Example : cd /etc/usr: this will take you to the /etc/usr directory cd .. to go back one dir to /etc. ls => Displays information about the named files and directories. Syntax: ls (file1) (file2) ...(fileN). Where file1 through fileN are the filenames or directories to list. The most commonly used options are -F (to display the file type) and -l (to give a "long" listing including the file size, etc. cp => Copies one or more files to another file or directory. Syntax: cp (file1) (file2) ...(fileN) (destination). Where file1 through fileN are the files to copy, and destination is the destination file or directory. Example: cp ../frog joe copies the file ../frog to the file or directory joe. mv => Moves one or more files to another file or directory. This command does the equivalent of a copy followed by the deletion of the original file. Where (file1) (file2) ...(fileN) (destination). Where file1 through fileN are the files to move, and destination is the destination file or directory. Example: mv ../frog joe moves the file ../frog to the file or directory joe. rm => Deletes files. Note that when you delete a file under UNIX and or Linux they are unrecoverable!! Unlike MS DOS. Syntax: rm (file1) (file2) ...(fileN). Where file1 through fileN are the filenames to delete. The -i option prompts for confirmation before deleting the file. Example: rm -i /home/larry/joe /home/larry/frog deletes the files joe and frog in the /home/larry. mkdir => Creates new directories. Syntax: mkdir (dir1) (dir2) ...(dirN). Where dir1 through dirN are the directories to create. Example: mkdir /home/larry/test creates the directory test in /home/larry. rmdir => Deletes empty directories. When using rmdir, the current working directory must not be within the directory to be deleted. Syntax: rmdir (dir1) (dir2) ...(dirN). Where dir1 through dirN are the directories to delete. Example: rmdir /home/larry/papers deletes the directory /home/larry/papers, if empty. man => Displays the manual page for that given command or resource (that is, any system utility that isn't a command, such as a library function. Syntax: man (command). Where command is the name of the command or resource to get help on. Example: man ls gives help on the ls command. more => Displays the contents of the named files, one screenful at a time. Syntax: more (file1) (file2) ...(fileN). Where file1 through fileN are the files to display. Example: more papers/history-final displays the file papers/history-final. cat => officially used to concatenate files. cat is also used to display the contents of a file on screen. Syntax: cat (file1) (file2) ...(fileN) Where file1 through fileN are the files to display. Example: cat letters/from-mdw displays the file letters/from-mdw. echo => Displays the given arguments on the screen. Syntax: echo (arg1) (arg2) ..(argN). Where arg1 through argN are the arguments to echo. Example: echo "Hello World" displays the string "Hello World". grep => Displays every line in one or more files that match the given pattern. Syntax: grep (pattern) (file1) (file2) ...(fileN). Where pattern is a regular expression pattern, and file1 through fileN are the files to search. Example: grep loomer /etc/hosts desplays every line in the file /etc/hosts that contains the pattern "loomer".