There are many Unix commands that you might find useful, and there are many opinions about what commands you should make an effort to learn when you start. This page offers some suggestions for getting started with Unix.
You need to know some things about passwords, about connecting to the system, about logging in and logging out.
Most Unix systems have documentation on-line. You should note these items:
- man word
- If the on-line manual contains a "page" about word, this command will display it on your screen. For example, man man displays information about the man command.
- apropos keyword
- The apropos command locates commands by keyword lookup. When you type the command apropos word you will see a list of one-line descriptions of entries in the manual that contain word (in their one-line description). Follow up by using the man command to display one of the manual pages.
If you have lots of time and energy on your hands, you may want to learn more about Unix on your own. There are lots of books about using Unix; you might want to get one and study it. Books about Unix vary widely in quality. Before you buy a book about Unix, you might want to ask your instructor for recommendations.
Here are some other commands that you might find useful. They're here in alphabetical order. If you think you need more information, use the man command (see above), or talk to your instructor.
- The commandcd directory_namechanges your current (working) directory to the named directory. The commandcd(i.e., with no arguments) changes your current directory to be your home directory.
- Logs you out of the system.
- The commandls(with no arguments) lists the names of files in your current directory.
Adding the options -CF, i.e., typing the commandls -CFlists the names of the files in your current directory, listing them in multiple columns and appending a '*' to executable files and '/' to directories.
The commandls -lshows a long-form listing which includes a character indicating whether the file is a directory ('d') or an ordinary file ('-'), 9 characters describing the file permissions, the name of the file's owner, the file's size in bytes, when the file was last modified, and the file's name.
Any of these forms can have wildcarded file names appended to them; that is, you can type things like:ls -l file_name ls -l wildcarded_file_name ls -CF file_name ls -CF wildcarded_file_nameThese forms restrict the listing to files whose names match the wildcarding.
There are lots of other things ls can do; consult the manual page (type the command man ls) for details.
- The commandmkdir directory_namecreates a directory with the given name.
- The command passwd (with no arguments) can be used to change your password. You will be prompted to enter your old password and to enter a new one twice. Nothing will be echoed. If the command doesn't generate error messages, your password has been changed to the new one.
- The command pwd (with no arguments) displays the name of your current directory on the screen. If what you see appears to be an error message, consult your instructor.
- The commandrm file_nameremoves (deletes, erases) the named file. The argument file_name can be replaced with a wildcarded file name description; the command will remove all files that match the wildcarded name. Use wildcards here with great caution; there is typically no way to recover a file that you have removed.
A variation on this command is the commandrm -i file_nameThe difference between this form and the first is that when the -i is there, the rm command will ask you whether to remove a file before it actually removes it. You can say no ('n').
- cat file_name
- This command displays the named file on the screen. Actually that is a special case of what the cat command does. The command line:cat file_1 file_2 ... file_nReads the named files (file_1, file_2, ...) and combines them into a single file (concatenates them) which it sends to "standard output" -- the screen. The command line:cat file_1 file_2 ... file_n > destination_fileconcatenates the named files and puts the result in the file named destination_file.
- The commandcp file_1 file_2copies the content of file_1 to a file named file_2. After the operation you have two independent copies of the same information.
The commandcp file_1 file_2 ... directory_nameputs copies of the files, file_1, file_2, ..., in the directory directory_name. After the copy file_1 and directory_name/file_1 are independent copies of the same information. Likewise with file_2 and directory_name/file_2, and so on.
- The date command (with no arguments) prints the current date and time. The output includes the day of the week too. For example, if I now type the command, I'll see this on my screen:% date Wed Sep 11 14:50:39 EDT 1996 %
- The commandfinger(with no arguments) displays some information about people who are currently logged on.
The commandfinger user_namedisplays some information about the named user. The commandfinger real_namewhere real_name is part of some user's real name, should show some information about that user.
The commandfinger user@internet_addressasks the system at internet_address for finger information on user. What happens depends on the system at internet_address; that system might send the information, might send some other message (perhaps a refusal), might "refuse the connection", or just might not respond (generating a long delay followed by a "connection timed out" message.
- lpr printer file_name
- Sends the file to the specified printer.
- more file_name
- These two commands are "pagers". A "pager" is a program that displays a file on your screen a screen-full at a time. More is the older program, and there are many versions of it. Currrent versions are usually capable of scrolling both forward and backward in the file and of doing searches. Less is more only more-so ;-). There are lots of versions of less around. Typically, less has more features than more.
If you type a lower case 'h' to either of these programs, you should see a "help screen".
- The commandmv file_1 file_2moves file_1 to a file named file_2. After the operation file_1 is gone and file_2 contains the information. The effect is that file_1 is renamed as file_2.
The commandmv file_1 file_2 ... directory_namemoves the files, file_1, file_2, ..., to the directory directory_name. After the move, files file_1, file_2, ... appear in the named directory rather than where they were.
- The command linermdir directory_namewill remove the named directory if the directory is empty. If there are files in the named directory, the command will tell you that the directory isn't empty and will not remove the directory.
- The who command, without an argument, lists the login name, terminal name, and login time for each current UNIX user. With two arguments, as in who am I who tells who you are logged in as.