UNIX has hundreds of useful commands, almost all abbreviated to the point of incomprehensibility. Here are a few of the most popular. For more information on these commands, see the manual entries using the mancommand.
Note: Text in the typewriter font ( like this) indicates the part of the command you must type exactly as shown. Text in italics ( like this) is used for "arguments" or "operands" to the command, where what you actually type depends on what you want the command to do. For instance, where file appears, you would substitute the name of the real file that you wish the command to operate on. Operands surrounded by square brackets ([]) are optional, while three dots (...) indicate you can include multiple operands (you don't type the brackets or the dots when running the command).
cat file...
Note: Text in the typewriter font ( like this) indicates the part of the command you must type exactly as shown. Text in italics ( like this) is used for "arguments" or "operands" to the command, where what you actually type depends on what you want the command to do. For instance, where file appears, you would substitute the name of the real file that you wish the command to operate on. Operands surrounded by square brackets ([]) are optional, while three dots (...) indicate you can include multiple operands (you don't type the brackets or the dots when running the command).
cat file...
- - "join (cont catenate) or display files " - join files from end to end and send output to the terminal. You can use cat to display the contents of one or more text files.
- cd [ directory]
- - "change directory " - change the working directory to directory. If no directory is specified, change to the home directory.
- chmod mode file...
- - "change access mode " - change the permissions mode of file to mode.
- cp file1 file2
- - "copy " - create a copy of file1 and call it file2.
- cp file... directory
- - "copy " - make a copy of file in directory, retaining the same name for the file.
- date
- - "display date " - display current date and time.
- diff file1 file2
- - "difference " - show all the differences between file1 and file2.
- du [ options] [ directory...]
- - "disk usage " - show how much space is being used by directory and its contents.
- echo [ argument...]
- - "echo argument " - print argument.
- file file...
- - "display file classification " - determine the type of file by examining its contents.
- find directory... expression
- - "find files " - find files in directory and its subdirectories by name, or by other characteristics.
- grep string file...
- - "global regular expression print " - search file for string. string can be a regular expression.
- head [ file...]
- - "display head of file " - display first few lines of specified files.
- kill [ pid...]
- - "kill process " - terminate a process.
- look string [ file]
- - "lookup string " - consult a sorted file and print all lines that begin with string. If no file is specified, look uses /usr/dict/words, which is useful to check the spelling of a word when you remember only its first few letters.
- lpq
- - "line printer queue " - display the queue of printer jobs. To check the queue on a printer other than the default one, use the -P option, e.g., lpq -P printer.
- lpr file...
- - "line printer " - print a copy of file. To print to a printer other than the default one, use the -P option, e.g., lpr -P printer file.
- lprm jobnum
- - "line printer remove " - remove a job from the queue of printer jobs. jobnum is the number displayed by the lpq command. To remove a printer job from the queue on a printer other than the default one, use the -P option, e.g., lprm -P printer jobnum.
- ls [ directory...]
- - "list " - list the contents of directory. If no directory is named, list the contents of the current directory. A particularly useful variation of this command is " ls -l ", which produces a list showing the size and time of creation for each file in the directory.
- man command
- - "manual " - display a description of command. More about this in a separate section.
- man -k word
- - "search manual " - displays a list of all manual entries that contain word in their header line.
- mkdir name
- - "make directory " - create a new directory called name.
- more file
- - "show me more " - display file one screenful at a time. Press the space bar to move to the next page. Press Return to advance the file by one line. Press b to back up to the previous page. Press q to exit.
- mv file1 file2
- - "move " - rename file1 to file2. Warning:if file2 already exists, its previous contents will be erased and unrecoverable.
- pine
- - " program for internet news and email " - check to see if you have received mail.
- pine user
- - send electronic mail to user.
- pr file...
- - "paginate file " - format file for printing, optionally in multiple columns.
- printenv [ variable]
- - "print environment " - shows the values of the variables in the environment. If variable is specified, only its value is printed. An example of an environment variable is HOME, which specifies the home directory.
- ps [ options]
- - "process status " - display information about active processes.
- pwd
- - "print working directory " - display the name of the current directory.
- quota -v
- - "disk quota " - displays your disk quota. Without the -v option, quota says nothing unless you are over quota.
- rm file...
- - "remove " - delete file. Warning: the file is really gone. You cannot get it back. UNIX interprets the special file name * as "everything ". If you ever type the command " rm * " you will delete everything in the current directory. Use at your own risk. To remove a file named "- " from your directory, use: " rm ./- ".
- rmdir directory...
- - "remove directory " - delete directory. This command will only remove empty directories, so you must delete all the files in the directory with rm before using rmdir. To delete a directory with files in it, see the -roption in the manual entry for rm.
- sort file...
- - "sort lines " - display the lines of a file in sorted order.
- tail [ file]...
- - "display tail of file " - display the last few lines of file.
- umask [ mask]
- - "set permissions mask " - establish a "mask " that determines the access permissions on new files you create.
- which command
- - "which command is this? " - display command's pathname or alias.
No comments:
Post a Comment