25
Unix Introduction Andr´ e Heck c AMSTEL Institute September 2003

Unix Introduction - Universiteit van Amsterdam FNWI · 3.5 File compression and archives ... The Unix introduction is mainly a practical introduction based on the principle of

Embed Size (px)

Citation preview

Unix Introduction

Andre Heckc©AMSTEL Institute

September 2003

Contents

1 Introduction 31.1 Learning goals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2 Practical issues for first-time Unix users at FNWI . . . . . . . . . . . . . . . 4

1.2.1 Just in case you want to use a Unix Workstation . . . . . . . . . . . . 41.2.2 Working on the students’ server from a PC . . . . . . . . . . . . . . . 51.2.3 Using softpkg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2 Basics of Unix 62.1 Directories and files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.2 Changing the working directory . . . . . . . . . . . . . . . . . . . . . . . . . . 72.3 Simple commands to manage files and directories . . . . . . . . . . . . . . . . 72.4 Printing of files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.5 Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.6 Unix documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.7 Logging out . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

3 Managing files and directories 123.1 File attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123.2 Wildcards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.3 Locating and comparing files . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.4 Secure ftp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.5 File compression and archives . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

4 Managing processes 194.1 Working with more programs at the same time . . . . . . . . . . . . . . . . . 194.2 Inquiring about the process status . . . . . . . . . . . . . . . . . . . . . . . . 194.3 Job control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

5 Summary of Unix commands 23

2

1 Introduction

1.1 Learning goals

Welcome to the Unix Introduction. The goal of this course is to familiarize yourselfwith the Unix operating system, in particular with the Sun Solaris version and/or with theLinux implementation. Unlike Microsoft Windows and MacOS, Unix is not a graphicalenvironment in which you manoeuvre with the mouse. It is a command-driven environment.In this course you learn the most important Unix commands. On top of Unix you normally useon a workstation a graphical user interface. The X Window System has become the defaultenvironment. But in this course we shall not pay attention to the graphical user interface.

Unix consists of three parts:

• The kernel : it handles the use of processors, memory, disk space, and accessibility offiles, amongst other things.

• The shell : this program interprets the commands that you enter and tries to carry themout.

• A set of auxiliary programs for common tasks like file management, editing and printingof text, and so on.

In short, files and processes play a important central role in the work of a Unix user. ForSimulating and Programming this holds even more because this work often involves

• writing a computer program in a file;

• preparing an input file;

• computing intermediate results and storing them in files;

• searching stored data efficiently;

• manipulating of stored data, e.g., sorting.

You will learn how to deal with these issues in a scientific computing setting.

The Unix introduction is mainly a practical introduction based on the principle of “getstarted quickly and learn by doing”. The idea is that, if you feel the need after a while to knowmore about a particular topic, you have already become familiar enough with the system tofind out yourself, for example by using the on-line help system or written documentation,or by asking a more experienced user. The learning goals of this Unix introduction can besummarized as follows: at the end of the course you

• have an overview of the auxiliary programs that are available and you know how to getinformation about their usage;

• can effectively manipulate data files with the built-in Unix facilities, as far as thisconcerns common computer tasks.

With respect to the knowledge about Unix this means that you

• have insight in the hierarchical file system;

• understand what role the shell plays in manipulating files (however, we will not payattention to reading, adapting, or creating shell scripts);

• know what possibilities exist in Unix for managing processes and how they can beapplied in simulations;

• can judge or quickly find out whether the Unix system provides built-in solutions ofcomputer tasks or that you must program these yourself.

3

The skills that you master are:

• working with the operating at basic level;

• organizing and manipulating files;

• managing processes;

• interpreting error messages and warnings;

• reading on-line help pages and Unix documentation.

1.2 Practical issues for first-time Unix users at FNWI

If this is the first time that you use a Unix workstation or that you work in the Unix operatingsystem at the Faculty of Science, you may need some practical information to get started. Ifnot, you can skip most of this subsection.

1.2.1 Just in case you want to use a Unix Workstation

Please note that you may skip this section when you do not use a Unix workstation or PCrunning Linux.

If you want to work on a Unix workstation or on a PC running Linux you first have to login.On the machines at the Faculty of Science you can do this with the same user account andpassword that you use for the PC’s running Windows XP. By the way, the central students’server, where all your files are stored and where all software available to FNWI studentsresides, is called gene (if needed, the corresponding cluster name is edu).

At the time of logging in you can also specify the graphical user interface that you wantto use. If it is the first time that you try to login a default choice is made, otherwise theenvironment that you used last time is chosen. At any time you can request in the loginwindow a specific desktop (do this before entering your password).

Henceforth we shall assume that you are working on a Sun workstation using the CommonDesktop Environment (CDE). A PC running Linux looks similar to a PC running Windowswhen the K Desktop Environment (KDE) is used. This needs no further explanation. Moredetails on logging in on Sun Workstation, using X Windows and CDE can be found on theweb site www.science.uva.nl/ict/documentation/login/. You are advised to familiarizeyourself with the CDE, for example by reading the Desktop Introduction that is availablein the CDE-Help system. One of the things that you must keep in mind is that there isa difference between clicking on the left, middle, or right mouse button1, depending on theposition of the mouse cursor. Left-clicking on an icon in the Control Panel activates in manycases a program, whereas right-clicking allows you to specify preferences. Right-clicking whenthe mouse cursor is on the desktop will open the so-called Workspace menu. But don’t worry,by practice you will find out the functions of the three mouse buttons.

One of the first things you need is a window to enter Unix commands. Such a terminalwindow can be obtained by selecting from the hosts menu. the item called this host. Themenu appears when you right-click on the desktop. In the terminal window you will see ablinking cursor after a prompt, indicating that the system is ready for input. For example,enter the command date to find out the current date and time of the day.

The last thing to do in a computer session is to logout. Clean the desktop, right-click onthe empty desktop, and choose the menu-item log out.... Alternatively, clean the desktopand press the Exit button in the Control Panel of the CDE (normally located below on thescreen).

1on a PC-mouse, the mouse wheel is often the middle button

4

1.2.2 Working on the students’ server from a PC

