UNIX is a very powerful and popular operating system that is used by a significant proportion of the computer industry. Yet many perceptions of the computer centre around PCs, and the operating systems commonly run on them. Upon encountering UNIX, whether it be on a personal computer or a mainframe, confusion and frustration often results, causing UNIX to be branded as archaic and unfriendly. But this is only due to UNIX being a vastly more complex system, as it copes with multiple platforms, processors, disks, and brings truly platform independent computing to many users simultaneously. With a bit of patience and a bit of study, this monstrous beast can be tamed, and your experience with UNIX, for whatever purpose, can be an enjoyable and profitable one. And that's where this guide comes in. It aims to get you over that initial hurdle, and on your way to greater things. But of course this is only a beginning. There are countless books which provide more extensive and advanced material, and you are advised to read one or more of these after this guide, should you wish to pursue your mastery of UNIX further. Just about any appropriately titled book will help you, but there are two which can be particularly recommended:
Graham Glass, UNIX® for Programmers and Users, A
Complete Guide, Prentice-Hall, Inc., 1993.
Daniel Gilly, UNIX in a Nutshell, a Desktop Quick
Reference, O'Reilly & Associates, Inc., 1992.
Different styles are used to make certain parts of the text stand out. These adhere to the following conventions.
Matt Chapman has recently graduated from the University of Warwick, UK, with a Bachelor's degree in Computer Science. He is now working as a software developer for IBM based in the IBM Centre for Java Technology in Hursley, UK. His other projects include a Window Managers for X page, a Finite State Machine Explorer in Java, and a variety of small games and utilities for X/UNIX platforms.
Frankie Blaskovic is a third year Law student at the University of Warwick. He is responsible for the University of Warwick Students' Union WebPages as well as for the Warwick Boar. He is currently working on numerous projects, the most important of which is the managment of the New Technologies Programming Team in the UK. He is also active on many commercial web sites, keep a lookout!
Commands covered in this section: login logout su logname passwd
Commands covered in this section: ls cd pwd cat more
UNIX employs a directory hierarchy, as illustrated in the picture below. The top of the hierarchy is known as the root directory and is specified as /. In the example shown the root directory contains three directories, which are sub-directories of the root. The home directory is the parent of the two sub-directories foo and bar.
An absolute filename is the full path of a file or directory, from the root of the hierarchy, given using the / symbol (called a slash - specifically a forward slash) as the directory separator. So the absolute filename of the bar directory is /home/bar. A relative filename is one without an initial / which refers to a directory in relation to the current directory.
The most frequently used command in UNIX is ls. It has many options, but on its own it simply shows the contents of the current directory, which may be directories or files. Try it now: simply type ls at your command prompt. If you specify an argument to ls it will take this to be a directory and will attempt to list the contents of that directory. Try entering ls / which will list the files and directories in the root directory. There will be some of the ones shown in the diagram, and many others.
The command pwd tells you which directory you are in. If you haven't changed directory since logging in, you should get something like /home/fido, with your usercode in place of fido. This directory is your home directory, and is the part of the filesystem reserved for you. In here you can create the files and directories required for whatever tasks you are engaged in.
You are always in a particular directory, referred to simply as the current directory. To change the current directory, the command cd is used. It can take as an argument a directory, and will then move to this directory. So cd / will move you to the root directory - try using pwd and ls to verify this. Typing cd on its own will return you straight to your home directory, from wherever you are.
There are two important conventions employed when referring to UNIX directories. The first is a single dot: ".". This means "the current directory". The second is two dots: "..", which means "the previous directory up in the hierarchy", or "the parent directory of the current one". Use cd and pwd to experiment with these. Start in your home directory, and work up the hierarchy by using cd .. repeatedly. What happens if you attempt to go above the root directory? Try and it see. You won't get an error message, you just won't go anywhere.
The -l option to ls will give you a long listing of the contents of the directory. It includes such things as the size of files, the date and time they are last modified, and whether the item is a file or a directory - the first character of the output shows this: d for a directory and - for a regular file.
Experiment with the ls and cd commands until you find a regular file that is not too large. The contents of this file can then be examined in two ways. Firstly, the cat command will simply output the entire file to the screen. It is called simply by typing cat followed by the name of the file you wish to view. If the contents are more than a screenful, they go off the top of your window, so you miss some. If this is the case, the second command is best used. This is known as more, and is called in the same way as cat, but pauses after each screenful has been displayed. Simply press the spacebar to move on to the next page. Alternatively, you can press q to quit the command, and stop the rest of the file being displayed.
Commands covered in this section: touch mkdir mv cp rm rmdir
The previous section showed you how to move around the filesystem and examine text files. We will now show you how you can change things - the names of files, their location, and how to remove them. You can NOT do any damage to the system through use of the commands covered here, but you could lose your own files by accident if you are not careful. So if you have anything important, keep a copy of it - either somewhere else in your home directory, or (even better) on a secondary storage device, such as a floppy disk. Remember: there is NO undelete command under UNIX, although the system administrator should make regular backups, so it may be possible to retrieve lost files from these.
You may already have some files in your home directory to play around with, but don't worry if you haven't. The easiest way to create some is with the touch command. Make sure you are in your home directory (type cd to get there, and then pwd to check). Now type touch rents which will create an empty file called rents in the current directory. Use ls to verify its existence, then use the -l option to see that its size is 0 bytes. Look at the time and date column as well - this shows when the file was last modified, or in this case created. The touch command has another use, when given a filename; it changes the modification time to the current time. Do touch rents again, then ls -l or ls -l rents to see the new modification time.
There are obviously many ways to create files, such as with text editors. These will be covered in a later section.
Directories are very useful for collecting related files together. The typical UNIX system contains many thousands of files. Imagine the mess if every one was contained in the same directory. You can too can use directories to organize your files. The mkdir command is used to create new directories. Create one now, with mkdir leith and use ls to see it.
This is all achieved with the mv (short for move) command, which operates differently, depending on the arguments given to it. Many of these operations are illustrated in the examples below, which can be carried out in order using the files and directories created earlier. As before, use ls to examine the effects of each command.
Rename a file:
mv rents forry
Rename a directory:
mv leith hibs
Move a file into a directory:
mv forry hibs
Move it back into the current directory:
mv hibs/forry .
The copy command is cp. Notice how most of the command UNIX commands are only two letters, to save some typing. Later you'll see that there are many other ways in which the amount of typing you have to do can be reduced.
The copy command has two modes of operation; it can make a copy of a file under a new name, and it can make copies of a list of files and place the copies in a given directory. To illustrate this, we'll need to create some more files, using touch again.
Type this:
touch tommy franco
matty
This creates three new files, all in one go. You don't need to use three separate touch commands. This sort of thing can be done with most UNIX commands, and is another example of making things quicker to do.
Now we can make a copy of one of the files:
cp franco begbie
Let's make a copy of two of the files and place them in the
hibs
directory:
cp tommy matty hibs
Use ls to verify that the files you have created are arranged like this:
The remove, or delete, command is rm. Related to this is the rmdir command for deleting directories, but only if they are empty.
We'll finish this session by removing all the files we created. It is important to know how to clean up your directories by removing unwanted files, otherwise they will become cluttered and you won't be able to find things easily. Also, your home directory may be limited in the number and total size of files it can hold.
Remove two files:
rm forry tommy
Attempt to remove the hibs
directory:
rmdir hibs
You'll get a Directory not empty error. You could delete all the files in it with rm, and then use rmdir, or you can use the -r option to rm, which recursively deletes all files and sub-directories in the given directory, and then the directory itself. Be careful with this command.
Delete the hibs directory and
its contents:
rm -r hibs
Finally, remove the remaining files:
rm matty begbie
Commands covered in this section: emacs xemacs jove vi lpr lpq lprm
Emacs is a powerful, extensible text editor. The name stands for Editor Macros, although some pretend it stands for Emacs Makes A Computer Slow (it is so large it can be slow compared with more simple editors), or for Escape, Meta, Alt, Control, Shift (in reference to the complex key sequences often required). Full versions of emacs come with packages written in Emacs-Lisp, which provide all manner of additional features, such as e-mail and news modes, and even a web browser mode. Also, different modes are usually supplied to aid the editing of different types of files, such as plain text, programming language source code, and TeX files. They can highlight different parts of the file in different colours or fonts, which can make the file easier to work with.
Due to its immense popularity in the UNIX world, emacs has spawned numerous flavours and clones. Three of the main ones are:
All versions should come with extensive documentation and tutorials, which are obviously worthy of careful study if you intend using the program. However, a few basics will be covered here, to start you off. They should apply to all versions of emacs.
To start up the editor, simply type its name. If you type a filename after it, it will attempt to load this file, and it if doesn't exist it may create it. You can then enter some text straight into the editor window.
Commands are given to the editor through key combinations,
although in some cases a mouse can be used to select
operations from a menu bar. In describing key combinations,
the following abbreviations will be used: C- means hold the
Control key
down and press the following key, so C-g means press and
hold the Control key and
press g while
Control is
still held down. Similarly the abbreviation M- is used to
indicate the Meta key, which
is often next to or close to the space-bar and may be labelled as
a diamond. Users of Jove (and some
other versions) should use
the Escape key
instead, labelled "Esc", and this should pressed and released,
before pressing the next key.
| Movement | Key Combination |
| Forward one word | M-f |
| Back one word | M-b |
| Up one screen | M-v |
| Down one screen | C-v |
| To start of line | C-a |
| To end of line | C-e |
| To start of sentence | M-a |
| To end of sentence | M-e |
| To start of file | M-< |
| To end of file | M-> |
There are numerous ways of moving the cursor around a text file, aside from the cursor keys which move one character at a time. The more common ways are shown in the table. If there are no cursor keys on your keyboard the following key combinations can be used instead. The letters used stand for Previous, Next, Forward and Back.
| C-p | ||
| C-b | ![]() | C-f |
| C-n |
| Action | Key Combination |
| Delete character after cursor | C-d |
| Delete word before cursor | M-delete |
| Delete word after cursor | M-d |
| Delete to end of line | C-k |
| Delete to end of sentence | M-k |
| Insert previous kill (Yank) | C-y |
| Undo | C-X u |
In addition to the standard Delete or Backspace key, which deletes the character before the cursor, there are numerous commands for deleting and moving text, as shown in the table.
The Yank
command is very useful when used in conjunction with the Delete to end of
line operation. Multiple lines can be
deleted, and then pasted back in a different place, using
the Yank
command. This provides an easy way of moving text around. If
you are running a graphical version of emacs you can also
use the mouse to select and paste text.
| Action | Key Combination |
| Search forward | C-s |
| Search backward | C-r |
| Cancel operation | C-g |
| Save current file | C-x C-s |
| Edit a file | C-x C-f |
| Quit | C-x C-c |
The current text can be searched by pressing the appropriate key combination and then entering the string to search for. In some versions of emacs the search is performed interactively; the cursor jumps to the next position which currently matches the entered text. You can search for the next match by pressing the key combination again. The search can be cancelled by pressing C-g, which can also be used to cancel many other operations.
If the Edit
file command is given you will be
prompted for a the name of a file, which will then be loaded
into the editor. But any file you were previously editing will
remain in memory. You can open as many files as you like,
and each is placed in its own buffer, and there are
various ways of changing buffers, depending on your version of
emacs.
| Action | Key |
| Insert text in front of cursor | i |
| Insert text after cursor | a |
| Insert text after current line | o |
| Insert text before current line | O |
| Overwrite text | R |
The main feature which distinguishes vi from most editors is its separate modes: text entry mode and command mode. The editor can be started by typing vi, with a optional filename. On startup it enters command mode. To change to text entry mode one of the keys listed in the table is pressed, depending of the nature of the entry mode required.
You can now enter text, but you cannot use any of the cursor
keys to move around or perform any other operations. To do so,
you must leave the mode and enter command mode, by
pressing the Escape key. You
can then perform the operations described in the following
sections.
| Movement | Key Combination |
| To start of line | ^ |
| To end of line | $ |
| Forward one word | w |
| Back one word | b |
| Up one screen | C-b |
| Up half a screen | C-u |
| Down one screen | C-f |
| Down half a screen | C-d |
| To line n | :n |
The keys shown in the diagram below can be used to move the cursor around. In addition, cursor keys can be used, if they are present on your keyboard.
| k | ||
| h | ![]() | l |
| j |
The last command listed, to jump to a given line number,
shows use of the extended command entry facility. The Enter key should be
pressed after the command is entered.
| Action | Key Combination |
| Delete character | x |
| Delete word | dw |
| Delete entire line | dd |
| Delete to end of line | D |
| Delete block | :<range>d |
| Replace characer | r |
| Replace word | cw (then Esc) |
| Replace line | cc (then Esc) |
| Yank lines into buffer | :<range>y |
| Paste buffer after current line | :pu |
| Paste buffer after line n | :npu |
Vi provides numerous commands for manipulating text, many of which are shown in the table.
To replace a word or line, press the keys listed, then enter the replacement word or line, pressing Escape to finish.
Two of the commands listed contain a <range>
parameter which specifies the lines the command is to be
applied to. This can be a single line number, or a start and
end line number, separated by a comma. There are two special
characters that can be used: $ for the last
line, and .
for the line containing the cursor.
| Action | Key Combination |
| Search forward | / |
| Search backward | ? |
| Repeat last search | n |
| Replace first occurrence of str on each line with rep | :<range>s/str/rep/ |
| Replace every occurrence of str on each line with rep | :<range>s/str/rep/g |
| Save current file | :w |
| Save as <name> | :w <name> |
| Edit <name> instead of current file | :e <name> |
| Quit if saved | :q |
| Quit without save | :q! |
To search for a string in the current buffer, press the key shown in the table, type in the search string, and then press Enter.
The replace commands operate on the entire buffer, unless a range parameter is given.
You must save the buffer before quitting, unless you use the
quit without
save option.
Most networked systems have at least one printer attached to the network, which can be used to obtain a hard copy of your work. For most purposes fast dot matrix printers are adequate, although laser printers can be used for higher quality output.
To send a file to a printer type lpr followed by the name of the file to be printed. This will send the file to the default printer, whatever that may be set to. If you wish to use a different printer, you need to know the name of the printer, as it is known to the system, and then you can use the -P option to lpr. For example a laser printer may be known as ps (for Post-Script), in which case lpr -Pps text will send the file to it.
Files sent to a printer are held in a queue until the printer is free to print them. On a busy system this could take some time, especially if the printer runs out of paper or breaks down. You can monitor the print queue, and the progress of your file in it, using the lpq command. It will list the job number, name, size, and owner of all the items on the queue.
Files can be removed from the print queue before they are printed by using the lprm command. Provide this command with the job number or numbers you wish to cancel, obtained using lpq, or use lprm - to cancel all of the items on the queue belonging to you. Make sure you use this command if you make a mistake or change your mind; don't waste resources, and remember you are responsible for files you print, which you may have to pay for. Find out first!
Commands covered in this section: date wc who ps du quota
Another way to find out how much space you have left is to use quota. This command will tell you how much of your quota
you are using and what your limit is.
A fundamental concept in the UNIX world is that of shells. A shell is a program that forms an interface between you and the raw operating system. Whenever you enter commands into a UNIX system, you talk to a shell, which takes your input, processes it in various ways, makes the required operating system calls and displays any results. Having this separation allows many useful features to be introduced without changing the underlying operating system. All shells provide certain functionality, much of which will be described in this section, but some shells offer advanced compabilities which will discussed in a later section dedicated to that shell.
The main shells are:
The first two shells listed above are fairly basic, and some versions do not provide some of the facilities dicussed here, such as tab-completion. Therefore it is recommended you use one of the other four, if possible. You can find out which shell you are using by typing echo $SHELL. You can use a different shell by typing its name, or you can change shells completely using the chsh command, if this available on your system (run the command and you'll be prompted for the full pathname of the shell you wish to use - use which followed by the name of the shell to tell you this).
Filenames can be long - up to 256 characters. They are also case sensitive, so for example, file, FiLe, and FILE are all different files. You can used mixed case and other characters like "_" and "." to give your files meaningful names. Don't be put off from using long filenames because you don't want to have to keep typing them in - there is no excuse with tab-completion!
To experiment with this feature, create some files by typing touch psychohistorians foundationsEdge foundationAndEmpire. Don't worry, you'll only have to type that lot in once.
Now let's say you want to rename the first file to seldon. To do this you would use the command mv psychohistorians seldon. But wait! Type mv psy (without pressing Return) and then press the TAB key. Providing your shell supports it, the rest of the filename will be completed for you, as if by magic! What is happening here is your shell is looking for all files that match the prefix you have entered. Assuming there is only one matching file, it will fill in the rest of the name for you. You can then enter the rest of the command.
Next you want to delete the second file. Type rm fou and press TAB. The shell will fill in as such of the name as it can - foundation in this case (assuming there are no other similar files in the directory.) It will then beep to let you know there is more than one completion. Now type s and press TAB again. This prefix should now be unique, so the full filename will be filled in. When there is more than one completion, some shells can display the available choices (for example, press TAB again with the bash shell).
This time, typing mv fou and pressing TAB should cause the full filename of the third file to be filled in, as the other has been removed.
This facility, also known as globbing, allows you to select files using wildcards. This form of pattern matching can be used to refer to a collection of files in one go, again saving considerable time and effort.
To experiment with this feature, repeat the touch command from above, either by entering it again, or by pressing the cursor up key repeatedly to select it from your command history, if your shell supports this. Also do touch found.c mule.p.
Patterns are specified using wildcard metacharacters, which are simply characters which are treated specially by the shell. If you wish to use one of these characters as itself, and not its special meaning, precede it by a backslash (\) character; for example, touch the\*star would create a file called the*star. The meaning of the wildcards is given in the table and their use is demonstrated by the following examples.
| Wildcard | Meaning |
| * | Matches any string |
| ? | Matches any single character |
| [ ] |
Matches any of the characters between the brackets. A dash is used to indicate a range of characters |
List all files beginning with fou:
ls fou*
List all files ending with .c:
ls *.c
List all files ending with a dot and a single character:
ls *.?
List all files beginning with f or m:
ls [fm]*
List all files beginning with a letter in the range a..m:
ls [a-m]*
The shell expands the pattern into a sorted list of filenames
and passes this to the command involved, exactly as if you had
entered each of the names separately. Now use filename
substitution and/or tab-completion to remove all the files
created here.
Pipes allow you to send the output of one command to the input of another, using the pipe metacharacter "|". For example ls | wc -l will count the files in the current directory, and ls -l | more will give a detailed file list, pausing between each page if the list is too long to fit on the screen at once.
You can join any number of commands together in this way, to form a pipeline. These are fundamental to UNIX, and can solve complex problems using only the basic building blocks of UNIX commands. For example ls -l | cut -c33-42 | sort -nr | head -1 finds the size of the largest file in the current directory. It works by listing the files, extracting the size column, sorting this in descending numerical order, and taking only the first line.
Redirection allows commands to get their input from a file instead of the keyboard, and send their output to a file instead of the screen. The two metacharacters "<" and ">" are used to do this. For example, ls > contents will store the directory listing in a file called contents and will not display anything to the screen. Verify this by running the command and then using cat or more. Note that the contents file is created in the process, but if it already exists it will be overwritten, so be careful. Input redirection is similar; wc -l < contents will cause the wc command to read from the file.
There are two additional forms of redirection: ls >> contents will send the output to the named file, but it will append this output to the current contents of the file, if any. The input version of this operation creates what are known as here documents. Enter cat <<END. Your prompt will probably change, to indicate that the command is waiting for some input. Type a few lines of text, and then type END exactly, on a line of its own. The command should then complete by repeating what you entered. The <<HERE part of the command tells your shell to accept what is typed as input to the command, until the word END is read on a line of its own - any word can be used instead. The command then behaves as if what you entered was stored in a file and redirected into the command. This facility has numerous uses, such as quickly creating a small file; cat <<HERE >textfile will cause what you type to be stored in the named file.
The pipe and redirection characters discussed above manipulate streams of characters. There are three standard streams: input, output, and error. Normal communication to and from commands takes place via the input and output streams, but there is a third channel for reserved for errors. For example, wc -l contents > out will count the lines in the file, assuming it exists, and store the results in a file called out. However, if you remove the contents file and try again, you will get an error message: wc: contents: No such file or directory, and the out file will be empty. The error message is not send to the file as it is using a separate stream, namely the error stream.
It is, however, possible to redirect the error stream in a similar way to the standard output stream. Typing wc -l contents 2> out will send any errors to the file, with any standard output going to the screen. Multiple redirection is possible as in wc -l contents >out 2>errors, which sends the two output streams to different files. Note that spaces after the redirection characters are optional.
Commands covered in this section: ps wait sleep fg bg nohup kill
PID TTY TIME COMMAND 067 console 00:05 sh 063 tty02 10:20 /bin/local/usr/zsh 062 tty02 10:22 ps 060 tty00 12:05 /net/pppd
This tells you what the Process Id of the given process is, where it is
being run, at what time it started, and what command is being
executed.
To get more details use ps -f, this will give you the userid which
started the process, the parent process which spun the child process,
and a few more ... There is also the ps -l option which is an extended
version of the output ps provides, all the extra information given with
the -l option is really of use just for system admins, you can have a go
at it but it won't be of much use.
Further useful options ps offers are also available threw the command line options of ps. Use ps -e to get details about every process running, ps - u userlist gives details about all the processes run by the given user. Use ps -t ttynn gives details about all processes run on the given device, you can replace ttynn by any valid device listed in the /dev directory.
To run a process after another process use wait PID where PID is the process Id to wait for. After that process is executed the specified process will run. If you do not give a PID your process will wait for all other background processes to finish executing first.
Commands covered in this section: ftp trn mail elm pine lynx netscape
ftp is a command interpreter which has as primary function to transfer files from one computer to another.
The most useful function of ftp is what is know as anonymous ftp, which
allow files to be exchanged between a number of users and the rest of the
world, over a public connection. Most FTP servers will provide a
directory named /pub under which are located all the publicly available
files for that site.
The fundamental steps for retrieving a file using an ftp connection are
as follows:
====== 17 unread articles in warwick.help -- read now? [ynq]
====== 07 unread articles in alt.binaries -- read now? [ynq]
At this point you can either type y to read this newsgroup (in which
case messages are displayed sequentially.), n to skip the group and move
onto the next with unread messages or q to exit trn completely.
Other options available are: by typing + to enter newsgroup threw the
selector, = to list headers before displaying articles.
To find a given newsgroup use /pattern where the pattern is the
newsgroup string you seek (this will search forward threw the newsgroup
listing, and find the group matching your string). To search backwards
use ?pattern. Typing l string will search for a newsgroup containing
the string you specified, threw the groups you haven't subscribed to (ie:
including those that are not listed in your .newsrc file).
Use the u command to unsuscribe from a newsgroup, and c to mark a thread
as read.
Both the /pattern and other search features used to search for a given
newsgroup are available here to find threads/articles.
You can get help on any command, at any stage by simply typing h, and
you can escape to a subshell using The ! command.
Typing a q will get you out of the current level, and bring you to the
previous, so if you were reading an article and typed q you would return
to the thread selector, and a q there would take you back to the
newsgroup selector.
| - | Print previous message |
| + or n or Space | Print next message |
| ! | Escape to shell |
| d | Delete current message and move to next |
| u | Undelete previously deleted message |
| h | Display message header |
| r user | Reply to user |
| s filename | Save message to file (default mbox) |
| x | Put all messages back in mailfile without changes and exit |
| ? | Print command summery (help) |
|---|
Other useful command line option to elm are as follows, elm -h or elm -? will give you a listing of all options as well as their use, elm -f filename will read mail from the file specified instead of INBOX, elm -i filename will cause the file specified to be included in the editor as part of the outgoing message, and elm -z will check if there is new mail, if not elm won't start.
To start pine just type pine. If you want to start
pine directly in the
editor, use pine eaddress where eaddress is the internet
address of the recipient (pine does not deal with UUCP mail properly, if
you want to use UUCP use elm). If you use
pine -f folder, this
will cause pine to read your mail from the specified folder instead of
the default mailbox, pine -i will start pine in the FOLDER INDEX so that
you can start selecting mail to read immediately, pine -h displays all
commands available as well as their usage, pine -F file will
display file in pine's editor, pine -sort sort string will cause
pine to sort messages in the order specified (valid orders are, arrival,
subject, from, date, size, orderdsubj or reverse, add /reverse if you
want to sort in reversed order).
There are many specialised functions in pine as well as in the other
mailreaders, to find those out read the online help files provided with
each mailer.
To go to a specific URL use g, this will bring up a prompt asking you
for the url, type it in and press CR. Lynx will then open the documents
for you.
Use m to go back to the starting document, i to view an index of
documents and o to go to the options menu from where many other more
details functions of lynx can be used.
Netscape will not run under the command line in UNIX you will need to
use the X Windows System to be able to run Netscape.
Once under X simply type netscape or on some systems you can use a
specific version of netcsape by adding it to the name of the executable
as netscape-2.0 (this will start version 2).
Netscape supports all the latest tricks of the HTML trade, such as
sound, video, executable content and scripting. Because of its graphical
nature navigation is very simple. Use the scroll bars to scroll threw a
document, the reload button to reload a page, and type the URL in the
box provided, or simply use the Open Location (from the file menu) to open a URL. You can use
Open File to open a local file.
One thing to note when using Netscape, is that because most web pages are highly graphical in content, netscape will eventually use all the colours available on your system, and starting any other application which requires colours will result in either distorted colours or the application not starting. To prevent this type the following when invoking netscape netscape -install. This will prevent netscape taking all the colours and you may use other applications which requires colour (such as a paint program).
Netscape also allows you to read your Mail and News from within its
environment, to use these options you should select the mail and new preferences option from
the options menu, to set your email (found under the Identity tab) and the specific servers to use
(These might be set-up for you already but you will still have to enter
your email address).
To learn how to use Netscape in depth just use the options provided in
the Help menu, which will take you to on line documentation and
tutorials.
Commands covered in this section: rlogin telnet sz rz ping finger who rwho talk write mesg
Type telnet hostname to connect directly to the machine specified by hostname, if you want to
connect to a specific port type telnet hosname port (note, space required). The hostname
can be either a full name such as crocus.csv.warwick.ac.uk or it can be a simple IP address as 128.83.165.133
If you just type telnet without supplying a hostname you will get the telnet prompt
which looks as this: telnet>
at this prompt you can use any of the telnet commands
described bellow.
Note: To use any of these command s you will need to be at the telnet prompt, if you are in a telnet session
to escape use Ctl & ] to get to the prompt (you connection to the remote computer will not be lost).
| Command | Short Format | Parameters | Action |
|---|---|---|---|
| open | o | hostname (port) | Opens a new telnet connection to remote computer |
| close | c | none | Closes your current connection to remote computer and returns you to the telnet prompt |
| quit | q | none | As close but exits from the telnet utility completely. |
| status | st | none | Displays telnet status |
[localhost]
Login name: lauvj
In real life: Mr F Blaskovic
Directory: /home/crocus8/la/uvj
Shell: /usr/local/bin/zsh
Mr F Blaskovic (lauvj) is not presently logged in.
Last seen at crocus on Sun Aug 18 12:39:05 1996 from somewhere.com
Mail forwarded to someplace.on.the.net
This is the long version of the output given by finger. (which is
usually the default on localhosts). If it isn't the default use finger -
l userid, or if it is the default and you want the short format use
finger -s userid.
If you have a file called .plan or .project, those will be displayed.
Note in the above example there is a reference to main being forwarded
followed by the address to where the mail is forwarded. This will be
displayed if the user has a .forward file in their home directory.
If you don't want to wait for finger to display the .plan, .project or
.forward files use finger -p userid.
Use finger -options userid@hostname to find a user at hostname, or any
user that matches the string userid. If you are on a network with
several hosts instead of using finger userid, use
finger -options
userid@ this will search all your LAN hosts machines. Use finger
-options @hostname to get a listing of all users on hostname
| root | -tty03 | Aug 20 03:42 |
| frankie | +tty01 | Aug 20 10:22 |
| matt | +tty20 | Aug 20 19:03 |
| ops | -tty00 | Aug 20 00:00 |
Message from Talk_Daemon@darkstar at 16:00 ...
talk: connection requested by user@darkstar.
talk: respond with: talk user@darkstar
You will quickly notice that your screen becomes a mess, to clear it use Ctl & L. To quit from the talk
connection use Ctl & C. This
will terminate the talk session and return you to your shell.
Message from yourid yourtty
The message you typed in.
Commands covered in this section: gzip compress tar gunzip uncompress gzcat
However much space you've got, it's still limited, and one day you're going to wish you had more. You should regularly clean up your filespace by removing unwanted files, but there are usually some things you don't use frequently, but still want to keep, such as completed assignments or old e-mail messages. These are perfect candidates for compression, a way of reducing the size of files using complex algorithms that take advantage of patterns in the file. This means that some files compress better than others, for example plain text is excellent, due the limited character range and repeated groups of letters found in natural language. Text files can typically be reduced to a third of their original size. Image files, however, often hardly compress at all, as their format (such as gif or jpeg) already uses compression. There is little point trying to compress an already compressed file, as any uneven distributions of characters and repeated sections have already be detected and replaced by a more compact encoding.
You can either compress files individually or collect groups of files or directories together and compress them into a single file. Each file actually takes up a certain minimum amount of space in the filesystem, regardless of its given size in bytes. This is known is the block size, and could be 1K, 4K, or more. Any file smaller than this will still take up this amount of space. Therefore compressing small files is pointless, but if they are grouped together and compressed into a single file, they will take up much less space, because the large file will use the blocks more effectively, in addition to being compressed.
There are many programs for compressing files, and one of the most popular is gzip. To use it simply give the name of the file, or files, to compress, for example gzip largefile. This will create a compressed file called largefile.gz, deleting the original file. Another popular choice is the old compress utility, which creates files with a .Z extension, although it rarely compresses files as well as gzip.
This is a two stage process; the files are grouped into one large file, which is then compressed as discussed above. The grouping can be performed using the tar program (for Tape ARchive, although a tape device doesn't have to be used). You need to specify -cf as a option to tar, to Create a File archive (not a tape one). This is followed by the name of the archive you wish to create, usually with a .tar extension. Finally you list the files and directories to be included in the archive. If a directory is given it will be added to the archive, along with its entire contents, including sub-directories. It is often best to put all the files you wish to group together into a directory and then you need only specify this directory. Also, when you extract the contents of the archive, the directory will be created (if it doesn't exist), so all the extracted files will be contained on their own in a single directory.
For example, you have a directory called project which contains everything you wish to compress. You could then do tar -cf project.tar project. It is a good idea to use the directory name as the archive name, after adding .tar, so you can tell the contents of the archive from its name. This archive will be similar in size to the sum of the individual file sizes, as no compression has been performed yet. Therefore the last step is to do gzip project.tar, which will replace the file with project.tar.gz, which may be considerably smaller than all the individual files. You can perform the whole operation using a pipe, by doing tar -cf - project | gzip > project.tar.gz. Specifying a dash as the archive name causes tar to send the archive to standard output, which is then piped to gzip which reads it as input, redirecting the compressed output to the required filename.
Note that you can also use this technique to create backups of important files and directories. It conveniently groups files together, and compresses them to save space. Also note that sometimes the extension .tgz is used as a short form of .tar.gz.
Of course, there's little point compressing files if you don't know to uncompress them, but this is a simple matter. To uncompress largefile.gz simply do gunzip largefile.gz. This will replace the compressed file with the uncompressed file largefile. Using gunzip is equivalent to gzip -d. As with many UNIX commands you can specify a group of files using wildcards, so gunzip *.gz will uncompress all the files in the current directory that have been compressed using gzip. If you used the compress command, the process is reversed with the aptly named uncompress command.
To extract the contents of a tar archive, after uncompressing it if necessary, use tar with options -xf, for eXtract from a File archive. So, for example, tar -xf project.tar would create a directory called project, if it doesn't already exist, and extract all the files and sub-directories into it. Again, a pipe can be used to combine the two operations of uncompressing and extracting by doing gunzip -c project.tar.gz | tar -xf -. The -c option (where available gzcat and be used in place of gunzip -c) writes the uncompressed contents to standard output, leaving the original file unchanged, and the dash on its own is used in this case to specify standard input as the source of the tar achive. Keeping the original file unchanged is often useful as less space is required for the operation and if you want to keep the file you'd have to compress it again, if you had performed the operations separately.
Commands covered in this section: man
Another useful feature of man is that if you use man -w name, man will display the location of the manual pages for the command specified by name, this information can then be used as the need may be.
PAGER = the name of the pager to use for viewing of man pages
MANPATH = A list of path names, separated by colons, indicating the directories to
search for man pages.
MANSEC = A list of manual sections to display (also colon separated).
Changing the values of any of these will effect how your man pages are found, displayed and which section of the man
pages are displayed!