TEACH UNIX.INTRO Aaron Sloman April 1998 Updated Nov 1999 This is a shortened introduction to Unix for Birmingham users with the default "new user" setup. More detailed online tutorial information, for more advanced users, is available in the files HELP SHELL and HELP UNIX.COMMANDS. The file HELP CTWM describes the default window manager in more detail than this file. CONTENTS -- What is Unix? -- Logging in -- The window manager -- Xterm windows and Unix commands -- Unix shells -- "Your files" -- The unix file structure -- -- The root directory / -- -- Subdirectories can have subdirectories -- -- Physical devices do not have special directory names -- -- Individual user files and directories -- Listing and removing your files -- Getting a long directory listing -- Your Mail directory -- Deleting files -- Incomplete filenames -- Moving and copying files -- Directories -- -- The current directory -- -- The Unix root directory and its sub-directories -- A shorthand name for your own directory -- A shorthand name for someone else's directory -- Creating a subdirectory -- Changing the "current" directory -- -- Use of ".." -- --Getting back to your login directory -- Man files -- Online "unixhelp" tutor -- Further information -- What is Unix? ------------------------------------------------------ Once upon a time Unix was a particular operating system, developed at AT&T Bell Laboratories, which soon became very widely used by academics mostly running on DEC PDP11 computers. An operating system can be thought of as a collection of programs which run on a computer and make it possible for all the other programs to work together, including system programs which manage the file system, network connections, user logins, and also other programs installed by users. All the programs essentially run under the control of the operating system. Eventually the Bell Labs Unix operating system was ported to different machines, and various computer vendors and academic groups started producing their own versions of Unix. The result was a proliferation of Unixes (Unixen?) from AT&T, Sun, HP, Apollo, DEC, IBM, SCO, Sequent, and others who sold hardware and/or software. Groups of dedicated enthusiasts also produced Unix systems, the best known of which is probably Linux which has been ported to a wide range of machines (including PCs), is essentially free, and is spreading rapidly among both individual users and commercial organisations, e.g. internet service providers and government organisations. IBM is now investing very heavily in Linux and free software based on it. The new Apple Mac operating system Mac OS X is essentially a unix-based operating system, built on open software. So the linux movement is gaining momentum, and is a great threat to Microsoft, whose policies and software do so much harm. In the School of Computer Science at the University of Birmingham the main Unix systems which we have are Solaris (which runs on Sun workstations and larger computers), Digital Unix (which runs on our Digital alpha stations, and also on the main central interactive computing service on the campus). We also have some machines running Silicon Graphics Unix and some running Linux (e.g. in the robot laboratory) in addition to many PCs running different versions of windows. We shall be moving more and more towards use of linux on PCs as that is proving to be the most cost-effective way of providing the power, flexibility and reliability of unix systems. For more on linux look at http://www.linux.org and follow links from there. The School also has some Xterminals which are not themselves Unix machines, but can be used to connect to Unix systems in such a way as to give the impression that you are sitting at a Unix workstation. The Xterminals have a relatively simple operating system which enables them to handle the screen, the keyboard, the mouse and sometimes additional devices such as local printers or audio devices. The X terminals are able to do this because most Unix systems have been developed (since the mid to late 80s) with the ability to handle the screen, mouse and keyboard of a remote machine running the X Window System, developed by a consortium of academic and industrial organisations. Most of our PCs running Windows have a package called eXceed which also runs the X window system, making it possible from a PC to log in to a Unix system, e.g. on a Sun in the computer room (dipsy, laa-laa, tinky, po). (On a 2-button mouse, clicking both buttons together is interpreted as clicking the middle button of a 3 button mouse, required for many Unix graphical programs.) It is also possible to log in remotely to a PC running Linux, a version /of Unix, though that is not normally required in our teaching laboratories. Unfortunately it is not normally possible for Unix users to log in remotely to a machine running windows, since Microsoft either does not know how to design multi-user operating systems or has decided that it is not a profitable thing to do. There are packages making it possible for Unix users to log in to a PC and run windows software as if sitting at the PC, though the software is very expensive and needs a lot of memory per user. There are also packages for the Apple Macintosh which make it possible to run X and then log in remotely to a Unix system. However if the Mac has a mouse with only one button that can be painful, since many X-based utilities assume that three mouse buttons are available. As things are, if you are sitting at an Xterminal, and you connect to a powerful Unix system, even one used by a lot of other people at the same time, the effect can be as if you are sitting at your own powerful Unix workstation. The idea of a so called (thin client) network computer, often abbreviated as NC, is a generalisation of this: a system that enables you to connect to various other machines running various kinds of operating systems and screen management systems and run the programs remotely, with your screen, keyboard, etc. behaving as if they were directly connected to the remote machine. This is different from what happens when you use an internet browser, like Netscape or Explorer. These can connect to a remote machine, and get files and programs (e.g. Java programs) from the remote machine, but then the file display program or other program usually runs on the machine you are using. There are some exceptions. E.g. if you connect to a remote database machine or "search engine" you can give a request to that machine, and it then produces output which your internet browser will display. But the search process, often interrogating huge databases, will run on the remote machine. Thus, with X you run all programs remotely and merely display results on your screen, and the machine on your desk does not need to have any programs others than those required to manage the screen, mouse, keyboard and possibly audio system. With internet browsers you have some processes running on your local machine and some more complex ones running remotely, though often the remote system does not allow you to create new files and other permanent records which you can treat as your own. This is changing however, since you can now have an account on a remote computer owned and managed by an internet service provider, and your browser can allow you to post electronic mail, receive electronic mail and store the mail messages on the remote machine. Some of them may allow you to develop programs which run on their machines. We can therefore expect to see more and more flexibility regarding where the programs run or on your desktop machine, on a remote machine to which you connect, so that all your machine is doing is pretending to be an interface to the remote machine. Sometimes the remote machine will connect you to an even more remote machine. For instance if you use an Xterminal to log into one of our Unix "compute servers" then whenever you need any files, or create files, the compute server will communicate with another machine which is a "file server", which handles the files of everyone in the School. In the near future people may be increasingly unaware where the programs they use are actually running, and may not care, as long as they do what is required and any information stored is safe and secure, and kept as private as necessary. In this school most of our teaching and research are done on our Unix systems, by users who are either sitting at a Unix workstation, or using an Xterminal to connect to a Unix machine in the computer room, or are using a PC or Mac to connect to the Unix system. Some people also use old and slow Unix workstations simply to connect through to more powerful Unix computers in our computer room. Whichever method you use, you will need to log in to at least one of our Unix systems, although once you have logged in the systems in the School "trust" one another and it is easy to connect to other Unix machines on our network (except that not all users are allowed to log in to all the machines). -- Logging in --------------------------------------------------------- From the above, it should be clear that it is possible to use a Unix machine in several different ways. (a) Sitting at a Unix workstation, to which you log in at the terminal. (b) Using an X terminal, which gives you the option to log in to a Unix computer via an electronic network. The computer might be nearby or far away. (c) If you are already logged in to a Unix machine you can connect to other machines on the same network, using "telnet" or "rlogin" or "xon" or other commands. If you are logging on across the internet, security may be a problem, and you should use the "ssh" command, but that is not discussed further here. (d) If you are using a PC or a Mac you may be able to log in over a network to a Unix machine, using "telnet", though you may then find that the editor function keys do not work exactly as you expect, and there may be other restrictions. I have found the freely available "teraterm" package far better than the telnet tool included with Windows. It is downloadable from here: http://hp.vector.co.jp/authors/VA002416/teraterm.html Use that if you want to log in from a PC to a remote unix or linux system, e.g. if working at home and connecting to our departmental computers. Before using a Unix system you have to log in. In order to do that you must know your "username" and your "password". It is assumed that you will already be familiar with these concepts. The file HELP SHELL has some information about how you can change your password, which you should do from time to time. After logging in, depending on whether you are logging in to a workstation or you are connecting to another machine from a machine on your desk, various things may happen. -- The window manager ------------------------------------------------- In particular if you are not already running a Unix system, the first one you log into will typically start up the X Window system and also a "window manager", i.e. a program which controls the appearance and behaviour of the windows on your screen and some aspects of how the mouse and keyboard operations work. When you connect to another machine you will not need to start a new window manager: processes on the remote machine will communicate with the window manager which is already controlling your screen. In this school we normally set up accounts for new users so that they are running a window manager called "ctwm". This is available on all our Unix systems, so it ensures uniformity across machines. When you have gained experience you can learn how to "tailor" ctwm so as to give yourself new menus and perhaps change what appears on your screen after you have logged in. Several other window managers are available (tvtwm, twm, olwm, olvwm, fvwm, with different strengths and weaknesses) and expert users can change their "startup files" so that they use a different window manager. However, users who do not use the default window manager cannot expect help from computer officers if things go wrong. Things you will have to learn to do which are specific to your window manager include o moving windows around on the screen (we normally set up "ctwm" to move a window if you use the left mouse button on the title bar) o "iconising" a window (turning it into a small window taking up little space) which, in ctwm can be done by clicking with the left button on the dot in the top left corner of the window o making a window come "up" or "down", which in ctwm you can do by clicking on the title bar with middle button (NOTE: if your mouse has only two buttons, press them both at once to get the effect of the middle button.) o changing the size of the window, which in ctwm you do by pressing the left button down on the small square at the right hand end of the window's title bar, then sliding the mouse to the edge of the window which you wish to move, then moving it, all with the button held down. -- Xterm windows and Unix commands ------------------------------------ There are many programs which run on your workstation or the remote Unix system which produce panels or windows that are visible on your screen. Some of them are restricted to specific functions, e.g. running a word processor or email reader, or displaying a clock which shows the time. Others are more general purpose windows which enable you to type commands to the Unix system you have logged into. All of these programs which interact with your screen (and possibly your mouse and keyboard) are called X clients. They communicate with the X window software running on your terminal (your local "X server") which provides services for them, i.e. displays them on the screen or sends them information about where your mouse cursor is at the time you press a mouse button. In particular there is a widely available X client known as "xterm". (this is a piece of software, unlike an Xterminal, which is a device sitting in front of the user, containing hardware and software). The "xterm" program is a very general purpose utility which provides a window on your screen through which you can type commands to the Unix system you have logged into, and in which it can print prompts, instructions or responses to your commands. The xterm program usually also allows you to specify which size of font should be used to display text typed by you or the computer, and also to vary the size of the window in which the text is displayed. Sometimes the xterm can also handle simple graphical displays. As is typical on unix systems, not everyone wants exactly the same kind of interface, so there are alternative "command interface" windows that unix users can run on different systems, but "xterm" is normally available on all of them. In order to enable an xterm window to perform this function it must run a command interpreter program on the Unix system. This is usually called a "shell" because in the good old days before people had graphical terminals and all interaction was text based the "outer-most" piece of software through which anyone communicated with a Unix system was the shell. Nowadays we normally go via window manager to the shell, so the window manager is a sort of shell. However the term "shell" is still normally used to refer to a textual command interpreter. -- Unix shells -------------------------------------------------------- As is typical of unix, there is not only one shell. All unix systems have the most primitive shell known as "sh" (often called the Bourne shell because of its origins) and usually a more friendly shell called "csh", often pronounced "Sea-shell". A slightly more complex version of that, known as "tcsh" is the default for new users in this school. However, we also have other shells, including "bash" (the Bourne again shell) and "ksh" (the Korn shell). There never will be agreement as to which is the best shell, but "tcsh" seems to be a good compromise for beginners, since, for example, it makes retyping a previous command, possibly with corrections, very easy. From now on this document will assume that you are using "tcsh" as your shell. When the shell starts up in an xterm window it will normally give you a "prompt" to indicate that it is ready for you to type a command. It may print other things before the prompt, e.g. indicating that the there is an important system message, or reminding you that your shell startup files (which you can modify later on) have caused some extra commands to become available, etc. Exactly what the prompt looks like will depend on how your "startup files" have been set up by the (human) system managers who created your account on the computer. It is very likely that if you have logged into a machine called (for example) "fred" then the prompt will be set up to look like this: fred % indicating that fred is waiting for you to type something in that window. (Normally to make input go into that window you will have to move your mouse cursor into the window, unless you have turned off the "follow mouse" default..) -- "Your files" ------------------------------------------------------- When you log in to the computer you will have immediate access to a collection of files which belong to you. These files are organised in a "tree-structured" directory, with subdirectories. You can create more files using a word processor or editor. There are several different types of editors used in the school. The most widely used ones for research and teaching include Emacs and VED. We now have a package called StarOffice which can be used to create or edit files which are compatible with PC packages such as Word, Excel, etc. Information about these tools will be provided separately, if necessary. -- The unix file structure -------------------------------------------- The Unix file structure is composed of directories, within which files and sub-directories can be created. (You may be accustomed to using the word "folder" instead of "directory".). All the files are saved on magnetic disks which may be attached to the computer you are using or may be on remote file servers. In this school all user files are saved on a big Sun file server called "casper". The connection between your computer and the file server uses a system called "NFS" (Networked File System) originally developed by Sun, and now widely used to enable computers made by different manufacturers to share files. Before that, linking computers was a truly horrible task (e.g. in the 1970s). -- -- The root directory / Every Unix system has a "root" or "top level" directory which contains all other directories. This directory is referred to as "/", the (forward) slash. Files or sub-directories created in the root directory have names which begin with that slash. For example, here are some typical subdirectories in a unix root directory /bham /bin /cdrom /devices /etc /home /kernel /lib /scratch /tmp /usr /var They can also be named with a slash at the end to show that they are directories, e.g. /bham/ /bin/ etc. -- -- Subdirectories can have subdirectories Each of the above may contain further files and subdirectories, e.g. the /lib/ directory might include things like this, where a slash has been added on the right to indicate a subdirectory: /lib/accept /lib/acct/ /lib/adb/ /lib/agefile /lib/autofs/ /lib/cron/ /lib/diffh /lib/expreserve /lib/exrecover /lib/firmware/ /lib/font/ /lib/inet/ /lib/ld.so /lib/ld.so.1 /lib/lib.b /lib/lib300.a /lib/lib300s.a /lib/lib4014.a /lib/lib450.a User files are normally stored in the /home directory which may have various subdirectories for different groups of users, e.g. /home/admin/ /home/courses/ /home/pg/ /home/staff/ /home/students/ The last of those, at Birmingham might be further subdivided /home/students/elai/ /home/students/misc/ /home/students/msc/ /home/students/ug/ with login directories for individual msc students in the msc directory /home/students/msc/msc111xyz/ /home/students/msc/msc112xyz/ /home/students/msc/msc112yyz/ /home/students/msc/msc113yyz/ etc. and a similar set of login directories for undergraduates in /home/students/ug/ In order to get to any particular directory in the Unix file system, it is necessary to follow a route or path from the "root" directory. This requires making selections at each age to go "down" to a particular subdirectory, e.g. from / to /home/ and from there to /home/students/ and from there to /home/students/ug/ and from there to an individual user's directory /home/students/ug/ug999xyz/ Since the path from the root to the required directory or file can be represented by a string containing slashes and sub-directory names, possibly ending with a file name, the whole thing is referred to as a "path name". -- -- Physical devices do not have special directory names In Unix systems, the path name notation makes no distinction between directories (folders) which are merely portions of a particular disk or tape and directories which correspond to a device like a hard disk or floppy, or CD-rom or tape. So there is no need for special names like A: B: etc for these devices. E.g. if you insert into a cdrom a CD with top level directories cd1 cd2, then those directories might be represented as /cdrom/cd1/ /cdrom/cd2/ -- -- Individual user files and directories An undergraduate user called ug999xyz might have a login directory with this path name /home/students/ug/ug999xyz Typically when this directory is set up some some directories might be provided, e.g. java/ Mail/ (or mail/) Poplib/ and others. The user can simply refer to them by their short names without always specifying the full path name. That is because when you are logged in to a Unix machine there is always a "current" directory, and if you don't give a full path name starting with "/" you will be taken to refer to a file or directory path starting from your current directory. So if the user mentioned above referes to a directory Mail then that will be taken to refer to the directory whose full path name is /home/students/ug/ug999xyz/Mail whereas when another user, e.g. ug999pqr refers to Mail, that will refer to a different Mail directory, namely /home/students/ug/ug999pqr/Mail Since it is possible to change to a different "current" directory, using the "cd" command described below (nothing to do with CD roms) and since different directories can have files with the same local name, you may have to be careful about which directory you are "working in" when you give commands to alter or read files. Further information is given about directories, and the use of "~" to abbreviate a path name for a user's login directory, below, in the section on directories. -- Listing and removing your files ------------------------------------ You may often wish to find out which files you have. You can use the Unix 'ls' command to do this. % ls will print out names of all the files you have in the current 'directory' (see below for directories). The files will be arranged in columns. -- Getting a long directory listing ----------------------------------- (Some examples given below are for VED users. If you are not a VED user, please ignore them. There are certainly similar commands for EMACS users and I am willing to add them if someone tells me what they are!) To get more information use the command: % ls -l The "ls -l" command will give a 'long' listing, indicating the protection, the number of 'links' to the file, the owner of the file, the size (number of characters in the file), the creation date and time, and finally the name of the file. For example, it might look like this, if your login name is 'pqr' and you are in a group called 'ug': drwx------ 17 pqr ug 8192 Nov 6 12:16 Mail -rw-r--r-- 1 pqr ug 285 Oct 12 1994 addup.p drwxr-xr-x 6 pqr ug 6144 Nov 5 18:47 adm -rw-r--r-- 1 pqr ug 729 Oct 7 16:32 init.p -rw-r--r-- 1 pqr ug 2589 Jul 23 1992 initfiles -rw-r--r-- 1 pqr ug 8538 Nov 1 08:10 vedinit.p A B C D E G H I There are letters under each column which would not be printed out. The column labelled A gives information about the properties of the file. If there is a "d" at the beginning then it is a directory. The other letters and hyphens in column A tell you whether the file is readable, writeable, or executable by you, the rest of your group, or the rest of the world. Column B tells you how many links the file has. Normally there should be only 1, though a directory which contains other directories may have several. Column C tells you who owns the file. It should show your login name. Coumn D (which may not be present on some systems) indicates which "user group" the files belong to. Column E tells you the size of the file in characters (including spaces and newlines). Columns G and H tell you the date and time at which the file was created or last modified. Column I tells you the name of the file. Some file names have a suffix which is used by convention to indicate what their function is. E.g. the suffix '.p' is normally used for Pop-11 program files, though sometimes it is used for Pascal programs. The suffice '.c' is normally used for C program files. The suffix '.pl' is often used for Prolog files. NOTE: In VED you can give a Unix command like the one above thus: ENTER unix ls -l This has the benefit that if the command prints out lots of information you can read it easily in a VED window by moving up and down in the normal way. -- Your Mail directory ------------------------------------------------ As shown above in the line drwx------ 17 pqr ug 8192 Nov 6 12:16 Mail you will normally be provided with a directory called Mail which is readable and writeable by you and nobody else. For a directory to be readable it needs the 'x' even though it is not an executable program. -- Deleting files ----------------------------------------------------- How do I get rid of files? You can use the Unix command "rm". The command % rm filename will remove the file called "filename". For some users, the "rm" command is defined so as to be "interactive", namely it asks you for each file to confirm whether you want it removed, and you have to type "y" and press RETURN if you want it removed. If you merely press RETURN it will not be removed. You can bypass the interactive removal by using the command "/bin/rm" instead: % /bin/rm filename However, the file may have been protected against deletion, or it may not belong to you, in which case an error message will be printed out, and the file will not be removed. -- Incomplete filenames ----------------------------------------------- When you give filenames to the shell, you can leave parts out, by putting "wildcards" in the name. There are two main wildcards in the shell, the asterisk (*), and the question mark (?). You can use the question mark to stand for any single character. The asterisk will stand for any number of characters. So if you wanted to get rid of all the files in your area which end with 'tmp', you could do % rm *tmp WARNING % rm * will delete ALL of your files. So will % rm * tmp so will % rm tmp * so be careful about typing asterisks in an 'rm' command. Or to find out which files end with 'tmp', you can try % ls *tmp (This is especially useful to find out what "rm *tmp" would remove.) -- Moving and copying files ------------------------------------------- If you want to move a file from one place to another, use the "mv" command, like this: % mv oldname newname (This is how you change the name of a file -- by MoVing it to a different name.) If you want to create a copy of a file, you can use the "cp" command for example % cp old new will make a copy of the file "old", and call it "new". If you previously had a file called 'new' it will be deleted!! -- Directories -------------------------------------------------------- All your files are stored on a magnetic disk, and when you access them in an editor they are read in from the disk. When you change a file and then leave the editor the new version is written out and saved on the disk so that you can find it later. As explained above in the section entitled The unix file structure the disk is organised into directories. A directory is a region of the disk that has files in it, which may be a set of files belonging to a particular individual, or a set of files associated with a particular program or collection of programs. For example, there will be a directory containing the main poplog system, and it will have different sub-directories for its help files, teach files, library files, files related to Pop-11, files related to Prolog, etc. -- -- The current directory At any time your process will have a "current" directory, and if you give the "ls" command or any other command that accesses a file by its name, e.g. "cp" or "mv", the command will operate on files in your directory. You can make it operate on files in other directories (if you have the access rights) by using the full path name for those files, explained below. When you are given an "account" on the system you will automatically be given a directory, known as your "login" directory, and when you log in that is made your current directory. If you give the unix "pwd" command (i.e. Print Working Directory) it will tell you wish is your current directory, and if you have done nothing to change to a different directory it will tell you your login directory. Try % pwd or ENTER unix pwd For a user called pqr, whose login directory is called "pqr" in a directory called "csai94" which is in a directory called "students", which is in a directory called "home", which is immediately below the top level of the directory hierarchy, this would print something like: /home/students/csai94/pqr This is the full path name of the login directory. Note that many unix programs allow "~" in front of the login name to be an abbreviation for the full path name of the user's login directory. I.e. ~pqr would be an abbreviation for the above directory path name. Users can also have sub-directories within their login directory. If the student has a sub-directory called 'Poplib' and a file called 'vedinit.p' in that directory, the path name of the file would then be /home/students/csai94/pqr/Poplib/vedinit.p or, using "~pqr" for a shorthand ~pqr/Poplib/vedinit.p However, when the user's "current" directory is the one containing the file, i.e. /home/students/csai94/pqr/Poplib/ then the name of the file alone, i.e. 'vedinit.p' is enough to refer to that file, even though lots of other users also have files called 'vedinit.p' in their directories. Summary: You can refer to a file by giving its "full" path name, or, if your current directory is the same as that of the file, simply by giving its name. (There are other options.) -- -- The Unix root directory and its sub-directories At the top of the Unix directory hierarchy there is always a "root" directory whose name is "/", i.e. just the slash. You can look at its contents if you give the command % ls / or % ls -l / It may contain a directory called kernel. You can see the contents of kernel by doing % ls -l /kernel Similarly you can look at the contents of the directory called home in the root directory with % ls -l /home One of those may be a directory called students, in which case you can look at its contents by doing % ls -l /home/students and so on. As the directories and files get deeper into the directory hierarchy the path names get longer and longer. -- A shorthand name for your own directory ---------------------------- If you are using the CSH shell, or one of its derivatives, e.g. TCSH, then you can use a single character '~' as a name for your login directory. Thus, for the mythical student user mentioned above, these two commands will be identical: % ls ~ and % ls /home/students/csai94/pqr and the name ~/Poplib/vedinit.p will be equivalent to the full path name: /home/students/csai94/pqr/Poplib/vedinit.p Note however that there is no point using only "~" to tell ANOTHER user the path name of one of YOUR files. Why? Note that the ~ abbreviation works also in VED and EMACS. It may not work for all programs that accept file names. E.g. StarOffice does not (at present) recognize it. -- A shorthand name for someone else's directory ---------------------- You may sometimes need to look at a file in someone else's directory. If you know that person's login name (not the email name) you can refer to the login directory by attaching "~" to the login name. Thus other users can refer to pqr's login directory using the name ~pqr So to refer to the vedinit.p file, I could use ~pqr/Poplib/vedinit.p You can use the ~/ format to access the files of other people, both in VED or Emacs or when using some (but not all) other Unix commands. Note: this is why you should protect files that are not meant to be read by other users. (Later you can learn how to use "chmod" to protect files from reading by others.) You should NOT protect your top level directory, because then you will not be able to share any files with other people and you will not be able to make your project files accessible by examiners, which is a requirement for some courses. -- Creating a subdirectory -------------------------------------------- If you wish to create a sub-directory called pop in which to put your Pop-11 programs you can use the unix "mkdir" command. % mkdir pop Later if you have files in there, e.g. files called project.p and report, then you can refer to them as pop/project.p pop/report If you wish to move a file called myfile.p into your pop subdirectory you can give the unix command % mv myfile.p pop If you wish to move all your pop11 files there you can do % mv *.p pop (Don't leave a space after the asterisk, or all your files will be moved.) -- Changing the "current" directory ----------------------------------- If you wish to make your new pop directory your current directory you can do % cd pop after that the command % pwd will show a new current working directory, i.e. something like /home/students/csai94/pqr/pop Having done that you can then refer to files in the pop subdirectory without using the prefix: "pop/". Similarly the "ls" and "ls -l" commands will refer only to the files in that directory, instead of the files in your login directory. -- -- Use of ".." When you are in any directory except the "root" directory you can use the special file name ".." to refer to the directory immediately above your current directory. Thus if you have moved to your pop subdirectory, and you wish to refer to a file called fred in your superdirectory, you can refer to it as ../fred This will also work in VED, e.g. ENTER ved ../fred Similarly if you are in a subdirectory called work/ and you wish to refer to the Mail subdirectory of your super directory you can refer to it as ../Mail, e.g. this will print out the files in your Mail subdirectory, if you are in another subdirectory of your top level directory: % ls ../Mail If you wish to refer to a file in that directory, e.g. the file mail31 you can use the path name ../Mail/mail31 You can use ".." repeatedly to refer to more than one directory level above your current level. E.g. % ls -l ../.. will list the files in the super directory of the super directory of the current directory. -- --Getting back to your login directory When you have gone to a subdirectory, the directory immediately above it in the hierarchy is always referred to by the name "..". (The name "." always refers to the current directory). So you can list the files in the directory above your current directory by doing % ls -l .. Similarly you can change to the directory above by doing % cd .. Thus the commands % cd pop % cd .. have the net effect of leaving you where you were originally. Because your login directory is called "~" you can always change to that by the command % cd ~ In fact things are usually set up so that the "cd" command on its own will take you to your login directory. I.e. the following is equivalent to the above command. % cd -- Man files ---------------------------------------------------------- To find out full details regarding Unix facilities, you will have to read UNIX online manuals, or "man" files. However many of them are very terse and hard for beginners to understand. To see an example of a simple man file, give this unix command to the shell prompt: % man who You will be shown a page at a time. Use the space bar to read the next page, press the "b" key to go back a page (which may not work on all systems), and press "q" to stop. -- Online "unixhelp" tutor -------------------------------------------- There is a useful online Unix tutor, developed at Edinburgh University, which can be used with a World Wide Web browser, e.g. netscape, or lynx. On the School of Computer Science network, you can access it by using the file name as the URL, to start up the browser, e.g. lynx /bham/doc/unixhelp.html The simplest and fastest browser is lynx, which displays no pictures, and does not use the mouse, and can be used over a dial-up line as it does not require the X window system. If you start lynx, you use the space bar to read the next screenful of the current file, the "b" character to go back a screenful. Use the UP and DOWN arrows to move to the next or previous link. Use the RIGHT arrow to follow a link and the LEFT arrow to return to the previous file. Use "q" to quit. Warning: do not believe everything you read in the tutor. There are some mistakes, which I assume (hope) will be corrected eventually. TO BE CONTINUED -- Further information ------------------------------------------------ For VED users HELP SHELL HELP UNIX.COMMANDS HELP CTWM HELP RUN.BACKGROUND TEACH PRINTING HELP CD - changing directory in POP-11 or VED HELP LS - listing files TEACH LATEX TEACH LATEX.TEX For further information accessible via a web browser see: http://www.cs.bham.ac.uk/studentinfo/computing-handbook/ --- $poplocal/local/teach/Unix.intro --- Copyright University of Birmingham 2001. All rights reserved. ------