Each time you use UNIX you must log on to the system by typing username and a password. Your login name is sometimes called an ‘account’ because some UNIX systems implement strict quotas for computer resources which have to be paid for with real money.
You can log in two ways:
Graphical User Interface (CDE, KDE and GNOME)
Today the CDE, KDE and GNOME projects are the most important efforts to write graphical user interfaces for computers. The CDE (Common Desktop Environment) is a commercial program developed by IBM, Hewlett-Packard, Sun Microsystems and many other vendors. KDE (a German effort, a pun on CDE) and GNOME are free software window systems which have taken windowing to the next level. While they have borrowed and stolen many ideas from Windows innovative Windows95 user interface, they have taken windowing beyond this.
2.Text or Command Line Interface (using secure shell, ssh program)
Change your password on host nexus
You cannot change it here
dax% rlogin nexus
Changing password for mark
Enter login password: ********
Enter new password: ********
Re-enter new password: ********
UNIX has three mouse buttons. On some PC's running GNU/Linux or some other PC UNIX, there are only two, but the middle mouse button can be simulated by pressing both mouse buttons simultaneously. The mouse buttons have the following general functions. They may also have additional functions in special software.
This is used to select and click on objects. It is also used to mark out areas copy by dragging. This is the button you annually use.
Used to pull down menus. It is also used to paste a marked area somewhere at the mouse position.
Pulls down menus.
On a left-handed system right and left are reserved.
Reading electronic mail on UNIX just like any other system. But there are many programs to choose from. There are very old programs from the seventies such as
and there are fully graphical mail program such as
Text editing and word processing
UNIX has a Word-like program called lyx, and even several Office clones (e.g. Star Office soffice), but for the most part UNIX users do not use word processors. It is more common in the UNIX community to write all documents. Regardless of whether they are letters, books or computer programs, using a non-formatting text editor. (UNIX word processors like Framemaker do exist, but they are very expensive. A version of MS-Word also exists for some unices.) Once you have written a document in a normal text editor, you call up a text formatter to make it pretty. You might think this strange, but the truth
Examples of text editors are vi, ed,emacs, xemacs, xedit, textedit etc.
A shell is a command interpreter. In the early days of UNIX, a shell was the only way of issuing commands to the system. Nowadays many window-based application programs provide menus and buttons to perform simple commands. But the UNIX shell remains the most powerful and flexible way of interacting with the system.
Shells provide facilities and commands which
Start and stop processes (programs)
Allow two processes to communicate through a pipe
Allow the user to redirect the flow of input or output
Allow simple command line editing and command history
Define aliases to frequently used commands
Define global "environment" variables which are used to configure the default behavior of a variety of programs. These lie in an "associated array" for each process and may be seen with the 'env' command. Environment variables are inherited by all processes which are started front a shell.
Provide wildcard expansion (joker notation) of filenames using ‘*,?,’
Provide a simple script language, with tests and loops, so that users can combine system programs to create new programs of their own.
Change and remember the location of the current working directory, or location within the file hierarchy.
Environment and shell variables
Environment variables are variables which the shell keeps. They are normally used to configure the behavior of utility programs like 1pr (which send a file to the printer) and mail (which reads and send mail) so that special options do not have to be typed in every time you run these programs.
Any program can read these variables to find out how you have configured your working environment. We shall meet these variables frequently. Here are some important variables
Global variables/Environment variables: (inherited by all sub shells)
PATH #The search path for shell commands (bash)
TERM #The terminal type (bash and csh)
DISPLAY #X11 - the name of your display
LD_LIBRARY_PATH #Path to search for object and shared libraries
HOSTNAME #Name of this UNIX host
PRINTER #Default printer (lpr)
HOME #The path to your home directory (bash)
PS1 #The path to your home directory (bash) a
Local variables/Shell variables: (not defined for programs and sub shells started by current shells)
path # The search path for shell commands (csh)
term # The terminal type (csh)
prompt # The default prompt for csh
home # The path to your home directory (csh)
Sometimes you want to be able to refer to several files in one go. For instance. you might want to copy all files ending in `.c' to a new directory. To do this one uses wildcards. Wildcards are characters like *? Which stand for any character or group of characters. In card games the joker is a 'wild card' which can be substituted for any other card. Use of wildcards is also called filename substitution in the UNIX manuals. In the sections on sh and csh.
The wildcard symbols are.
‘?’ Match single daintier. e.g. is /etc/rc.??? ?
‘*’ Match any number of characters. e.g. ls /et c/rc*
‘[…]’ Match any character in a list enclosed by these brackets. e.g. is [abc] .C
Here are some examples and explanations.
Match all files in /etc whose first three characters are rc. and are 7 characters long.
‘*.c’ Match all files ending in `.c' i.e. all C programs.
'*. [Cc]' List all files ending on `.c' or `.C' i.e. all C and C++ programs.
'*. [a-z]' Match any file ending in at, S .c, ... up to z etc.
The wildcards belong to the shell. They are used for matching filenames. UNIX has a more general and widely used mechanism for matching strings, this is through regular expressions.
Regular expressions are used by the egrep utility, text editors like ed. vi and emacs and sed and awk. They are also used in the C programming language for matching input as well as in the Perl programming language and lex tokenize'. Here am some examples
# Print all lines beginning with a comment #
egrep '(~#)' /etc/rc
# Print all lines which DON'T begin with #
egrep '( [~*])' /etc/rc
# Print all lines beginning with e, f or g. egrep '(~[efg])' /etc/rc
Print all lines beginning with uppercase
egrep '(~[A-Z])' /etc/rc
# Print all lines NOT beginning with uppercase egrep '(~[~A-Z])' /etc/rc
# Print all lines containing ! * & egrep '([\!\*\&)' /etc/rc
All lines containing ! • & but not starting SS egrep '([~#][\!\*\&])' /etc/rc
These examples assume that the file ‘/etc/rc’ exists. If it doesn't exist on the machine you are using, try to find the equivalent by, for instance, replacing /etc/rc with /etc/rc* which will try to find a match beginning with the rc.
‘.’ Match any single character except the end of line.
‘~’ Match the beginning of a line as the first character.
‘$’ Match end of line as last character.
‘[..]’ Match any character in the list between the square brackets.(see below).
‘*’ Match zero or more occurrences of the preceding expression.
‘+’ Match one or more occurrences of the preceding expression.
‘?’ Match zero or one occurrence of the preceding expression.
If the square brackets contain a list of characters. $[a-z156]$ then a single occurrence of any character in the list will match the regular expression: in this case any lowercase letter or the numbers 1. 5 and 6.
If the first character in the brackets is the caret symbol ‘~’ then any character except
those in the list will be matched.
Normally a dash or minus sign '-' means a range of characters. If it is the first character after the '[' or after '[~ ' then it is treated literally.
UNIX Important keys
<TAB> The TAB key is used by Bash and FAIUICS for "filename completion"'
<CTRL-A> Jump to start of line
<CTRL-C> Interrupt of break key, Send signal 15 to process
<CTRL-D> Signifies ‘EOF’ end of file
<CTRL-E> Jump to end of line
<CTRL-L> Clear screen in newer shell in emacs. Same as ‘clear’ in the shell.
<CTRL-Z> Suspend the present process, but do not destroy it
Ownership and granting access permission
chmod Change file artless mode.
chown, chgrp Change owner and group of a file. The GNU version of chown allows both these operations to be performed together using the syntax chown owner. group file.
acl On newer Unices. Access control lists allow access to be granted on a per-user basis rather than by groups.
Find Search for files from a specified directory using various criteria.
locate Fast search in a global file database for tiles containing a search-string.
Whereis Look for a command and its documentation on the system.
du show number of blocks used by a file or files
df show the state of usage for one or more disk partition
In order to communicate with a user, a shell needs to have access to a terminal. UNIX
was designed to work with many different kinds of terminal. Input/output commands in UNIX read and write to a virtual terminal. In reality a terminal might he a text-based Teletype terminal (called a tty for short) or a graphics based terminal; it might be 80-characters wide or it might be wider or narrower. UNIX take into account these possibility by defining a number of instances of terminals in a more or less object oriented way.
Example : xterm, vt100 etc.