Responsible for this page: Webmaster ,
Page last update: 2006-10-02

[ Go to content ] [ Help ] [ Information about accessability ]
På svenska | A to Z Maps Web overview Contact us
Go to

Unix - commands

Change password

The command 'passwd' lets you change your password. Note! Specific for ISY/MAI.
At ISY/MAI you change your password in Studentportalen ( and you'll have the new password the next day.

Movement in the filestructure

The 'cd' command lets you change working directory. It gives you the opportunity to 'walk' around in the filetree, both up and down in the tree.

cd directory Changes working directory to directory.
cd .. Goes up a level in the file structure
cd ../../ Goes two steps up in the file structure
cd ~ Goes to your home directory from all places in the file system
cd ~aaabb123 To go to the home directory of user 'aaabb123' from all places in the filesystem.
pwd Shows the current working directory.

Listing files and directories

The 'ls' command lets you list files and directories

ls Lists all files and catalogues (directories) in a directory.
ls -l Lists all the files and directories, each on a new row, and gives you information about the current protection (the rights to read, write and execute) of the files and directories.
ls -a Lists all files, directories and system (hidden) files which begin with a dot.
ls -t Shows the files in time order from when they were last changed.

The 'more' command lets you see the content of a file.

more file Lists the content of a file on screen. If the file is long you can scroll one page a time using the space bar.
less file Similar to more. (less is more)

Moving and copying files

cp fromfile tofile Copies the file fromfile and names the copy tofile
cp ~aaabb123/testfile . Copies the file testfile located in the home directory of user 'aaabb123' to current working directory, this is the function of the dot at the end. If I stand in my home directory and my loginname is 'bbbaa123' the dot represents '~bbbaa123'.
mv fromfile tofile
mv fromdirectory todirectory
Moves (or renames) a file or a directory, and all files in that directory.

Creating and removing files and directories

mkdir directory Creates a new directory, in current directory, named directory.
rm file Removes file
Warning! A very powerful command!
rm -r directory Removes directory and everything in it, ie this command can remove a whole filetree!
Warning! A even more powerful command!

Help functions

man command Shows manualpages about the command. Very useful!!
man -k keyword Searches for a command based on keyword.
whatis command Displays breif information about the command.


ssh -l username Lets you log on to the ISY computer ixtab from outside (or inside) ISY.
The session is ended with 'exit'.
In comparison to telnet, ssh encrypts the communication with the other computer.
talk user@address Lets you communicate with another user. The computer will tell if the user refuses to answer or if he isn't logged on
The session is ended with ctrl+c

Subcommands in SSH:

scp fromfile hostname:tofile Similar to cp, but the session is encrypted. Works between unix-systems that use ssh.

User Information

whoami Returns your userID.
who Brief information about other logged on users.
w Detailed information about other logged on users.
users Displays the userIDs for logged on users.
finger name Information about a user, name can be either the real name or userID.
tty Displays your terminal name.

Disk usage

df Information about used and available disk space in the system.
quota -v Returns information about disk quota and disk usage.
du Disk usage for files and directories in the file hierarchy.
du -s file Returns the total sum of disk usage for each of the specified files.


cc file.c Compile 'file.c' to a C program
lint file.c Validate a C program
indent infile outfile Format a C program
cxx file.C Compile a C++ program
pc -L -C -H -g -o file.p exefile Compiles 'file.p' to a Pascal program 'exefile'
(run program)exit
Allows you to run a program and store it in a file. The file will be called 'typescript'
dbxtool program & Let's you debug program
tab Indent line
(In emacs)


When you print a document it is transferred to a printer and placed in a job queue. All workstations at MAI and ISY have standard printers to which your document is sent to. By default the standard printer is the closest one to the computer. However, if the printer is malfunctioning you can easiely override the printer and print your document on a different printer. This is done by adding the argument -P plus the printername to the print command eg, 'ls -Pprintername file'

Be sure to check the printer queue before you print your document!

lpr [-Pprinter] file Prints file. If the argument '-P' and the name of a specified printer is given the file is directed to the specified printer
lpq [-Pprinter] Shows the current printer queue and the number of the jobs
lprm [-Pprinter] jobnumber Removes a specified job
lprm [-Pprinter] Removes all your jobs in the printer queue

Rights and protection

chmod mode file Changes the protection for a file, and gives you, a group or the world right to read, change or execute the file depending of the chosen mode. mode represents by [who] operator [permissions] (see below).
chmod a+r file Allow read permission to everyone for the file.
chmod a=rwx file Allow everyone to read, write and execute the file.

Represents Symbol Explanation Rights to:
Who u user's permissions the owner of the file
Who g group's permissions the group the file belongs to
Who o others' (world) permissions all that have access to the computer system
Who a all permissions (user, group, and other) default, but the file mode creation mask is taken into account.
Operator + add permission if permissions is omitted, nothing is added
Operator - take away permissions. if permissions is omitted, do nothing.
Operator = assign permissions absolutely. if who is omitted, clear all file mode bits, if who is present, clear the file mode bits represented by who
Permission r read permission add or take away read permisions for the file
Permission w write permission add or take away write permissions for the file
Permission x execute permission add or take away execute permissions for the file


By using pipes in UNIX input and output to/from a program can be directed from/to a file. This is done by using '<' and '>'. For example, if you would like to save the information from a command, say 'lpq' you can simply write:

ra>lpq > que.txt

This command takes the result produced by the 'lpq' command and puts it in the file que.txt. If we just want to add new information to an already existing file we use '>>' insted. Example:

ra>lpq >> que.txt

Another example is a program that reads input from a specified file and writes the result in a different file. Imagine you have created a program that sorts three names by letters in alphabetic order called 'Sort'. This program asks us for the names, sorts the names and finally prints the result. We can use one file as input (names.txt in the example below) and another file as output (result.txt) if we don't want the result on standard output (normally the screen).

ra>Sort < names.txt > result.txt