Академический Документы
Профессиональный Документы
Культура Документы
and
Commands
Introduction
• Operating System:
It acts as an interface between the user and
system.
a system that manages the resources of a
computer.
• Resources:
CPUs, Memory, I/O devices, Network etc..
Unix Architecture
Hardware sh who
Kernel cpp date
kernel
Shell as ed
hardware
wc
ld
grep
nroff
Other apps
Kernel
• Three major tasks of kernel:
Process Management
Device Management
File Management
Shell
The shell acts as an interface between
the user and the kernel
A shell is an environment in which we
can run our commands, it is also called
as a command-line interpreter
Basic Linux Commands
• File Handling
• Text Processing
• System Administration
• Process Management
• Archival
• Network
• File Systems
• Advanced Commands
Files
Everything in unix is considered as a file,
including the physical devices like flash
device, network cards etc..
Logical collection of files is called as file
system or Unix file system(UFS).
A UFS(unix file system) contains both inode
and contents of the file.
Every file as a unique number to identify, this
number is called as an inode number.
Files…..
We can classify files into 3
1. Ordinary Files
• Text File
• Binary File
2. Device Files
FILE PERMISSIONS
FILE TYPE
1. FILE TYPE
the first character of the first field defines the type of
the file.
_ _ _|_ _ _|_ _ _
USER (U)
GROUP (G)
OTHER (O)
U G O
To change file Permission
‘chmod’ command is used to change the permissions of
the file.
USAGE: chmod [options] mode[,mode] file1 [file2 ...]
Unix allows the user to specify modes in two ways.
1. Absolute
2. Relative
1. Absolute:
in this we use a series of 3 octal numbers to
specify the permission of a file.
Ex: chmod 501 demo.txt, chmod 777 demo.txt
| rwx | 111 | 7 | Read, write and execute |
| rw- | 110 | 6 | Read, write |
| r-x | 101 | 5 | Read, and execute |
| r-- | 100 | 4 | Read, |
| -wx | 011 | 3 | Write and execute |
| -w- | 010 | 2 | Write |
| --x | 001 | 1 | Execute |
| --- | 000 | 0 | no permissions |
+----------------------------------------------------+
RELATIVE
In this mode ‘=‘ , ‘+’, ‘-’ operators are used
to assign, give and remove permissions.
On the LHS specify the category u,g,o,a.
On the RHS specify the permission r,w,x.
Ex: chmod u+r demo.txt
chmod u+rw demo.txt
chmod ug+rwx demo.txt
chmod a+rwx demo.txt
chmod u+rw,g+x demo.txt
INODE
Is a data structure and it contains following details of the
file:
1. Mode/permission (protection)
2. Owner ID
3. Group ID
4. Size of file
5. Number of hard links to the file
6. Time last accessed
7. Time last modified
8. Time inode last modified
‘-i’ option along with ls command is used to see the
inode number of a file.
2. Link
Primary
1
– man(manual) pages.
man <command> shows all information about the
command ex: man ls
2
• cd - change directories
Usage: cd [DIRECTORY]
eg. cd demo
Note: the Directory can be a relative
or absolute path of Directory
cp – copy files and directories
Usage: cp [OPTION]... SOURCE DEST
Examples:
1. cp file1 file2
cp a.txt b.txt
2. cp file 1 file2…. filen directory
cp file1 file2 /home/user/demo
mv – this command is used to move a file
from one directory to another
It is also used to rename a file.
Usage: su User_name
usage: sudo su
It will ask for the password.