INTRODUCTION TO
LINUX
Overview of LINUX system
Two parts Kernel and Shell
Kernel
Core part of the operating system and communicates directly
with the hardware.
User programs access the kernel through a set of functions
called system calls.
Shell
It is a command interpreter.
Acts as an interface between user and kernel.
Kernel-Shell Relationship
Characteristics
Multiuser and Multiprocess
File and Process
Data, directory, process, hard disk etc (almost everything) are
expressed as a file.
Process is a running program identified by a unique id (PID)
Directory Structure
Files are put in a directory.
All directories are in a hierarchical structure (tree structure).
User can include or remove any directories on the tree.
Top directory is /, which is called slash or root.
Users have their own directory (home directory).
Directory Structure
Linux Overview
Normal User and Super user
In linux, administrator, is a special user which has all the rights.
This special user is called root or superuser.
Case Sensitive
Myfile.doc and MYFile are different.
Basic Commands
One command consists of 3 parts
Command name
Options
Arguments
Example:
[Ubuntu@ubuntu`]$ command-name optionA option arg1 arg2
A space is necessary between command name, options and arguments.
cd ..
ls l
mv file1 file2
Relative and Absolute Path
Path means a position in the directory tree.
To express a path, you can use relative path or absolute path.
In relative path expression, the path is not defined uniquely, it depends
on your current path.
In absolute path expression, the path is defined uniquely, it does not
depend on the current path.
Relative and Absolute Path
Absolute path starts with /
Eg: cd /home/user1/home/a.out
There are two special characters in the current path
. For current directory
.. For parent directory
Redirect and Append
Output of a command is displayed on screen.
Using > you can redirect the output from screen to a file.
Using >> you can append the output to the bottom of the file.
Pipe
Some commands require input from a file or other commands.
Using |, you can use output from other command as input to the
command.
Basic Commands
man <command> shows all information about the command.
<command> --help shows the available options for that command.
Eg: ls -- help
mkdir creates a directory
Eg: man ls
Eg: mkdir dir1
rmdir removes a directory
Eg: rmdir dir1
Basic Commands
cd change directory
To change to a particular directory: cd <directory name>
Eg: cd dir1
cd .. Moves you one directory up.
Basic Commands
echo writes a message to your screen.
pwd print name of current working directory.
Eg: pwd
who to know the users who are currently working.
Eg: echo hello
Eg: who
date shows date and time
Eg: date
Basic Commands
cal to see the calendar of any specific month
Usage: cal month year
cp to copy file or directory
Eg: cal 7 2012 displays julys calendar of 2012
Eg: cp file1 file2
ls obtains a list of all commands in the current directory
Eg: ls
Thank
You