Dave's quickie *nix command summary

This is just meant to be a quick overview of some linux/unix commands and their uses, aimed at new users to the system, operating in a command line environment (e.g. ssh, rlogin, dtterm, etc).

Disclaimer: this list was originally created for use on a unix system, some modifications may be necessary for debian linux.


File management

All data in the system is recorded in files (eg. source code files, executable files, text files, etc).

The commands below give you the ability to manipulate the names and contents of your files.


Directory management and movement

Files can be organised into directories, i.e. a directory is just something which contains a number of files.

Every time you log on to the system you start in your home directory. Afterwards you can use various forms of the cd command to move from one directory to another.

A file is described by a path (through various directories) and the file's name.

You can place one directory inside another, for example your home directory may contain (in addition to a number of files) a directory named practicals. Inside this directory you may place another directory named prac02, inside this directory you may place a file named myprogam.cpp. From your home directory you could refer to this file by the path+name: practicals/prac02/myprogram.cpp

The commands below give you the ability to create, manipulate, and move around in directories.


Redirecting input/output

Ordinarily, when you run a command or program the output is sent to your screen. You can instead direct the output to a file or to another command or program as follows:

Communications

When you are logged on to the system, there are a number of ways you can communicate with other people who are logged on to the system. These include:

Controlling programs

There are a wide variety of commands available to let you control the execution of your programs, and to obtain information about the execution of your programs.

Miscellaneous

There are a wide variety of other commands on the system which may be useful from time to time. These include:

Protection and passwords

The command to change your password is passwd. For information on what constitutes a ``safe'' password see this note by John Miller.

The Unix environment was originally designed to allow easy sharing of code and files between different users. The owner (creator) of a file or directory can determine, to an extent who can read (r) the file/directory, who can edit (w) the file, who can execute (x) the file (if it is an executable program), and who can cd into a directory.

When you are setting up access permissions so people can/cannot use your files, people are divided into three different categories:

Giving/Taking away permissions:
You set permissions to your files using the chmod command. To give all types of users permission to read a file, you would enter
chmod ugo+r filename
To take away read permission for a file (so you can read it but no one else can) you would enter
chmod go-r filename
To take away read, write, and execute permissions from a file for everyone but yourself, you would enter
chmod go-rwx filename
To give everyone access to cd into one of your directories, use the command
chmod ugo+x directoryname

NEVER EVER *EVER* GIVE WRITE PERMISSION TO THE GROUP OR OTHER CATEGORY FOR ANY OF YOUR FILES OR DIRECTORIES -- THIS IS A SECURITY HAZARD

Finding out who can use your files right now:
If you type in ls -l you will get a list of all your files and directories, one per line. The first thing on the line will have 10 characters, something like
-rwxr-xr-x
The 10 characters (from left to right) indicate:

  1. d means it is a directory, - means it is a file
  2. r means user (creator) has read access, - means user does not
  3. w means user has write (modify) access, - means user does not
  4. x means user has execute or cd access, - means user does not
  5. r means group has read access, - means group does not
  6. w means group has write (modify) access, - means group does not
  7. x means group has execute or cd access, - means group does not
  8. r means everyone has read access, - means users at large do not
  9. w means everyone has write (modify) access, - means users at large do not
  10. x means everyone has execute or cd access, - means users at large do not

Copyright © 1997, David M. Wessels. Revised September, 2000. All rights reserved.