Create three users:
Example:
[root@test119 ~]# useradd kavita
[root@test119 ~]# useradd ramu
[root@test119 ~]# useradd srinu
Make ramu the member of the group kavita
Example:
[root@test119 ~]# gpasswd -a ramu kavita
Adding user ramu to group kavita
Create a directory
Example:
[root@test119 ~]# mkdir /linux
Check the default permission of the above created directory
[root@test119 ~]# ls -ld /linux/
drwxr-xr-x 2 root root 4096 Aug 28 11:26 /linux/
Give full permissions to the above created directory
Example using absolute mode
[root@test119 ~]# chmod 777 /linux/
(or)
Example using symbolic mode
[root@test119 ~]# chmod ugo=rwx /linux/
Check...
Sunday, 28 August 2011
Friday, 26 August 2011
Group Membership in Linux
Syntax:-
[root@localhost~]# gpasswd <option> <arguments> <groupname>
Options:
-M -- Add multiple users to a group
-A -- Add a group Administrator
-a -- Add a single user to a group
-d -- Delete a user from a group
Example:- Add multiple users (ravi, sunil) to the group marketing
Note: Before doing this the group marketing should be exists.
[root@test119 ~]# gpasswd -M ravi,sunil marketing
To check if the users are added to the group
[root@test119 ~]# grep marketing /etc/group
marketing:x:2006:ravi,sunil
Example:- Add user rani as the administrator for the group marketing
[root@test119 ~]# useradd rani
[root@test119 ~]# gpasswd -A rani marketing
To check if rani has been added as the administrator for the group marketing
[root@test119 ~]# grep marketing...
Group Administration in Linux
Creating a Group
Syntax:-
[root@localhost~]# groupadd <groupname>
(or)
[root@localhost~]# groupadd <option> <argument> <groupname>
Options:
-g -- Group ID
-0 -- Override
Example:- Creating a group Sales with default options
[root@test119 ~]# groupadd sales
To check if the group has been created
[root@test119 ~]# tail -5 /etc/group
avdefs:x:504:
ali:x:2001:
tom:x:2002:
anu:x:2003:
sales:x:2004:
Example:- Creating a group mktg whose group id (GID) is 750
[root@test119 ~]# groupadd -g 750 mktg
To check if the group has been created
[root@test119 ~]# tail -5 /etc/group
ali:x:2001:
tom:x:2002:
anu:x:2003:
sales:x:2004:
mktg:x:750:
Modifying...
Thursday, 25 August 2011
Creating an User
Syntax :-
[roort@localhost~]# useradd <username>
or
[roort@localhost~]# useradd <option> <argument> <username>
Options:
-u -- UID -c -- comment
-g -- Primary Group Name or GID -d -- Home directory
-o -- Override ...
Wednesday, 24 August 2011
Basic Commands - 2.1
To View the calender
Example : To see the current month
[root@localhost ~] # cal
August 2011
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Example : - TO see the past, current and next month
[root@localhost ~] # cal -3
July 2011 August 2011 September 2011
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 1 ...
Basic Commands - 2.0
Copying files and Directories
[root@localhost ~]# cp <option> <source> <destination>
Example :- To copy a file
[root@localhost ~]# cp completereport /opt
To check if the file has been copied
[root@localhost ~]# cd /opt
[root@localhost ~]# ls
completereport
Example :- To copy a directory
[root@localhost ~]# cp -r directory1/ /opt/
To check if the directory has been copied
[root@localhost ~]# cd /opt
[root@localhost ~]# ls
completereport directory1
Moving files and directories
Syntax :-
[root@localhost ~]# mv <option> <source> <destination>
Example :- To Move a file
[root@localhost ~]# salesreport /opt
To check if the file has been moved
completereport directory1 salesreport
Example :- To move a directory
[root@localhost ~]# mv...
Monday, 22 August 2011
Creating Directories & Directory Navigation
Syntax :-
[root@localhost~]# mkdir <option> <directory name>
Example :- Creating a single directory
[root@localhost~]# mkdir directory1
Example :- Creating multiple directories
[root@localhost~]# mkdir direcoty2 directory3 directory4
To check if the directories have been created
[root@localhost~]# ls -d directory*
directory1 directory2 directory3 directory4
Example :- To create nested directories (Sub directories inside directories)
[root@localhost~]# mkdir -p d1/d2/d3/d4
To check if the nested directories have been created
[root@localhost~]# ls -R d1
/d1:
d2
/d1/d2:
d3
/d1/d2/d3:
d4
/d1/d2/d3/d4:
Note :- To list the contents and create a file or directory in a location different from the present working directory, Specify the complete path (example...
Basic Commands -1.2
Creating files and adding data using cat command
Syntax :-
[root@localhost~]# cat <option> <arguments>
Example :- To create a file along with some data
[root@localhost~]# cat > salesreport
This file contains the sales report for the month Aug.
( Now press Ctrl+d to Save )
Example :- To create one more file along with some data
[root@localhost~]# cat > mktgreport
This file contains the mktg report for the month of Aug.
( Now press Ctrl+d to Save )
Example :- To read the contents of a file
[root@localhost~]# cat salesreport
This file contains the sales report for the month of Aug.
Example : - To append (add) to a file
[root@localhost~]# cat >> mktgreport
This year the efforts in mktg have increased.
Ctrl+D
Check the contents of the file mktgreport
[root@localhost~]#...
Sunday, 21 August 2011
Basic Commands -1.1
To check the Present working directory
Syntax :-
[root@localhost`]# pwd
Example :-
[root@localhost~]# pwd
/root
To See the contents of a directory (folder)
Syntax :-
[root@localhost~]# ls <option> <argument>
Options:
-l Long list including attributes
-a All files and directories including hidden
-d To check for a particular file or directory
-R Recursively, to see the contents in a tree structure
Example :- To list the contents of the present working Directory
[root@localhost~]# ls
anaconda-ks.cfg install.log.syslog POOL.logpid
Desktop ...