Commands
Command-Line Syntax
- When using a terminal window, a shell prompt appears on the screen. For the bourne and korn shell the prompt will be a dollar sign ($). For the C shell user, the prompt is a percent sign (%).
- From the shell prompt, you can type commands to tell the system to perform an action. The typical command syntax is:
$ command [option(s)] [argument(s)]
command = Executable (what you want the system to do)
option = How you want the command to run
argument = File or directory, including the pathname.
- A space must be used as a delimiter between each part of the command line.
- Up to 256 characters can be entered on a single command line.
- Most commands don't require all 3 parts.
Some Usefull Commands
cat
Prints out ( to the screen ) the contents of the named file. Can also be used to concatenate files. Say you want file1 and file2 to be all together in one file named file3. If file1 is first, then cat file1 file2 > file3 will produce the correct file3.cd
Change current directory. Without a directory name, it will return you to your home directory. Otherwise, it takes you to the named directory named. cd / will take you to the root directory.chmod
Changes the permission modes of a file.cmp
Compares the contents of two files from each other. Reports the first different character found, and the line nummber. Command syntax would be cmp file1 file2cp
Copies files from one directory/filename to another. cp f1 f2 makes a file f2 identical to f1. cp *.c src/ copies all files that end in .c into the src subdirectory.date
Shows current date and time.diff
Displays all the differences between two files or directories to the screen.emacs
Runs the most recent version of the text editor named EMACS ( produced by the GNU project ). If filename is present, it will start editing that file. This will be discussed at a later point.env
Prints out the values for all the current environment variables.file
Looks at specified file and tells what type of files they are. This is useful in checking a file to be sure that it is text before you cat itfind
Searches the named directory and it's sub-directories for files.finger
Shows who is currently logged on the system, with limited information about them. For more detailed information use finger [login_name].ftp
Transfers files to and from a remote network site.grep
Searches files for specific words or patterns. To look for the word alan in a file called alan.txt you would use grep alan alan.txt.ghostview
X PostScript previewer. PostScript is a text processing and graphics language, and ghostview is handy for looking at the resulting page or picture before you send it to the printer.ispell
Interactively checks the spelling of the named file, giving logical alternatives to the misspelled words.jobs
Shows backgrounded processes with pid numbers.logout
Exits and disconnects your network connection.lpq
Reports all print jobs in the queue for the named printer.lpr
Queues file in print queue. Use lpr -Pprintername filenamelprm
Removes a job or jobs from a printer's spooling queue.ls
Shows directory listing.mkdir
Makes a sub-directory with the specified name in the current directory.man
Shows the full manual page entry for the specified command.more
Displays the contents of a file with pagebreaks.mv
Moves specified file to the specified location. Use mv file1 /agordon/files.printers
Shows available printers and current status.pwd
Shows where you currently are (present working directory).rm
Removes specified file.rmdir
Removes specified directory.setenv
Set environment variables.vi
Runs the screen oriented text editor named Vi. If a filename is specified, you will be editing that file.wc
Count how many words or lines are in a file. The command syntax is wc -w [filename] for a wordcount, and wc -l [filename]for a linecount.whereis
Reports the directory in which the specified command is located.who
Shows who is currently logged on the system.write
Send a message to the specified user.whereis
Reports the directory in which the specified command is located.yppasswd
Interactively changes your password.
Wildcards (* and ?)
- The character * is called a wildcard. It will match against 0 or more characters in a file or directory name. For example, if you type:
ls alan*
It will list all files in the current directory starting with alan...
And if you type:
ls *alan
It will list all files in current directory ending with ...alan
- The character ? will match exactly 1 character. So if you type:
ls ?ar
It will list things like Car, far and jar.
Next'��`�[email protected]'��`