0% found this document useful (0 votes)
61 views

First Indian Corporation - India

UNIX is a multi-user operating system that allows multiple users to access a machine simultaneously. It was first developed at Bell Labs in the 1960s and has since spawned various flavors including Linux, Solaris, and BSD. UNIX operates in layers with the kernel managing hardware interactions, commands and applications making requests to the kernel, the shell managing interactions between the user and system, and the user interacting at the shell level. It utilizes a file system with everything treated as a file or directory arranged in a tree with paths denoted by slashes.

Uploaded by

Friedrich Paul
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

First Indian Corporation - India

UNIX is a multi-user operating system that allows multiple users to access a machine simultaneously. It was first developed at Bell Labs in the 1960s and has since spawned various flavors including Linux, Solaris, and BSD. UNIX operates in layers with the kernel managing hardware interactions, commands and applications making requests to the kernel, the shell managing interactions between the user and system, and the user interacting at the shell level. It utilizes a file system with everything treated as a file or directory arranged in a tree with paths denoted by slashes.

Uploaded by

Friedrich Paul
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 36

UNIX

First Indian Corporation - India

1
Objectives
• At the end of this session, you will be able to
understand:
–What is UNIX and its history
–Various components of UNIX
–Why should we use UNIX
–How to log in and log out
–A few simple commands of UNIX
–vi Editor, its usage and some essential commands

2
What is UNIX?
• UNIX is a multi-user operating system that supports
multi-tasking.
• An operating system is a part of computer system
that acts like a manager to the system resources.
• In a multi-user o/s many users can access the same
machine simultaneously and the o/s will ensure that
all the users get the required support.

3
History of UNIX
• First developed at Bell Labs of AT&T
• Milestones in its lifetime :
1988 System VR4, 4.3BSD, POSIX

1983 UNIX system V with software support (Stability)

1981 (Cheap) commercial releases for 32-bit processors

1979 Commercial releases for 16-bit processors

1975 Cheap releases to universities

1973 Rewritten in C (Portability)

1971 On PDP11/20

1969 Single user system on PDP-7


4
Flavors of UNIX
• Over the years, two major forms (with several
vendor’s variants of each) of UNIX have evolved:
– AT&T UNIX System V, and
– University of California at Berkeley’s Berkeley Software
Distribution (BSD).
• There are many flavors of UNIX being used
throughout the computer industry:
– SCO, ESIX, XENIX, AUX,
– Solaris, HP-UX, AIX, Linux,
– BSD, IRIX, ULTRIX.
5
Flavors of UNIX (contd...)
• All of the flavors are basically the same with some
semantic differences at the programmer level and a
few differences at the command level.
• American Express is predominantly using Solaris &
AIX which are variants of the AT&T version of the
UNIX operating system.

6
Components of UNIX
• When you use UNIX, several layers of interaction are
occurring between the computer hardware and the user.

User
Windowing System
Shell
Applications Commands
Kernel
Hardware

• Let’s now understand these layers in detail.


7
Components of UNIX (contd...)
• The first layer is the kernel, which runs on the actual machine hardware
and manages all interaction with the hardware.
• All applications and commands in UNIX interact with the kernel, rather
than the hardware directly, and they make up the second layer.
• On top of the applications and commands is the command-interpreter
program, the shell, which manages the interaction between the user, user
applications, and the UNIX commands.
• Most UNIX commands are separate programs, distinct from the kernel.
• A next layer, which may or may not be present on your system, is a
windowing system such as X. The windowing system usually interacts
with the shell, but it can also interact directly with applications.
• The final “layer” is the user. The user will interact with the entire
operating system through just the shell, or through a combination of the
shell and the window system.
8
File System
• A file, as all of us know, is a
collection of related data.
• A collection of related files is known
as a directory.
• In UNIX, everything is considered as
a file, thus a directory is also
considered as a file internally.
• The UNIX file system consists of
files (and directories) that are needed
by system and user applications.
9
File System (contd…)
• The file system of UNIX can be considered as an inverted
tree. The root of this tree is denoted by “/”.
/ (Root)

bin user usr lib

mydir appls extra

The path of a file is found by traversing this tree from top till the file,
putting “/” in between the two files. For example:
The path of root directory is /
The path of bin is /bin
The path of mydir is /usr/mydir
10
Why should we use UNIX?
There are many reasons,
here are just a few:

