What is OS ?
It is a collection of program or software which runs on computer and manages all the hardware resources.(Or) It is an interface between user and Hardware Resources
It is classified into two types:
i. Single user system
ii.Multi user system
i.Single user system : provides a platform for only one user at a time.
Example : DOS
Multi user system : more than one user can access same system resources at the same time.
Example : Linux , Unix
Features of OS ?
1.Process management2.Memory management
3.Data management
4.Input & Output management
What is a Linux ?
1.Linux is an operating system.2.It is one of the flavor of Unix.
3.It is clone of Unix OS.
4.It has been developed for business ,education and personal productivity purpose.
5.Developed in 1991 by Linus Torvalds student from Helsinki University [ finland ].
Features of Linux ?
1.Multi User & Multi Tasking : More than one user can access the system resources &can perform multiple task at the same time.
2.Open Source: It is an open source code. It can be downloaded from the internet completely for free,
no registration fee.
3.Portability:Independent of any hardware platform.
4.Communication: Exchanging of information or files from one user account to another user account.
5.Security: It provides High security compare to windows.
Two level of securities:
i. System level security : controlled by sys admin.
ii.File level security : controlled by owner of file.
File System
1. It is a method of storing the data in an well organized manner on the disk.2. It is responsible for storing information on disk and retrieving and updating this information.
Types of File System :
a. Network File System
EX: NFS,DFS
b. Disk File System
EX:ext2,ext3,ext4
FAT32,NTFS
Types of File System
1. In Windows :FAT32 (File Allocation Table),NTFS (New Technology File System)
2. In Linux :
Ext3,Ext4 (Extended file system)
3. In Unix :
JFS, ZFS (Zeta File System)
Basic Commands in Linux
- $Pwd = Where am I ?
- cd , cd .. , cd ../.. , cd = Changes working directory.
- ls , ls –a , ls -l = Shows the contents of current directory.
- cp = To copy file or dir.
- mv = To move or rename file or dir.
- mkdir = To make or create a directory.
- rmdir = To remove a dir.
- su = To switch a user.
- getconf ‘WORD_BIT’ = Info about bit 32/64.
- free –m = Info about RAM memory.
- grep = To filter.
- cat To create a file .
- touch = To create a empty file & multiple file.
- vi editor = To create ,append, delete data from file.
*User Management*
1. In linux a user should have account,To log on to a system a user should have username & password for security.2. In linux, It follows User Private Group (UPG) scheme, with this when ever a user is created with a same name group also
created. This becomes the primary group of that user & a user can have only one primary group.
3. When a user is created, Home directory, Mail account, UID & GID is assign to that user.
4. In Linux, We can create upto 60,000 users, in which
i. Root User ( Admin ) = 0 to 499
ii. Normal User = 500 to 60000
5. [ slm@host ~ ] #
slm = username
host = hostname
~ = present working directory
# = sign of root user
$ = Normal user
6. Commands in user Management
- Useradd ( to add a new user )
- Usermod (to modify existing user )
- Userdel ( to delete a user )
- Vi /etc/passwd [to check user info ] Or Cat /etc/passwd
- Vi /etc/shadow [ to check user’s passwd info ] Or Cat /etc/shadow
- #useradd user1
- #Passwd user1
- Cat /etc/passwd
User1:x:500:501: :/u01/home:/bin/bash
username : user1
Mask passwd : x
UID : 500
GID : 501
: : - is to add a comment
Home location : /u01/home
Default shell : /bin/bash
- # passwd user1 [ to assing a password ]
- #usermod -c dba user1 [ to add comment ]
- #usermod -c ‘’ user1 [ to remove comment]
- #usermod -u 510 user1 [ to change UID ]
- #usermod -d /u01/home user1 [ to change home location ]
- #usermod -L user1 [ to lock a user ]
- #usermod -U user1 [ to unlock a user ]
- #usermod -s ksh user1 [ to change location of a user ]
- #userdel user1 [ to delete a user ]
- #userdel -r user1 [ to delete a user from all locations eg:home]
- #useradd -g grp1 -m user2 [ to add a user with existing primary group ]
- #usermod -G grp1 -m user2 [ to add secondary group to a user ]
- #useradd -g grp1 -d /u01/home -m user5 where
-g is for primary group
-d is for location
-m for adding a new user
*Group Management*
1. Group :In linux, group is nothing but it is a collection of user whose permissions has to be same.
There are two types of groups are there :
i. Primary group
ii.Secondary group
Primary Group: It is a initial group assign to a user.
Secondary Group: If a user is having a first group [primary group] then you can assign another group that is said to
be secondary group. It is an substitute for primary group.
2. Commands for group management
- # groupadd
- # groupmod
- # groupdel
- # gpasswd
- Cat /etc/group [ info of group ] (or) Vi /etc/agroup
- Vi /etc/gshadow (or) Cat /etc/gshadow [ info of group passwd ]
- # groupadd grp1 [ to add a new user ]
- # groupmod -g 600 grp1 [to add a new GID ]
- # gpasswd grp1 [ to assign a passwd ]
- # groupmod -n grpnew grp1 [ to rename a group ]
- # gpasswd -M user1,user2,user3 grpnew [ to add multiple user in a existing group ]
- # cat /etc/group [ to check ]
- #cat /etc/gshadow
*Permissions*
Every file and directory comes with three types of permissions:1. Read: Lets you view the contents of the file only. In dir level, list the files/sub-dir.
2. Write: Lets you makes the changes of the contents of files [create, modify, or delete files in that directory] . In directory level, it will let you to create files & sub-dir.
3. Execute: Lets you execute (run) the file if the file contains an executable program (script). In directory level, to create a dir.
4. These permission is assign to three different levels/catagories : Owner [user] Group Others
5. Default Permission for a file & directory : File : 644/666
Directory : 755/777
6. This values is subtracted with the umask value that is 022 is default, due to security reasons. You can change the umask value.
7. Read permission is the most basic permission. Having the execute permission without the read permission is of no use—you can’t execute a file if you can’t read it in the first place.
Use the ls –l, ls –al, ll to check permissions Eg: $ ls -al -rwxrwxrwx 1 oracle dba 320 Jan 23 09:00 test.ksh -rw-r---r- 1 oracle dba 152 Jul 18 13:38 updown.ksh8. Commands of permissions
- Chmod [ to change permission for file&dir ]
- Chown [ to change ownership for file&dir ]
- Chgrp [ to change group for a file&dir ]
9. There are two types for assigning permission:
i.Character Method [ Read(r), Write(w), Execute (x) ]
ii.Numeric Method [ r=4, w=2, x=1 ; Total=7 ]
- # chmod 755 book(dir)
Where 1st 7 stands for RWX for Owner/User 2nd 5 stands for RX for group 3rd 5 stands for RX for others
- # chmod u+rwx,g-rx,o-rx book(dir) [permission-755]
- # chown user1 book
- # chgrp grp1 book
No comments:
Post a Comment