- A Unix command generally consists of a single word comprised of alphabetic characters. The Unix commands are also case sensitive and usually lowercase. The Unix designers created Unix for their own use, not the world at large, so the commands are comprised of the minimum number of keystrokes. That is why many Unix commands are simply between two and four letters in length, and even if they are longer, they are usually not dictionary words.
-
Commands are made up of the actual command and its arguments. The arguments are further broken down into the command options and other arguments. The options are predetermined for each command and can be found when reading the command documentation.
The other arguments are usually file names. The arguments must be separated from the command and each other with whitespace (spaces and tabs). The whitespace can usually be one character or many, but it must be there. Also, the options are preceded by a minus (-). They can be separate or combined.
For example, in the command:
tar -xvf example.tar
the command is "tar", the options are "-xvf" and the file name is "example.tar". You can also write the command as:
tar -x -v -f example.tar
This command extracts an archived tar file. -
Unix commands are rather flexible in their usage. You can enter the commands in a variety of ways, as in the example above; you can combine them; and you can exceed the width of the terminal line. You can even type a new command before the previous command has finished executing.
There are different ways to combine commands based on the output that you want. If you simply want to run one command, then to run the next you can combine the commands with a semicolon (;) between them. For example, the following commands change the current directory to the "/etc" directory and print the contents of that directory:
cd /etc; ls -a
You can also combine the commands in a way that redirects the output into a text file. The following example places the output of the example above and places it into a text file called "etc.txt":
cd /etc; ls -a > etc.txt
Although your commands will often be just a few characters long, there are times when the arguments will span more than the 80 characters on the terminal line. As long as you don't press "Enter" until you are finished with the command, the command will still work just fine.
Sometimes the execution of the command will take a long time. During this time, there will be no command prompt at which to type the next command. However, Unix has a buffer that will hold any commands that you type until the previous command is finished, then execute the next command. You will not see the command you are typing, so be sure to type correctly. - The Unix developers understood that there was no way anyone could remember all the Unix commands and all the options for each command. So they created the command documentation or man (manual) pages. This documentation is available on every Unix system unless specifically removed by the system administrator. You access the man pages at a command prompt by typing the command "man <command>". The man pages can be rather dry to read, but they are the best place to find all the information you need about a command. They often provide extensive usage examples.










