Using Unix

To use utstat effectively, you’ll need to learn at least a little bit about the Unix operating system. The best way to do this is probably from a book on Unix, a number of which can be found in the U of T bookstore. You can also look at a nice set of Unix help pages written at the University of Edinburgh, but note that some information there may not be correct for utstat.

This page has are some very brief hints for people who want to get started without reading much. Contents:

  • Typing commands to the shell
  • Changing your password
  • Files and directories
  • The Unix manual pages
  • Setting things up the way you like

Typing commands to the shell

After you log in, you will see a prompt such as “$”, or maybe the name of the computer you logged into. This prompt indicates that the Unix “shell” that you are using is ready for you to type a command, confirmed by typing the “return” or “enter” key. You use commands to the shell to start up programs (eg, a statistical package), and also to manipulate files and do other housekeeping chores.

To terminate the shell, type the exit command (or type Control/D). This will log you out if you had just one shell (as when you remotely log in). When using an X-terminal, you can have many shells running in different windows. You can exit from one without exiting from the others, except perhaps for the first one that was created (see logging in and out at a local X-terminal for the details).

Changing your password

One of the first things you should do after logging in the first time is to change your password, with the passwd command. You will be prompted for the old password and the new password. You should choose a password that is not too short, and that is not a common word.

Files and directories

Information in Unix is kept in files, which may be organized in directories. When you log in, you will be in your “home” directory, and can create and access files there. The most common way to create files is with an editor. Files also are created by various programs that you might run.

Here are the most important file manipulation commands:

ls

Lists the names of the files (and subdirectories) that are in the current directory. Files beginning with “.” aren’t listed; use ls -a to see them too.

more file

Displays the contents of a text file for you to see. If the file is more than a page long, it will wait for you to hit the space bar after showing each page.

rm file

Removes the file that you have named. Before doing this, be sure you don’t want it anymore!

mv file new-name

Changes the name of a file.

cp existing-file new-file

Creates a copy of an existing file, which can then be modified. Note that if new-file already exists, it’s contents will be overwritten.

mkdir directory

Creates a new directory, inside the current directory.

rmdir directory

Removes a directory, which must be empty.

cd directory

Change into the named directory. Files you create will now go there, and ls will show you the files in this directory. Use just cd (with no directory name) to return to your home directory.

Directories are very useful when you have many files to keep track of. You might create a directory for every project you work on, for example, so that you don’t get confused as to which files go with which project.

 

The Unix manual pages

You can get more information on Unix commands with the man command, which displays sections of the Unix manual. For example, the command

 

man ls

will display the manual page for the ls command, describing its many options.

You can also browse the SGI technical documentation, which includes the manual pages for SGI Unix.

Setting things up the way you like

The behaviour of many Unix commands can be changed to suit your preferences. See the documentation on setting Unix options in your .profile file for details.

Print Friendly