Robust

Wide range
Effective
of Networked
use of
availability
resources
and uses

Multi- Security
Multi-user tasking

11
Things to Remember
Hey I keep typing in “CD
home” and it keep saying
command not found.
Stupid Computer!

Don’t you remember


from class notes. UNIX
is case sensitive. Try
typing cd home.

• Before we take a look at how to log-in and some important


commands of UNIX, remember that UNIX is case-sensitive.

12
Things to remember (contd…)
• There are two very special path symbols to keep in mind.
They are, “.” for current working directory and “..” for the
parent of the the current working directory.
• Also remember that filenames can be given in one of three
manners.
– Absolute, fully qualified and begins with a slash. Tells exactly
where the file is.
– Relative, no slash to lead off the filename. This means to look for
the file from where you currently are.
– No path, just type in a filename. In this case the file is assumed to
be in the current directory. If you type in the name of an
executable file it will traverse your path until it is found so it can
be executed. 13
Things to remember (contd…)
/ (Root)

bin user usr lib

mydir appls extra

• Consider that in the above file system you are currently in


usr directory. If you want to go to “extra” directory, you
may do that in the following two ways:
– Absolute Path: cd /usr/extra
– Relative Path: cd extra
Note that relative path is same as giving no path at all.
14
Logging In
• To be able to log-in, you would need a userID and
password. (Remember in order to login, you MUST
have an account on the system you are accessing.)
– Type your userid and then press the RETURN key.
– After you have entered your userid, the system will
prompt you for your password (by displaying the word
“Password:”), enter your password and press the
RETURN key.

15
Logging In (contd…)
• If you receive a message similar to “Login failed, please try
again,” you may have typed your userid or password
incorrectly. Try again, making sure to type in your userid
and password correctly. If you are still having problems,
contact your administrator.
• When you have successfully logged on, the system will
pause for a moment and display messages from the system
administrator, if any.
• The system will then display the command prompt. The
prompt signals that the system is ready for you to enter your
next command.
16
Logging Out and Changing Password

Type
Type “exit”
“exit” at
at the
the command
command prompt
prompt to
to log
log out
out of
of
UNIX.
UNIX.

• You can change your password at any time. To


change the password:
– At the command prompt, type passwd.You will be
prompted to enter your old password and be asked twice
to enter your new password. Neither your old nor new
password will appear on the screen as you type.
17
Some simple commands of UNIX
• UNIX has a wide range of commands that allow you
to manipulate not only your files and data, but also
your environment.
• A UNIX command line consists of the name of the
UNIX command followed by its arguments (options,
filenames and/or other expressions) and ends with a
RETURN.
• The general syntax for a UNIX command is:
– command [-flag options] file/expression

18
A few rules to follow
• You should follow several rules with
UNIX commands:
– UNIX commands are case-sensitive, but most
are lowercase.
– UNIX commands can only be entered at the
shell prompt.
– UNIX command lines must end with a
RETURN.
– UNIX options often begin with a “-” (minus
sign).
– More than one option can be included with
many commands.
19
Change Directory (cd)
• cd
– This command is used to change the working directory
– Syntax: cd <directory name with path>
– Examples:
• To change to a directory called “mydir”, the command is:
cd mydir
• To change to a directory called “newdir” under the directory
“mydir”, the command is:
cd mydir/newdir

20
Present Working Directory (pwd)
• pwd
– When you log in the UNIX system places you in your
home directory.
– The pwd command will display the full pathname of the
current directory you are in.
– Syntax: pwd
– Output: /home/userid

21
Process Status (ps)
• ps
– ps stands for process status, is used to list the processes
running on a machine.
– The command without options shows minimal
information about the processes you are running.
– Syntax: ps [-options]
– Examples:
• To display the processes running by a particular user.
ps -fu <user name>
• To display the detail information about every processe
ps -ef

22
List (ls)
• ls
– This command is used to list the files and directories
under a directory.
– Syntax: ls [options] <path of the directory>
– Examples:
• To display the contents of current directory, type in the
following command:
ls
• To display the contents of directory “mydir” that is created
under the current directory, the command is:
ls mydir
NOTE: To get more information on the options of ls command, use
man command which is explained in the next slide. 23
Manual (man)
• man
– The standard on-line help facility available with UNIX is
electronic reference manuals, known as the man pages,
and you access them with the man command.
– Syntax: man <command-name>
– As mentioned in the previous slide to see help for ls, type
in:
man ls
NOTE: The output of man command is shown page by page. To be able
to go to next page, you need to press “Spacebar”.

