Ex No 1 Study of Linux Operating System
Ex No 1 Study of Linux Operating System
Ex No 1 Study of Linux Operating System
STUDY OF LINUX
OPERATING SYSTEM
different directory
cp filename1 filename2 --- copies a file
rm filename --- removes a file. It is wise to use the option rm -i, which will ask you for
confirmation before actually deleting anything.
diff filename1 filename2 --- compares files, and shows where they differ
wc filename --- tells you how many lines, words, and characters there are in a file
chmod options filename --- lets you change the read, write, and execute permissions on
your files. The default is that only you can look at them and change them, but you may
sometimes want to change these permissions. For example, chmod o+r filename will
make the file readable for everyone, and chmod o-r
Directories
Directories, like folders on a Macintosh, are used to group files together in a hierarchical
structure.
mkdir dirname --- make a new directory
cd dirname --- change directory. You basically 'go' to another directory, and you will see
the files in that directory when you do 'ls'. You always start out in your 'home directory',
and you can get back there by typing 'cd' without arguments. 'cd ..' will get you one level
up from your current position. You don't have to walk along step by step ..
SHELL PROGRAMMING
The shell is a program that interprets whatever user type at the terminal and responds
accordingly. The command given from the user is moved to the shell, the shell analyses
and interprets these commands into machine understandable form. The shell acts as an
interface between the user and the system.
PARTS OF LINUX OPERATING SYSTEM
The LINUX Operating System has three parts. They are
1. Kernel
2. Shell
3. Users shell program.
KERNEL (HEART OF A LINUX SYSTEM)
It is the core of the Operating System. It controls all the all the functions of an Operating
System, such as memory and file management etc and it keep track of programs that are
executing. When the computer is switch on or boot up, this program in LINUX is
loaded into the computers main memory, where it remains until the computer is shut
down. Once the Kernel is loaded to memory, it is ready to carry out the user requests. The
user makes requests to a shell, which interprets them, and passes them on to the Kernel.
The Kernel is responsible for
Functions of a Shell
Command line interpretation
1.Program initiation
2.Transmission Output redirection
3.Pipeline connection
4.Substitution of filenames
5.Maintenance of variables
6. Environment control
7.Shell programming
3.LINUX EDITOR
LINUX system starts a special version of a shell called an interactive shell, and shows a
shell prompt, usually in the form of a dollar sing ($), a percent sign( %), or a pound sign
(#), When we type a line of input at a shell prompt, the shett tries to interpret it. Input to a
shell prompt is sometimes called a command line.The basic format
Modes in vi
There are three basic modes of vi:
Command mode
This is the default when you enter vi. In command mode, most letters, or short sequences
of letters, that you type will be interpreted as commands, without explicitly pressing
Enter . If you press Esc when you're in command mode, your terminal will beep at you.
This is a very good way to tell when you're in command mode.
Insert mode
In insert mode, whatever you type is inserted in the file at the cursor position. Type a
(lowercase letter a, for append) to enter insert mode from command mode; press Esc to
end insert mode, and return to command mode.
Line mode
Use line mode to enter line oriented commands. To enter line mode from command
mode, type a colon . Your cursor moves to the bottom of the screen, by a colon prompt.
Type a line mode command, then press Enter. Any sensible command from the LINUX
line editor ex will work, and a few are good to know about. These commands are
indicated in this handout by a colon in front of the command. Each time you use a line
mode command, you must type a colon to enter line mode, then type the command by the
colon prompt at the bottom of the screen, then press Enter when you finish typing the
command.
Starting vi and Saving Files
Starting vi:
vi filename Start editing filename, create it if necessary
Inserting Text
Type: To:
a append starting right of cursor
A append at the end of the current line
i insert starting left of cursor
I insert at beginning of the current line
o open line below cursor, then enter insert mode
O open line above cursor, then enter insert mode
:r newfile add the contents of the file newfile starting below the current line
Deleting Text
Type: To:
X Delete single character; 5x deletes 5 characters
Dw Delete word; 5dw deletes 5 words
Dd Delete line; 5dd deletes ... well you get the idea!
Cw Delete word, leaves you in insert mode (i.e. change word)
Cc change line -- delete line and start insert mode
S change character -- delete character and start insert mode
D Delete from cursor to end of line
C change from cursor to end of line -- delete and start insert mode
U undo last change