SSH (Secure Shell) is a program to log into another computer over a network, to executecommands in a remote machine, and to move files from one machine to another. It providesstrong authentication and secure communications over insecure channels. On all PC’s atthe faculty two types of SSH-clients are available: those that execute programs on a remotemachine and those that do secure file transfer. Make your choice in the SSH Secure Shellitem of the Programs menu, which is available under the Start button. You can also loginfrom a PC at home or elsewhere if a SSH-client available. An example of a free MS Windowsclient is PuTTY, which can be obtained www.chiark.greenend.org.uk/~sgtatham/putty.And if no SSH-client is available, you can still start a SSH-client directly from within your(Java capable) web browser: browse to gene.science.uva.nl/ssh/.

Logging in via a SSH-client is easy: you specify the machine that you want to work on,enter your user account, and type the corresponding password. For example, you can login on the central students’ server called gene, where all your files are stored and where allsoftware available to FNWI students, and use the password for your FNWI edu-account. Tologout, it suffices to enter the command exit.

1.2.3 Using softpkg

You are strongly advised to use the software package management facility, e.g., to enable theuse of packages like Matlab or Mathematica. Enter in a terminal window or shell client thecommand softpkg -l to see a long list of available packages and the names under which theyare added to the list.

(heck@gene 1) softpkg -lpackage os rev arch descriptionDEFAULT sunos any any default packagesDT sunos any any Theorem prover Deep Thought 3.4TeX sunos any sparc TeX typesetting system (teTeX 1.0.7)ace sunos any sparc ACE compilersacroread sunos any sparc Adobe Acroread..................

You must add the name of the desired software package at the end of the hidden file.pkgrc in your home directory. You can do this with an editor or by the following trick,which enables the use of Matlab 6.5:

(heck@gene 2) echo matlab-edu-r13 >> .pkgrc

To have effect in the current window you must enter the following command (at least whenyou are using the C shell), otherwise just start a new session:

(heck@gene 3) source .cshrc

Now you can start Matlab. For example, in the session below Matlab is started withoutthe Java Virtual Machine and without the Matlab desktop. We leave the software packageimmediately by entering the command quit.

(heck@gene 4) matlab -nojvm< M A T L A B >

Copyright 1984-2002 The MathWorks, Inc.Version 6.5.0.180913a Release 13

Jun 18 2002

Using Toolbox Path Cache. Type "help toolbox_path_cache" for more info.

To get started, type one of these: helpwin, helpdesk, or demo.

5

For product information, visit www.mathworks.com.

>> quit(heck@gene 5)

Exercise 1.1. Running Mathematica in command line mode

1. Open a terminal window and login with your user account on the students’ server.

2. Enter the command date to find the current date and time.

3. Enable the use of Matlab on the Unix machine, following the above instructions.

4. Enable the use of the computer algebra system Mathematica on the Unix machine.Verify that you can start it with the command math.

2 Basics of Unix

2.1 Directories and files

A file is a set of data that has a name. The information can be an ordinary text, a user-writtencomputer program, results of a computation, a picture, and so on. The file name may consistof ordinary characters, digits and special tokens like the underscore ( ) except the forwardslash (/). It is permitted to use special tokens like the ampersand (&) or spaces in a filename, but you are strongly advised not to use them because such file names are difficult tohandle under Unix 2.

Unix organizes files in a tree-like hierarchical structure, with the root directory, indicatedby a forward slash /, at the top of the tree. See the figure below, in which part of the hierarchyof files and directories3 on the computer is shown.

pwd cd ls

©©©© LLaaaa

bin¶¶ SS

tmp

gastel

½½½ZZZ

latexcourse proefles.zip

!!!!HHHH

heck walter