24
vi Editor
• “vi” which stands for visual, is a display oriented
text editor.
• You can use vi to write programs, and anything else
you feel like.
• It is a powerful editor with far too many commands
to cover in detail in this session. Thus, we will be
discussing only a few important commands of this
editor.
NOTE: To learn the other commands, please take a look at the
appendix.

25
Starting vi
• To start vi, type in vi followed by the filename of
the file you want to open.
– Example: To open a file called “myfile” the command is:
vi myfile
• If the file does not exist, vi will create it for you.
• You can also start vi without giving any filename. In
this case, vi will ask for one when you quit or save
your work.

26
Modes of vi
• vi has two modes, command mode and input mode.
– In command mode, characters you type perform actions
like moving the cursor, cutting or copying text, or
searching for some particular text.
– In input mode, you type to insert or overwrite text. When
you start vi, it is in command mode.
• To switch from command to input mode, press the
“i” key (you do not need to press RETURN). vi lets
you insert text beginning at the current cursor
location. To switch back to command mode, press
ESC. 27
Modes of vi (contd…)
• You can also use ESC to cancel an unfinished
command in command mode.
TIP: Unfortunately, vi does not normally indicate which mode you are in. If you
are uncertain about the current mode, you can press ESC a few times. When vi
beeps, you have returned to command mode.

28
Cursor Movement
• You can move the cursor in command mode.
• vi has many different cursor movement commands.
The four basic keys appear below.
Keystroke Result
k move up one line
h or Backspace line move one character to the left
l or Spacebar line move one character to the right
j move down one line

29
Inserting Text
• You can insert text in a file only when the mode is set to
input mode.
• vi recognizes some a few special keystrokes as you type.

Keystroke Result
Backspace or Delete Erase the previous character
CTRL-W Erase the previous word
CTRL-U Erase the current line
RETURN Start a new line

30
Deleting Text
• To delete text, first move the cursor so that it covers
the first character of the group you want to delete,
then type the desired command from the table
below.
Command Function
x Delete only the current character
D Delete to the end of the line
db Delete from the current character to the beginning of the current word
de Delete from the current character to the end of the current word
dd Delete the current line
dw Delete from the current character to the beginning of the next word

31
Saving your work and exiting
• vi provides several means of saving your changes. Besides saving
your work before quitting, it’s also a good idea to save your work
periodically.
• To save type the following from the command mode:
– :w to save your work (“w” is for “write”).
• Similarly, to quit vi use the command:
– :q
• You can combine these two commands at once to write-and-quit by
entering command mode and typing:
– :wq
• In some cases you will want to abandon your changes since the last
time you saved your work (the last :w command). To do so, type:
– :q!which tells vi to quit without saving. Use caution when abandoning vi in this
manner because any changes you made will be permanently lost. 32
Windows-based tools to access UNIX
• The following two Windows-based tools can be used to
access UNIX:
– TELNET
• Click Start -> Run and type in “telnet <servername>”, the following
window will appear. Type in the userID and password on this screen.
• After the authentication is done, a command prompt will appear. You
may type in the commands at this prompt.

33
Windows-based tools to access UNIX
– Xceed
• This is another tool that can be used to access UNIX.
• We, at AMEX, generally use this tool to access UNIX. This
tool would be installed on your machines.
• When you launch this application, the following login screen
will appear.

34
Windows-based tools to access UNIX
• Type in your userID and password on this screen.
• After the authentication is done by the system, you would see
the following screen.

• You may now start typing the commands at this prompt.

35
Summary
• Congratulations! You have successfully completed
this session.
• You have learned the following concepts in this
session: What is
What is
UNIX
UNIXandandits
its
history
history Various
viviEditor
Editorand
and Various
aafew components
fewsimple
simple components
commands of
ofUNIX
UNIX
commands

AAfew
fewsimple Why
simple Whyshould
should
commands
commandsof we
of we useUNIX
use UNIX
UNIX
UNIX
How
Howtotolog
loginin
and
andlog
logout
out
36

You might also like