Ask your problem
Three types of permission read write and execute, Ever file and folder have three relations owner group and others [ Read = r write = w execute = x ] [ owner = u group = g other = o ] [root@pc1 ~] # Ls -Ld /disk 1= nature of object [d=dir -=file L=link] 2= first three permission for owner [ rwx ] 3= second three permission for group members [ r-x] 4= third three permission for others [r-x] 5= number of inodes contain by this directory 6= owner of directory 7= group of directory 8= size of directory 9= creating date of object 10= name of object [root@pc1 ~] # Ls -L /disk Drwxr-xr – x 2 root root 4096 Jan 1 1988 dir1 Drwxr-xr – x 2 root root 4096 Jan 1 1988 dir2 Drwxr-xr – x 2 root root 4096 Jan 1 1988 dir3 Changing permission = give write permission to other on /disk [root@pc1 ~] # chmod 0+w /disk Give read write and execute permission for group on /disk [root@pc1 ~] # chmod g+rwx /disk Assigning read writ and execute permission to user, group and other with single command [root@pc1 ~] # chmod u+rwx , g+rwx, o – rwx /disk Assigning different permission with different commands which separate with semicolon [root@pc1 ~] # chmod u+rwx /disk ; chmod g+rwx /disk ; chmod 0+rx /disk Using number system =----- [ Read = 4 ] [ Write = 2 ] [ Execute = 1 ] rwx=7 r-x=5 ---=0 Assigning full permission to owner and no permission for group and others [root@pc1 ~] # chmod 700 /disk Assigning full permission for owner and group no permission for other [root@pc1 ~] # chmod 700 /disk Assigning full permission to all [root@pc1 ~] # chmod 777 /disk Assigning full permission for owner and read, and execute for group and others [root@pc1 ~] # chmod 755 /disk Assigning no permission for all [root@pc1 ~] # chmod 000 /disk Assigning sticky bit permission for other [root@pc1 ~] # chmod o+t /disk Assigning suid permission for owner [root@pc1 ~] # chmod u+s /disk Assigning sgid permission for group
[root@pc1 disk]# man mkdir [root@pc1 disk]# info mkdir [root@pc1 disk]# whatis mkdir [root@pc1 disk]# mkdir - - help [root@pc1 disk]# apropos "partition"
Adding user with graphical utility Show the properties of tony user [root@pc1 disk]# id tony Uid=501 (tony) qid=501 (tony) qroup=501 (tony) Add tow uses john and jhosen with different command with default properties [root@pc1 disk]# adduser john [root@pc1 disk]# useradd umer Assigning password to john [root@pc1 disk]# passwd john Add a group [root@pc1 disk]# groupadd cisco Customizing users properties at the time of creating user [-u uid ] [-g primary group] [-G secondary group] [ -c comments] [ -d home directory path ] [-s login shell ] [root@pc1 disk]# usersadd -u 600 -g cisco -G saad -c "Manager" -d /etc/jonny -d /bin/sh jonny Modify user properties with usermod command [root@pc1 disk]# usemod -u 666 -s /bin/bash jonny Delete a user jonny with his home directory [root@pc1 disk]# userdel -r jonny Delete a group cisco [root@pc1 disk]# qroupdel cisco All users information stored in /etc/passwd every user have a seven column line in this file 1-user name [ user authenticate at the time of login from the first column of /etc/passwd ] 2-password required [ x means users must required password if remove this x user can login without password] 3-uid [ 500 first user id 0 to 499 id's are reserved 0 for root user and remaining for services users ] 4-gid [ every user relate with any group which stored in /etc/group ] 5-comments [full name but it is not compulsory only for information ] 6-home directory path [ linux file system is read only for normal user only his home directory is with full permission for normal user 7-login shell (/bin/bash, /bin/sh, /bin/tsh, /sbin/nologin) every user required a shell for login without shell user can never login at machine. [root@pc1 disk]# gedit /etc/passwd All groups stored in this file [root@pc1 disk]# edit /etc/shadow User password stored in this file
For changing directory / to /etc [root@pc1 /]# cd /etc One step back /etc to / [root@pc1 etc]# cd .. Go to previous working directory [root@pc1 /]# cd - Go to current login user home directory [root@pc1 etc]# cd ~ Show the contents of /etc in single color [root@pc1 ~]# dir /etc Show the contents of /etc in different colors with nature of contents [root@pc1 ~]# Ls /etc create a folder on root partition [root@pc1 ~]# mkdir /disk Create a folder in /disk [root@pc1 ~]# mkdir /disk/dir Create multiple folder in multiple directories with single command [root@pc1 ~]# mkdir /etc/dir1 /var/dir2 /usr/dir3 Create multiple folder in same directory [root@pc1 ~]# mkdir dir1 dir2 dir3 Copy a file in directory [root@pc1 disk]# cp file dir Copy a file from /disk/file and paste it in /disk/dir/ [root@pc1 disk]# cp /disk/file /disk/dir Copy a directory with –r option [root@pc1 disk]# cp -r dir dir2 Copy a file from /disk/file and paste it in /etc with myfile name [root@pc1 disk]# cp /disk/file /etc/myfile Remove a file [root@pc1 disk]# rm file Remove a file with forcefully option [root@pc1 disk]# rm –f file Remove a directory with out –r option and you face will an error [root@pc1 disk]# rm dir Remove a directory with –r option [root@pc1 disk]# rm -r /disk Remove a directory with forcefully option [root@pc1 disk]# rm -rf dir Move /etc/dir1 to /disk/ with different name [root@pc1 disk]# mv /etc/dir1 /disk/mydir Rename the folder name mydir to dir [root@pc1 disk]# mv /disk/mydir /disk/dir Rename the file name with myfile [root@pc1 disk]# mv file myfile Read a file page by page with less command [root@pc1 disk]# less /etc/grub.conf Read a file page by page with more command [root@pc1 disk]# more /etc/qrub.conf Read first ten lines of grub.conf [root@pc1 disk]# head /etc/grub.conf Read last ten lings of grub.conf [root@pc1 disk]# tail /etc/grub.conf Read first 12 lines with –n option [root@pc1 disk]# head -n 12 /etc/grub.conf Read last 11 lines with –n option [root@pc1 disk]# tail -n 11 /etc/grub.conf Copy the contents of /etc/grub.conf in /disk/file [root@pc1 disk]# cat /etc/grub.conf > /disk/file Append the contents /etc/mtab in /etc/file [root@pc1 disk]# cat /etc/mtab >> /disk/file Merging tow commands with pipe sign output of the first command is input of second command [root@pc1 disk]# cat /etc/squid/squid.conf I more Count the total lines of squid.conf [root@pc1 disk]# cat /etc/squid/squid.conf I wc -L Show only spool words in squid.conf [root@pc1 disk]# cat /etc/squid/squid.conf I grep spool Flush the contents of file [root@pc1 disk]# cat /dev/null > /var/log/messages
/bin All commands which are used by normal users
/etc System conf files
/var Server data logs Mail proxy cache
/dev All devices name stored in /dev
/sbin All commands which are used by supper user
/boot Linux kernel ( vmlinuz , initrd ) Grub directory
/usr All gui tools installed in /usr
/proc System information’s ( picture of RAM )
/home User's home dir's
/tmp Temporary files
/media Auto mounted devices mount point in /media