((((((((((hhhhhhhhhh

home

(((((((((((((((ÃÃÃÃÃÃÃÃ

````````

/ (root)

The path gives the route through the tree to arrive at a certain subdirectory or file. Anabsolute path (also called full path) starts at the root and lists all the subdirectories that youhave to go through to a arrive at a desired spot in the tree structure. For example, /homeis the subdirectory of the root that contains the home directories of all users. Your homedirectory is the starting point when you login to the system and where you have ownershipof files and subdirectories. During a computer session you can change the directory whereyou are at work, and move to another working directory (also called current directory). Thecommand pwd prints the name of the working directory and with the command cd you canchange your working directory. If you use a name of a file or directory that does not startwith a slash, then you refer to the object relatively with respect to your current directory.One speaks of a relative pathname.

2For example, you can only refer a file name like strange & difficult name if you put the name betweenapostrophes.

3A directory is a special kind of file that holds other files and other directories.

6

There are three special notations for directories:

˜ The tilde indicates your home directory.

. The single dot indicates the working directory.

.. Two dots, one immediately after the other, indicate the directory one level upward inthe tree structure that contains the current directory.

You will regularly use these special notations in Unix commands. For example, to move inthe hierarchical file system one level upward it suffices to enter the command cd ..

2.2 Changing the working directory

You can always find out what your working directory currently is by typing on a command linepwd ( print working directory). You can change from directory to another with the commandcd directory, whereby the name of the directory can be absolute or relative. The commandname cd stands for change directory.

Example:Suppose that your login name is equal to heck so that your home directory is /home/heck or~heck. At any moment you can set your working directory equal to this directory with oneof the following commands:

• cd /home/heck

• cd ~heck

• cd ~ (Recall that ~ stands in any command for the name of your own home directory)

• cd (So, cd without any argument always take you to your home directory)

Exercise 2.1. Changing your working directory

1. Open a terminal window and verify that you working directory is equal to your homedirectory.

2. Move in two different ways to the directory that is one level higher in the hierarchy offiles and verify that it is equal to /home .

3. Move from your home directory in three different ways to the home directory heck.

4. Suppose your working directory is /home. Find five ways to reset in one command yourworking directory to your home directory.

2.3 Simple commands to manage files and directories

In this subsection you practise working with files and directories. Think of tasks like creatingand deleting of files and directories, copying and moving of files, and so on. You obtain thefirst files to work with from a web site. It is a text document in various formats that containsa list of commonly used Unix commands.

Exercise 2.2. Download files via the web browserOpen the web browser Mozilla and enter the following web address for a list of frequently usedUnix commands: www.science.uva.nl/onderwijs/ict/unix/UnixCommands.html. Savethis information in a file in your home directory on the Unix server4. Repeatedly use ‘SavePage As. . .’ to save the file in the following two formats:

• Source, i.e., in the original format of HTML (use the type Web Page, HTML only).4On a PC in the FNWI-network, your home directory is the same as your folder My Documents and the

mounted network drive N:.

7

• Text, i.e., as plain text (use the type Text Files and file extension .txt).

Also print the web page to the file UnixCommands.ps (check the Print to file checkbox inthe print diolog window). If everything has gone well you have at this moment added three filesto your home directory, viz., UnixCommands.html, UnixCommands.txt en UnixCommands.ps. Check this and if it is not the case, make sure you get these three files.

The downloaded list of Unix commands mentions the following commands for manipu-lating files and directories5:

Command Explanationpwd print the name of the working directoryls give a listing of files in the working directoryls dir give a listing of files in the directory dirls -a [dir] show ‘hidden’ files, tools -l [dir] display all file attributes, too (long listing)ls -t [dir] sort listing of files on timestampmkdir dir make a new directory dirrmdir dir remove the empty directory dircd go to your home directorycd dir go to directory dircp f1 f2 copy file f1 to f2cp -r dir1 dir2 copy (recursively) the whole directory tree under dir1 to dir2locate f locate file f at file servermv f1 f2 change file name from f1 into f2mv f1 [f2 . . .] dir move file f1, f2, etc., to directory dirrm f remove file frm -rf dir remove the directory dir including all files and subdirectories.

You are not prompted for confirmation and undoing is not possible.file f determine the type of file fless f display contents of file f screen by screenmore f display contents of file f screen by screencat f display contents of file f in one go

You see in the table clearly that Unix commands are acronyms in general: mv instead of move,cp instead of copy, rm instead of remove, mkdir instead make directory, etc.

When you use tcsh6, the following two suggestions make working at the computer easier.

Name completion: Use the Tab key to extend names of files and directories as far aspossible, while they have only been partially entered.

Command line editing: With the Up-arrow key you can get back a previously enteredcommand on the command line. By pressing more than once the up- or down-arrow key youcan scroll through previous commands that can be changed and re-entered.

Exercise 2.3. Work with files and directoriesUse the above list of Unix commands for the following tasks:

1. Make a directory called UnixIntro .

2. Copy the text document that you created in the previous exercise, whose name endswith.txt, and with the list of Unix commands as contents into the newly createddirectory.

3. Make the UnixIntro directory now your working directory.5Optional arguments are between brackets.6tcsh is the enhanced C shell that is by default given to a new user account.

8

4. Move the HTML-file with Unix commands from your home directory to the UnixIntrodirectory (where you are now).

5. Remove the text document UnixCommandos.txt from your home directorywithout leaving the current directory UnixIntro.

6. Check what are the contents of the current directory and your home directory, withoutleaving the current directory.

7. Browse the contents of the text document with Unix commands that is still, if everythingwent well, in the directory UnixIntro, with the command more.

8. Browse the corresponding HTML-file and PostScript-file in your home directory.

9. Verify with the command file that the PostScript file UnixIntro.ps is (probably)recognized as an ascii document. If you would try to print the file as it is on a PostScriptprinter (don’t do this! ) the output would just be a waste of paper containing rawPostScript code. The reason is that the first 5 lines in the file may look like

2345X@PJL JOB@PJL SET RESOLUTION = 600@PJL SET BITSPERPIXEL = 2@PJL SET ECONOMODE = OFF@PJL ENTER LANGUAGE = POSTSCRIPT

because you did not choose ZZ Generic PostScript Printer as the current printer.Officially, the first line in a PostScript file must start with %!PS (but %! is also correct).One remedy is to delete the first 5 lines of the present file with an editor so that it startswith the line %!PS-Adobe-3.0 or something similar. Another remedy for you to try is toprint the web page www.science.uva.nl/onderwijs/ict/unix/UnixCommands.htmlagain to a file, but now by selecting first the ZZ Generic PostScript Printer (donot check the Print to file checkbox). Verify that you have now obtained a validPostScript file

10. Go to the home directory of someone else (your neighbor for example). Can see whatkind of files and directories this person has.

11. Return to your home directory and make a copy of the directory UnixIntro using thenew name unix. Verify that this directory is indeed an exact copy of the original.

12. Finally remove the directories UnixIntro and unix.

2.4 Printing of files

For making a printed copy of a document in a Unix environment the following three commandsare relevant:

• lpr for the actual printing.

• lpq for inspecting the printer queue.

• lprm for removing a print job in the printer queue (in case you did something wrong orhave no time left to wait for the printed output).

For the last two tasks exist alternative commands, viz., lpstat, to display information aboutthe status of the print service, and cancel, to cancel a print request. We refer to the onlinemanual page for details.

9

In print requests you must specify the name of the printer. In the Euclides building thestudent printer is called sl1-1 and it is located on the first floor in room P103, nearby thecomputer room P127. In the Wibauthuis pr-w3-01 is the printer available to students. Werefer to the web page www.science.uva.nl/ict/printers for details about FNWI printers.The specification of the printer is done via the option -P. For example, use

lpr -Psl1-1 filename

to print the file with given name on the printer sl1-1.

Exercise 2.4. Make a printed copy

1. Check with the command file whether you have indeed a PostScript version of the listof Unix commands (this is the file which has most probably the extension .ps).

2. Print the PostScript file to the nearest PostScript printer available.

3. Check with lpq how many print jobs are in the printer queue and see if your own printjob is included.

4. Remove your print job via lprm if this is still possible. For this you need the job-id ofyour print job. This number can be found with lpq. The command lpq is also usefulto find out whether your document has already been printed and can be taken from theprinter.

5. If you have removed the print job before, re-enter the print job and get the paper fromthe printer once it is ready with your job.

2.5 Processes

Every command that you enter or each menu item that you select in a graphical user interfacehas the effect that some process is started. Entering the pwd command has the effect that theprocess with the same name is started. The program code resides in the file /bin/pwd. Thisfile is not human readable, but it is executable computer code. Another command is matlab,which starts the numerical software environment with this name. The instructions to startthis program can be found in the file /usr/local/arch/matlab-edu_r13/bin/matlab. Youcan verify this by

(heck@gene 6) which matlab/usr/local/arch/matlab-edu_r13/bin/matlab

Exercise 2.5. Using PerlFind out where the Practical Extraction and Report Language (Perl) resides, i.e., where theperl program that allows you to run Perl scripts can be found on your computer.

From the examples you see that we hit a problem: which process must actually be startedwhen a command is entered? The file system is so large that a complete search for therequested process is too time-consuming. Besides, what to do when various versions of aprogram exist on different locations? In order to circumvent both problems, the shell, i.e.,the program that allows you to communicate with the operating system of the computer, usesa standard search path for commands entered. In many shells this search path is stored in theso-called environment variable PATH. Although you can specify the search path in a start-upscript of the shell in an explicit way, this is not recommended at FNWI. Instead you must usethe previously explained software package management facility softpkg.

In the Unix world one prefers to speak about processes instead of programs because youcan use a program more than once at the same time. Unix is a so-called multi-user, multi-tasking operating system. During a computer lab many students will use the same texteditor or the same computational software program at the same time. A single user may alsoactivate the same program more than once. In order to distinguish activated programs from

10

each other we call each started program a process. In short, a process is a ‘running’ programusing its own memory space and attributes. A new process is started each time when youstart a program. Later you will learn more about managing processes.

2.6 Unix documentation

All standard Unix commands and many other commands are described in so-called man pages.A man page (abbreviation of “manual page”) is a clarifying description of a command. Youget the explanation via the man command, followed by the name of the command about whichyou want information. For example, man pwd explains the pwd command. In the terminalwindow win which you enter this command you get something like:

User Commands pwd(1)

NAMEpwd - return working directory name

SYNOPSIS/usr/bin/pwd

DESCRIPTIONpwd writes an absolute path name of the current workingdirectory to standard output.

Both the Bourne shell, sh(1), and the Korn shell, ksh(1),also have a built-in pwd command.

ENVIRONMENTSee environ(5) for descriptions of the following environmentvariables that affect the execution of pwd: LC_MESSAGES andNLSPATH.

EXIT STATUSThe following exit values are returned:

--More-- 32%

The last line indicates that only 32% of the man page has been displayed yet. You cancontinue in many ways: with the Return or the ‘usual’ Enter key you proceed line by line;pressing the space bar brings you a whole page further. When you keep pressing the spacebar you will finally see the normal prompt back on the screen. You can finish reading theman page in between by pressing the q key or by entering the ZZ character combination.

Entries in the reference manuals are organized into sections. In the above example, yousee the information of section 1 about pwd. You can specify in which section to search forinformation.

Exercise 2.6. Searching a man page in a specific section

1. Find out what is the difference between the command man ispell and man -s4 ispell

2. Compare the man page of environ in section 1 and 5.

With man -k keyword you can search the on-line help system for the given keyword . Forexample, man -k HTML gives a list of commands that have to do with HTML.

(heck@gene 7) man -k HTMLtexi2html texi2html (1) - a Texinfo to HTML converter

2.7 Logging out

The last thing to do in a login session is to log out. You can use the logout command orsimply type exit.

Exercise 2.7. Ending a sessionStart a new login session on the student server and terminate it again.

11

3 Managing files and directories

3.1 File attributes

Because Unix is a multi-user operating system, it keeps an administration of the ownershipand user permissions of files and directories. Suppose ls -l gives the following long listing

-rw-r--r-- 1 bvandijk st-wis 21 Aug 20 09:24 voorbeelddrwx------ 1 bvandijk st-wis 21 Aug 20 09:24 Mail

then the user account bvandijk is owner of the file voorbeeld and the directory Mail. Thedirectory can only be visited, read, and written by the user account bvandijk. Each line inthe long listing gives columnated the following information:

1. mode: The first 10 special characters are the file attributes The first character denoteswhat kind of file it is: the hyphen - in the above example shows that voorbeeld is an‘ordinary’ file. Directories are special files listed by the character d. You may also seethe character l denoting a symbolic link, but we do not pay attention to such files inthis introduction nor to other exotic entries. The next 9 characters in the first columnare the file permissions. Read them in groups of three characters: the first set showswhat the owner can do with the file, the second set of three characters indicates thepermissions of group members , and the last set establishes the permissions of otherusers. For security reasons users are divided into groups: science students are placed ingroups like st-wis (mathematics student) and st-schei (chemistry student). In ourexample it can be seen that bvandijk is owner of the file voorbeeld and that this useris member of the group st-wis. The first set of tokens rw- indicates that the ownercan read the file (r permission) and can change its contents (w permission). The thirdtoken is in this case -, but many times you will see there the token x when it is anexecutable file. The next two sets of tokens (r--) indicate that fellow members of thegroup st-wis and all other users can only read the contents of the file.

A second example: ls -l /bin/pwd displays the following mode of this file -r-xr-xr-x,meaning that this file is only readable and executable for each user.

2. number of links: this is not interesting for us.

3. owner: the login name of the owner.

4. group: the name of the group to which the owner belongs.

5. size: the disk space (in bytes) token up by the file.

6. date and time: The time stamp when the file was created or changed for the last time.

7. name: The name of the file.

We summarize the rwx permissions of files and directories:

• files:The r permission means that the file is readable.The w permission means that the file contents may be changed (writable file).The x permission indicates an executable file.

• directories:The r permission means that a listing of the files in the directory may be displayed.The w permission allows the contents of the directory to be changed. Note: files youmay not be the owner of or files of which the write-permission is turned off, but thatare in a writable directory, can be removed or given another name, even though youmay not be allowed to changed them.The x permission allows you ‘to go through the directory’, i.e., to use a name of a file inthe directory. Whether you can do something with the file depends on the permissionsof the file itself.

12

File attributes can be changed in the following ways:

• chown loginname file . . .Make the user with the given account name the owner of the file(s) mentioned. Onlythe current owner can execute this command, but after doing this the ownership hasgone to the other user.

• chgrp groupname file . . .Change the group of the file(s) mentioned.

• chmod mode file . . .Change the permissions of the file(s) of which you are owner with respect to readability /writability / executability for yourself (user), a fellow member of the group (group), orother users (all). The most comprehensible manner to request a mode of a file is asfollows: indicator=rwx, where indictor is u (user) for the owner, g (group) for membersof the group (minus the owner), and o (others) for the rest of the people having a useraccount. For example, the permissions rw-r--r-- of the file voorbeeld come into beingby the command

chmod u=rw,g=r,o=r voorbeeld

Combinations are also permitted: go means anyone but the owner. Just before youcould have entered chmod u=rw,go=r voorbeeld. Instead of ugo you may also usethe token a. For example, assuming that the current permissions of the example fileare rw-r--r--, the command chmod a=r voorbeeld makes the file readable and onlyreadable for everyone. Instead of the equal sign (=) you may use the plus sign (+) andthe minus sign (-) to add and remove permissions, respectively. A small session toillustrate this:

(bvandijk@gene 1) chmod u=rw,g=r,o=r voorbeeld(bvandijk@gene 2) ls -l voorbeeld-rw-r--r-- 1 bvandijk st-wis 21 Aug 20 09:24 voorbeeld(bvandijk@gene 3) chmod a=rw voorbeeld(bvandijk@gene 4) ls -l voorbeeld-rw-rw-rw- 2 bvandijk st-wis 12 Aug 20 09:24 voorbeeld(bvandijk@gene 5) chmod go-w voorbeeld(bvandijk@gene 6) ls -l voorbeeld-rw-r--r-- 2 bvandijk st-wis 12 Aug 20 09:24 voorbeeld(bvandijk@gene 7) chmod g+w voorbeeld(bvandijk@gene 8) ls -l voorbeeld-rw-rw-r-- 2 bvandijk st-wis 12 Aug 20 09:24 voorbeeld

By the way, the default permissions of a new file or directory are such that only the ownercan change them.

We end this section with a listing of the most important options of the ls command.Options may be combined: instead of ls -l -a you may also enter ls -la.

Option Meaning-l display all file attributes-a display all files, including the ‘hidden’ files starting with a dot-t sort listing of files on time stamp-u sort listing of files on last access (use)-d if an argument is a directory, list only its name and not its contents-R for each directory, list all files in this directory and all files in

subdirectories, etc. (R stands for “recursively”)

13

Exercise 3.1. Listing of file permissions

1. Make a long listing of the root directory.

2. In which subdirectory everybody has write permission? Check that you can indeedcreate a file in this subdirectory.

3. Check in the directory /bin which files are executable.

4. Check which files are executable in /usr/local/bin.

Exercise 3.2. Changing permissions of files and directories

1. Create a file so that you can practise the use of the chmod command.

2. Change the permissions of the file such that everybody may do anything.

3. Change the permissions of the file such that the owner can only read the contents ofthe file.

4. Change the permissions of the file such that anyone in the group but the owner cannotdo anything with the file.

5. Change the permissions of the file such that the owner cannot overwrite the file.

6. Remove the file and repeat the above tasks with a directory. Particularly interesting isa directory with only the execute permission.

3.2 Wildcards

Suppose that you want to get with ls an overview of all matlab files of which the name endswith .m in the current directory. With ls alone you may see so many files that it is not easyanymore to find the Matlab files. More convenient is in this case the command ls *.m thatlists all file names in the current directory that end with .m. The asterisk in this exampleis called a wildcard and stands for any sequence of tokens. One exception: if the asteriskappears at the beginning or immediately after a slash “/”, then you may not substitute a dot“.” as first token. So: if the current directory contains a file with name .voorbeeld.m, thenit is not listed with the command ls -a *.m . More examples of wildcards:

• all file names that begin with opg can be specified with opg*

• all file names that begin with prog and end with .m can be specified with prog*.m

• all file names that do not begin with “.” can be specified with *

The question mark is interpreted by the shell as ‘any single character’. You can make matchingof characters more specific by enclosing a set of characters in square brackets. Examplesexplain this better:

• opg? stands for all file names that begin with opg followed by one token.

• opg[12] stands for all file names that begin with opg followed by the single digits 1 or2, i.e., the file names opg1 and opg2, but not opg3 or opg12.

• opg[0-7] stands for all file names that begin with opg followed by one of the digits 0,1, . . ., 7.

• opg?? stands for all file names that begin with opg followed by exactly two tokens.

• [A-Z]* stands for all file names that begin with an uppercase character.

14

Note that you may use more than one wildcard at the same time and compose somepattern. Such patterns can be used in other commands as well. For example, cp *[0-9] /tmpcopies all files whose name end with a digits to the directory /tmp and mv * .. moves allfiles in the current directory up one level in the hierarchy of files.

If you do want the shell to take an asterisk or a question mark literally you must encloseit by double quotes.

Exercise 3.3. Using wildcards

1. make a listing of all files in your home directory that have a file name beginning with adot.

2. copy all non-hidden files of your home directory to /tmp and then remove all files in/tmp of which you have ownership.

3.3 Locating and comparing files

Sometimes it is difficult to find back a file. Then the locate command may be helpful. Withthe command locate pat you search one or more databases of file names and display the filenames that contain the pattern pat . An example:

(heck@gene 1) locate email.html/home/gwhakker/Opera/Help/usemail.html/home/jberk/opera/Help/en-GB/usemail.html/home/jkottman/public_html/email.html.....

Such a listing of files can become very large and contain many files that have nothing to dowith your own files. In this case it is better to ‘pipe’ the result of one command as argumentsof another command. Use the vertical bar for a pipe. For example, the above output oflocate can be piped to the grep command in order to select on the pattern “usemail”.

(heck@gene 1) locate email.html | grep usemail/home/gwhakker/Opera/Help/usemail.html/home/jberk/opera/Help/en-GB/usemail.html/home/sputten/Opera/Help/usemail.html/home/vdmeer/Opera/Help/usemail.html

This command grep deserves more explanation. It is a program that reads a text streamand filters out the lines matching some pattern. The command grep FNWI < file1 > file2reads file1 and writes all lines in which the word FNWI occurs to file2 . This is called I/Oredirection: input and output have nothing to do anymore with the terminal-window. Ifwe leave out in the above command the part > file2, then the output is send to ‘standardoutput’, i.e., in most cases to the terminal window. You can leave out the less-then sign, too:grep FNWI file1 . In this case, the lines containing the pattern FNWI in file1 are listed.Wildcards can be used: with grep FNWI * you search in all files in the current directory forlines containing the word FNWI. Unix displays the file name and the line in which the patternis found.

Sometimes you want to compare the contents of two files. The command diff file1 file2displays all lines in which the files differ from each other. If no differences are found, Unix isvery brief: no message, but only a new prompt to enter a command.

Exercise 3.4. I/O redirectionFind out what the following two commands do:

• ls | more• ls > lijst

15

3.4 Secure ftp

ftp stands for file transfer protocol. This makes it possible to download and upload files fromone computer to another. For example: you can ftp files from your computer at home to thestudents’ server gene. Ftp can also be arranged via a web browser such as Mozilla. Enterthe web address ftp://[email protected] (instead of username use your ownloginname). An example session of jvdwindt on workstation ow34. We interrupt the sessionfor explanation.

First a secure ftp-connection must be established between the workstation ow34 (localcomputer) and the students’ server gene (remote computer). You must login.

(jvdwindt@ow34 1) sftp gene.science.uva.nlConnecting to gene.science.uva.nl.Warning: Permanently add ’gene.science.uva.nl’ (RSA) to the list of known [email protected]’s password:sftp>

Once the connection is established, many commands can be entered. For example, ls to listthe files in the working directory on the remote computer.

sftp>ls *drwx--l--- 2 jvdwindt st-inf 1024 Aug 30 15:46 nsmaildrwx--x--x 11 jvdwindt st-inf 512 Aug 10 08:55 public_html-rw-r--r-- 1 jvdwindt st-inf 21 Sep 1 10:35 testfile-rw-r--r-- 1 jvdwindt st-inf 21 Sep 1 10:37 testfile2sftp>

There exist two commands to transfer a file: get to transfer a file from the remote computerto the local computer and put for file transfer in the other direction. With get and put onlyone file can be sent at the same time. Use wildcards if you want more files to be transfer ina single command.

sftp> get testfiletestfile 100% 8 1.3KB/s 00:00ftp> get *Fetching /home/jvdwindt/Mail to Mailcannot download non-regular file: /home/jvdwindt/MailFetching /home/jvdwindt/testfiletestfile 100% 8 1.3KB/s 00:00Fetching /home/jvdwindt/testfile2testfile2 100% 8 1.3KB/s 00:00

Our remote computer is a Unix machine and the command cd works as usual. To changethe working directory on the local computer you must use the lcd (l stands for “local”)command.

sftp> lcd public_htmlsftp> cd nsmailsftp> put index.htmlindex.html 100% 36KB 622KB/s 00:00

You leave the sftp program by entering bye or quit.

ftp> bye(jvdwindt@ow34 2)

When you use ftp you must be careful and think at each command at which computeryou entered the sftp command (local machine) and to which computer you established theconnection (remote machine). The most important commands that you can use inside sftpare:

16

sftp command Explanationcd dir change directory on remote computer.lcd dir change directory on local computer.put file copy file from local to remote computer.get file copy file from remote to local computer.lls dir display local directory listingbye leave the sftp programquit leave the sftp program

Hint: if you transfer files from Unix machines to Windows PC’s and vice versa, then you willsoon notice that text files have different format: DOS format on a PC and ISO format inUnix. In order to quickly change from one format into the other you can use the commandsdos2unix and unix2dos.

Exercise 3.5. File transferTransfer a file and a small directory from the PC you are working on to the students’ servergene. Hereafter, transfer the file and directory back to your PC in the directory D:\temp.

3.5 File compression and archives

To save disk space you are advised to compress a file that you do not need instant access toanymore or that does not have to be stored in readable format. Especially PostScript file incompressed format much smaller. There exist several command for file compression, the twomost popular of which are:

• compress and uncompress to pack and unpack a file, respectively. A compress file canbe recognized by the extension .Z

• gzip and gunzip are commands from the GNU series. A compress file can be recognizedby the extension .gz.

We recommend the use of the GNU commands gzip and gunzip because gzip creates ingeneral a more compact file than compress does. By the way, recent versions of the WinZipprogram on a PC recognize a gzipped file. The following computer session illustrates howspectacular the saving of disk space can be.

(heck@gene 1) ls -l intro*-rw-r--r-- 1 heck ams 3190967 Aug 21 11:03 intro.ps(heck@gene 2) compress intro.ps(heck@gene 3) ls -l intro*-rw-r--r-- 1 heck ams 1275515 Aug 21 11:03 intro.ps.Z(heck@gene 4) uncompress intro.ps.Z(heck@gene 5) gzip intro.ps(heck@gene 6) ls -l intro*-rw-r--r-- 1 heck ams 1053268 Aug 21 11:03 intro.ps.gz(heck@gene 7) gzip intro.ps(heck@gene 8) ls -l intro*-rw-r--r-- 1 heck ams 1053268 Aug 21 11:03 intro.ps.gz(heck@gene 9) gunzip intro.ps.gz(heck@gene 10) ls -l intro*-rw-r--r-- 1 heck ams 3190967 Aug 21 11:03 intro.ps

The above commands only work for a single file. There exist other commands for archivingand compressing a complete directory in a single file: zip and unzip, or tar . To start withthe first two commands: suppose that you have in the current directory a subdirectory, saywith the name testdir, then the command zip -r testdir testdir creates the archivetestdir.zip in which all the files of the directory testdir are stored in compressed format.The command unzip testdir.zip uncompresses the files and creates the directory testdirwith the given contents.

17

The command tar (tape archive ) can be used to create a so-called tar file, to change it,or to unpack such a file. A tar file is usually a file in which a complete directory structure isstored. The current directory (and the complete directory structure beneath) can be packedinto a tar file by

tar cvf file.tar .

and can be unpacked (for example, in a different directory) by

tar xvf file.tar

The character c and x stand here for “create” and “extract”. The character v stands for“verbose” and make information about the process of packing and unpacking available toyou. You may leave this option out of your commands.

The next computer session illustrates the use of zip, unzip and tar.

(heck@gene 1) ls -ld test*rwxr-xr-x 2 heck ams 512 Aug 21 12:24 testdir(heck@gene 2) zip -r testdir testdiradding: testdir/ (stored 0%)adding: testdir/intro.ps (deflated 67%)

(heck@gene 3) tar cvf testdir.tar testdira testdir/ 0Ka testdir/intro.ps 3117K

Now we have created two archives, of which the zip archive is already compressed and the tararchive can be compressed afterwards.

(heck@gene 4) ls -l test*-rw-r--r-- 1 heck ams 3193344 Aug 21 12:25 testdir.tar-rw-r--r-- 1 heck ams 1053531 Aug 21 12:25 testdir.zip

testdir:total 6256-rw-r--r-- 1 heck ams 3190967 Aug 21 11:03 intro.ps(heck@gene 5) gzip testdir.tar(heck@gene 6) ls -l testdir.*-rw-r--r-- 1 heck ams 1053437 Aug 21 12:25 testdir.tar.gz-rw-r--r-- 1 heck ams 1053531 Aug 21 12:25 testdir.zip

It is possible via options, filters, and I/O redirection to create a tar file and to compress itsresult in one command:

(heck@gene 7) tar cvf - testdir | gzip -c > test.tgz

creates the compressed tar file test.tgz from the directory testdir. The next commandunpacks the archive:

(heck@gene 8) gunzip -c test.tgz | tar xvf -

Exercise 3.6. File compression and archives

1. Use the quota command to find out what disk quota holds for you.

2. Make sure that you have some PostScript files with extension .ps, for example bycopying a single PostScript file to other files with extension .ps

3. Zip these PostScript files into one zip archive. Check your quota. Unzip the archiveand check again your disk quota.

4. Tar the PostScript files into one tar file and compress the result. Remove the PostScriptfiles and check your disk quota.

5. Remove the PostScript files that you do not need anymore.

18

4 Managing processes

4.1 Working with more programs at the same time

UNIX is a multi-processing operating system: besides the shell, which is always present,other processes can be active at the same time. Normally the shell is in a waiting status whenanother process runs, but by ending a command line with an ampersand “&”, the process isput running in the background and the shell comes immediately with a user prompt. We speakabout “starting a job in the background”. For example, in order to start Matlab in a terminalwindow and to be able to use the same terminal window for entering other commands, youenter matlab & . You see in the terminal window something like:

(heck@gene 1) matlab &[1] 3886(heck@gene 2)

Before the second Unix prompt you see between square brackets the job number (in thiscase there is only one job) and the process ID number (a unique label of the process). Insubsequent commands you can refer to the job or the process by the job number and theprocess ID number. Let us also start a text editor in the background :

(heck@gene 2) emacs &[2] 3894(heck@gene 3)

A new text window appear, but you can still enter commands in the terminal window. Thisfeature makes a Unix system so attractive: you can work smoothly with various programs atthe same time. While a heavy computation is running in one window, you can already bebusy with writing a report about this work.

4.2 Inquiring about the process status

You can ask which processes you have in use and what their status is by the ps command(process status).

(heck@gene 3) psPID TTY TIME CMD3920 pts/5 0:06 Matlab3925 pts/5 0:00 emacs3916 pts/5 0:00 tcsh

You get more information with the option -l

(heck@gene 4) ps -lF S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD8 S 10330 3920 3916 0 40 20 f5ffc468 2892 f630893e pts/5 0:06 matlab8 S 10330 3925 3916 0 40 20 f5fab460 1395 f6308556 pts/5 0:00 emacs8 S 10330 3916 3915 0 41 20 f5ffcb28 541 f5ffcd20 pts/5 0:00 tcsh

You get one line of information for each process. The status of each process is stated in thefirst column under “S”. The possibilities are:

19

Job status ExplanationO Operational, i.e., the process is currently running on a processor.R Runnable, i.e., the process is active or is waiting

for its turn in a waiting queue.S Sleeping. The non-active process waits for an ‘event’.T Terminated. For example interrupted by the user or stopped

because input was asked from the terminal whilethe process ran in the background.

Z Zombie process. These are finished process, but this changeof status has not been ‘noticed’ (yet).

Other part of the information obtained by ps -l are:

UID The user ID number identifies the user that started the process.

PID The process ID number is the unique process number that distinguishes this processfrom others.

PPID The ‘parent process ID number’ indicates the process inside which a given process wasstarted. In our example you see that the commands matlab and emacs have beenstarted in the shell tcsh with process ID number 3916.

SZ The memory space allocated by the process(SIZE in pages; 1 page = 4Kbytes).

TIME The ‘computing time’ (in seconds) that the process consumed since its start (waitingtime excluded).

TTY The terminal on which the process runs.

CMD The command that started the process.

The ps commando has many options. In combinations of options all options must becollected into the first argument. Three much used options of ps (besides -l) are:

-a displays information about all processes with terminals, also of other users.

-A (identical to -e) displays information about all processes, including those without anassociated terminal.

-u display information about all processes of a user, also of processes running in a separateterminal.

If you only want information about processes that have been started in the current shell,then it is more convenient to use the jobs command. instead of ps. With the option -l theprocess ID number are also displayed.

(heck@gene 5) jobs -l[1] + 3920 Running matlab[2] - 3925 Running emacs

The plus sign at the matlab job indicates that this is the ‘current job’. This has only meaningwhen controlling multiple jobs. See the next subsection.

4.3 Job control

A job running in the foreground or a process that was started in the ‘normal’ way, i.e.,without the ampersand &, can be put into the background by interrupting the process with ^Z(Control-z: When the cursor is in the terminal window in which the job was started, pressingthe z key while holding the Control key down), followed by entering bg (background). In the

20

opposite direction, you can bring a process from the background into the foreground with fg(foreground). There can only run one process in the foreground. A process in the foregroundcan often be terminated by ^C (Control-c). For example, enter in a terminal window thecommand clock . A window with a clock displaying the current time appears. It disappearswhen you enter Control-c in the terminal window in which you started the clock.

A process in the background can be stopped with the stop command. Let us demonstratethis in a continuation of the previously started computer session.

(heck@gene 6) emacs^ZSuspended(heck@gene 7) bg[3] emacs &

After we first started the text editor emacs in the foreground in a terminal window, wehave interrupted the process and put it into the background. There are now 3 jobs in thebackground:

(heck@gene 8) jobs[1] + Running matlab[2] - Running emacs[3] Running emacs

If you want to bring process 3 again into the foreground, then enter:

(heck@gene 9) fg %3emacs^C(heck@gene 10) jobs[1] + Running matlab[2] - Running emacs

If you do not specify a job number in the fg command, then the ‘current job’ is brought intothe foreground. This is the job that is marked in the job listing with a plus sign. Above wehave interrupted the text editor by Control-c. There are now only two processes left. Let usinterrupt the matlab program, too. Because there is only one process with this name, youcan also use the job name instead of the job number. To get rid of the job you can enter thekill command.

(heck@gene 11) stop %matlab[1] + Suspended (signal) matlab(heck@gene 12) jobs[1] + Suspended (signal) matlab[2] - Running emacs(heck@gene 13) kill %1(heck@gene 14)[1] Terminated matlab(heck@gene 14) jobs[2] + Running emacs

Individual processes listen to their process ID number: For example kill -9 3920 wouldhave killed the matlab process 3920, too.

When you try to log out while there are still suspended jobs, then the shell will tell you sovia the message There are stopped jobs. By entering logout once more you can really finishthe computer session.

21

Exercise 4.7. Job control

1. Start at least three processes (for example, xclock, xemacs, xman, netscape). Start thefirst process immediately in the background, put the second process into the background,and the third process you terminate immediately with Control-c.

2. Bring the first process to the foreground and terminate it.

3. Do the same for the second process.

22

5 Summary of Unix commands

In the tables below we use the following abbreviations.

Ctrl-x hold down the Control key and press the x keyd directoryf filen number[ ] optional argument. . . list of arguments

Managing files and directories

pwd print the name of the working directoryls give a listing of files in the working directoryls d give a listing of files in the directory dls -a [d ] [f. . .] show ‘hidden’ files, tools -l [f. . .] display all file attributes, too (long listing)ls -t [d ] [f. . .] sort listing of files on timestampmkdir d make a new directory drmdir d remove the empty directory dcd return to your home directorycd d go to directory dcp f1 f2 copy file f1 to f2cp -r d1 d2 copy (recursively) the whole directory tree under d1 to d2locate f locate file f at file servermv f1 f2 change file name from f1 into f2mv f1 [f2 . . .] d move file f1, f2, etc., to directory drm f remove file frm -R d remove the directory d including all files and subdirectories;

you are not prompted for confirmation and undoing is not possible!chmod mode f1 [f2. . .] change the attributes (mode) of file f1 (f2,. . .)chmod -R mode d change recursively the attributes (mode) of everything in directory dfile f determine the type of file fless f display contents of file f screen by screenmore f display contents of file f screen by screencat f display contents of file f in one go

Tip: With the Up-arrow key you can get back a previously entered command on thecommand line. By pressing more than once the up- or down-arrow key you can scroll throughprevious commands that can be changed and re-entered.

Tip: Use the Tab key to extend names of files and directories as far as possible, while theyhave only been partially entered.

Printing

lpr -P printer f print file f on printerlpq -P printer display a list of files in print queue and the job-id of print jobs on printerlprm -P printer n remove the print job with job-id n from the print queue on printer

Printers: We refer to the web page www.science.uva.nl/ict/printers for details aboutFNWI printers.

23

Managing processes

Ctrl-c terminate the running process in the terminal windowCtrl-z z¿put the running process in the terminal window to the backgroundcommand & execute the command in the backgroundbg [%n] resume the process (job n) in the backgroundfg [%n] resume the process (job n) in the foregroundjobs print status of processes started in the current shell (a.o., job-id)jobs -l print detailed status of processes started in the current shellps print status of processes (a.o., process-id)ps -l print status of processes in full detailps -u user print status of all processes of the particular userkill n terminate the process nkill -9 -1 terminate all processes and scruple at nothing (only in case of emergency)

Various commands

passwd change your passwordman command name display the man page (manual) for the particular commandman -k keyword search for man pages about the keywordlocate word locate files with word in their file namealias name1=name2 make an alias name1 for command name2 .

Permanent aliases can be put in the file .aliases in thehome directory

quota -v user display the disk quota and amount of disk space in usefor the given user

compress f1 [f2. . .] compress file(s) in Z-formatuncompress f1 [f2. . .] uncompress file(s) from Z-formatgzip f1 [f2. . .] compress file(s) in gzip-formatgunzip f uncompress gzipped filetar cf tarfile d pack file(s) from directory d in a single file in tar-formattar xvf f unpack tar-archive f

Network-oriented tasks

rwho display who is logged in on what computersfinger user display information about the given userssh computer log in (remotely) on the specified computerssh -l user log in (remotely) on the give computer as the specified userlogout terminate the terminal sessionwrite user send the given user a message on the screenmesg n disable receipt of screen messagesmesg y enable receipt of screen messagestalk user talk online with the given usersftp computer (secure file transfer protocol) start a secure ftp session on the given

computer in order to transfer files betweenthe computer you are currently working on (for example at home)and the computer. Commands are:put for sending and get for receiving.

By the way, information about remote access via a modem can be found at www.ic.uva.nl/uvainbel.

Redirection, search patterns, etc.

• With > you can send the output of a command to a file instead of the terminal window.For example, ls > file puts the listing of ls into the file.

24

• With < you can use a file as input for a command.

• With | you can use the output of one command as input for another command. Forexample, ls | more allows you to look at the output of ls screen by screen.

• grep search pattern displays the lines in the current text stream containing the search pattern.grep is mostly used in combination with other commands. For example, rwho | grep userom to check if the user is logged in on some computer.

• A search pattern is a sequencer of tokens, in which *, ? and [ ] have a special meaning:

– * stands for any sequence of tokens

– ? stands for single arbitrary token

– for tokens between square brackets [ ] one of these tokens is selected.

For example, ls [ab]*.??? gives a list of all files whose name starts with a or b andthat end with a dot (.) followed by three arbitrary tokens. This is useful for filemanagement, For example, cp * ~ copies everything from the working directory toyour home directory.

Software

softpkg -l display a list of all software packages available on the computer system.A package can be used if its name (i.e., its identifier in the softpkg-list)is placed in the file .pkgrc in your home directory.

mozilla start the Mozilla webbrowserispell f apply the spelling-checker for the English language

to the words in the file fxemacs [f ] start the Emacs full screen editor under X Windows

(and open file f)vi [f ] start the vi full screen editor (and open file f)xv [f ] start xview for display of an image (in file f)gv f start ghostview for display of PostScript file fgs f start ghostscript for display of PostScript file facroread f start Adobe Acrobat Reader and display PDF-file fxdvi f display dvi-file fdvips -f file | transform contents of dvi-file file into PostScript format and

print it on printerdvipdf f.dvi create from dvi-file f.dvi the PDF-file f.pdfmathematica [f ] start computer algebra system Mathematica (and open notebook f)xmaple [f ] start computer algebra system Maple (and open worksheet f)matlab [-njvm] start the numerical software package Matlab (eventually, without the Java Virtual Machine and without the Matlab desktop

25