0% found this document useful (0 votes)
109 views5 pages

Experiment No 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views5 pages

Experiment No 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

OPERATING SYSTEM LAB MANUAL

BASICS OF UNIX COMMANDS


Ex.No:1
INTRODUCTION TO UNIX, UNIX COMMAND
AND EDITORS

AIM:
To study about the basics of UNIX
UNIX:
It is a multi-user operating system. Developed at AT & T Bell Industries, USA in 1969.

Ken Thomson along with Dennis Ritchie developed it from MULTICS


(Multiplexed Information and Computing Service) OS.
By1980, UNIX had been completely rewritten using C language.

LINUX:
It is similar to UNIX, which is created by Linus Torualds. All UNIX commands
works in Linux. Linux is a open source software. The main feature of Linux is
coexisting with other OS such as windows and UNIX.

STRUCTURE OF A LINUXSYSTEM:
It consists of three parts.

a) UNIX kernel
b) Shells
c) Tools and Applications

UNIX KERNEL:
Kernel is the core of the UNIX OS. It controls all tasks, schedule all
Processes and carries out all the functions of OS.

Decides when one programs tops and another starts.

SHELL:
Shell is the command interpreter in the UNIX OS. It accepts command from
the user and analyses and interprets them

1|Page
Note: Syn->Syntax

a) date
–used to check
the date and time Syn:
$date

b) cal
–used to
display the
calendar Syn:
$cal 2 2009

c)echo
–used to print the message on the screen.
Syn:$echo “text”

d) ls
–used to list the files. Your files are kept in a directory.
ls[a-m]*List all the files whose name begin with alphabets From „a‟
to „m‟ ls[a]*List all the files whose name begins with „a‟ or „A‟
Eg:$ls>my list Output of „ls‟ command is stored to disk file named „my list‟

e)lp
–used
to take
printouts
Syn:$lp
filename
f)man
–used to provide manual help on every UNIX commands.
Syn:$man unix command
$man cat

g)who & whoami


–it displays data about all users who have logged into the system currently. The
next command displays about current user only.
Syn:$who$whoami

h) uptime
–tells you how long the computer has been running since its last reboot or power-off.
Syn:$uptime

i)uname
–it displays the system information such as hardware platform, system name and
processor, OS type.
Syn:$uname–a 2|Page

j) hostname
–displays and set
system host name
Syn:$ hostname

FILE MANIPULATION COMMANDS


a) cat–this create, view and concatenate files.
Creation:
Syn:$cat>filename

Viewing:
Syn:$cat filename
Add text to an existing file:
Syn:$cat>>filename

Concatenate:
Syn:$catfile1file2>file3
$catfile1file2>>file3 (no over writing of file3)

b) grep–used to search a particular word or pattern related to that


word from the file. Syn:$grep search word filename
Eg:$grep anu student

c) rm–deletes a file from


the file system Syn:$rm
filename

d) touch–used to create a blank file.


Syn:$touch file names

e) cp–copies the
files or directories
Syn:$cpsource file
destination file Eg:
$cp student stud

f) mv–to rename the


file or directory syn:
$mv old file new file
Eg:$mv–i student student list(-i prompt when overwrite)

g) head–displays10 lines from the


head(top)of a given file Syn:$head
filename
Eg:$head student

To display the top two lines:


3|Page

Sync : :$head-2student

a) tail–displays last 10
lines of the file Syn:
$tail filename
Eg:$tail student
To display the bottom two lines;
Syn:$ tail -2 student

b) chmod–used to change the


permissions of a file or directory. Syn:$ch mod
category operation permission file
Where, Category–is the user type
Operation–is used to assign or
remove permission Permission–is
the type of permission
File–are used to assign or remove permission all

VI/ VIM Editor


Vi- vi is stands for “visual”.vi is the most important and powerful editor.vi is a full screen
editor that allows user to view and edit entire document at the same time.vi editor was written
in the University of California, at Berkley by Bill Joy, who is one of the co-founder of Sun
Microsystems.

Features of vi:
It is easy to learn and has more powerful features.
Itworksgreatspeedandiscasesensitive.vihaspowerfulundofunctionsandhas3modes:
1. Command mode
2. Insert mode
3. Escape or ex mode
In command mode, no text is displayed on the screen.
In Insert mode, it permits user to edit insert
or replace text. In escape mode, it displays
commands at command line.
Moving the cursor with the help of h, l, k, j, I, etc

Motion Commands:
M-> Move to end of file
M-< Move to beginning of file
C-v Move forward a
screen M –v Move
backward a screen C –n
Move to next line C-p
Move to previous line
C-a Move to the
beginning of the line
C-e Move to the end 4|Page
of the line
C-f Move
forward a
character C-b
Move backward
a character M-f
Move forward a
word
M-b Move backward a word

5|Page

You might also like