Monday, March 17, 2014

PERMISSIONS

 permissions on directory and on file

[root@localhost Desktop]# mkdir /india

[root@localhost /]# ls -ld india
drwxr-xr-x. 2 root root 4096 Mar 17 14:13 india

[root@localhost Desktop]# cd /india
[root@localhost india]# ls
[root@localhost india]# whoami
root
[root@localhost india]# touch ap
[root@localhost india]# ls -ld ap
-rw-r--r--. 1 root root 0 Mar 17 14:13 ap

Saturday, March 15, 2014

ADD & REMOVE USERS IN A GROUP

[root@localhost /]# useradd os1
[root@localhost /]# useradd os2
[root@localhost /]# useradd os3

[root@localhost /]# gpasswd -M os1,os2,os3 soft

[root@localhost /]# grep soft /etc/group
soft:x:504:os1,os2,os3

[root@localhost /]# gpasswd -d os1 soft
Removing user os1 from group soft

[root@localhost /]# grep soft /etc/group
soft:x:504:os2,os3

CHANGING THE NAME OF A EXISTING GROUP


[root@localhost /]# groupmod -n soft sales

[root@localhost /]# grep soft  /etc/group
soft:x:504:

ADDING NEW GROUP WITH GID 600 & MODIFYING GROUP GID

to add new group gid

[root@localhost /]# groupadd -g 600 market

[root@localhost /]# grep market  /etc/group
market:x:600:

 modifying group gid

[root@localhost /]# groupmod -g 640 market

[root@localhost /]# grep market  /etc/group
market:x:640:

ADD NEW GROUP

add the group

[root@localhost /]# groupadd sales

to check the group

[root@localhost /]# grep sales /etc/group
sales:x:504:

REMOVE USER

remove user with out home directory


[root@localhost /]# userdel sys1

remove user with directory

[root@localhost /]# userdel -r sys4

USER ACCOUNT LOCK AND UNLOCK


[root@localhost /]# passwd sys4
Changing password for user sys4.
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.

[root@localhost /]# usermod -L sys4

[root@localhost /]# usermod -U sys4

CHANGE LOGIN NAME



[root@localhost /]# usermod -l cmp2  sys2

[root@localhost /]# grep cmp2 /etc/passwd
cmp2:x:502:502::/home/sys2:/bin/bash

CREATE USER WITH PASSWORD

[root@localhost /]# useradd sys2

[root@localhost /]# passwd sys2
Changing password for user sys2.
New password:
BAD PASSWORD: it is based on a dictionary word
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.

to check
[root@localhost /]# su - sys2

MODIFY THE FILE BY USING VI COMMAND

modify the file by using ' vi ' command

create a file  by using cat command
ex:- [root@loaclhost~]# cat > line
hi
how are you
ctrl + d (save & quit)

[root@localhost ~]# vi line


command options

i - inserts the text at current cursor position
I - insert the text at beginning of line
a - append the text after current cursor
A - appends the text at the end of line
o - inserts a line below current cursor
O- inserts a line above current cursor
r - replace a single char at current cursor

exit the file (shift + esc + : )
:q     - quit without saving
:q!    - quit forcefully without saving
:w     - save
:wq   - save & quit
: wq! - save & quit forcefully
:x      - save & quit

command lines copy, delete,cut,past

dd - delete a line
yy - copy a line
p  - put
u - undo
ctrl + r - redo
g - move cursor to last line of file
xhift+zz - save & quit

VIEW THE DATE AND CHANGE

date view and change

[root@localhost ~]# date
Sat Mar 15 22:44:13 EDT 2014


[root@localhost ~]# date -s "mon may 23 10:20:10 ist 2013"
Thu May 23 00:50:10 EDT 2013

[root@localhost ~]# date
Thu May 23 00:50:28 EDT 2013

TYPE OF FILE

see the type of file

[root@localhost ~]# file *

anaconda-ks.cfg:    ASCII English text
d4:                 directory
d5:                 directory
Desktop:            directory
Documents:          directory
Downloads:          directory
install.log:        ASCII text
install.log.syslog: ASCII text
linux:              empty
linux1:             ASCII text, with no line terminators
mozilla.pdf:        PDF document, version 1.5
Music:              directory
Pictures:           directory
Public:             directory
s2:                 empty
s3:                 ASCII English text
s4:                 empty
s5:                 empty
Templates:          directory
Videos:             directory

MOVE DIRECTORIES AND FILES

move directories and files

[root@localhost ~]# mv d1 /opt

[root@localhost ~]# ls
anaconda-ks.cfg  Documents           linux        Pictures  s4
d4               Downloads           linux1       Public    s5
d5               install.log         mozilla.pdf  s2        Templates
Desktop          install.log.syslog  Music        s3        Videos

to enter the /opt directories 
[root@localhost ~]# cd /opt

[root@localhost opt]# ls
d1 

RENAME DIRECTORIES AND FILES

rename directories and files

before rename the file

[root@localhost ~]# ls

anaconda-ks.cfg  Desktop      install.log.syslog  Music     s3         Videos
c1               Documents    linux               Pictures  s4
d4               Downloads    linux1              Public    s5
d5               install.log  mozilla.pdf         s2        Templates

[root@localhost ~]# mv c1 d1

 ls to check

[root@localhost ~]# ls

anaconda-ks.cfg  Desktop      install.log.syslog  Music     s3         Videos
d1               Documents    linux               Pictures  s4
d4               Downloads    linux1              Public    s5
d5               install.log  mozilla.pdf         s2        Templates

Thursday, March 13, 2014

COPY A DIRECTORY

copy a directory

[root@localhost ~]# cp -r c1 Desktop

[root@localhost ~]# ls
anaconda-ks.cfg  d5         Downloads           linux   Pictures  s3  Templates
c1               Desktop    install.log         linux1  Public    s4  Videos
d4               Documents  install.log.syslog  Music   s2        s5

to enter the directory

[root@localhost ~]# cd Desktop
[root@localhost Desktop]# ls
c1

COPY FILES

create a file

[root@localhost ~]# cat  > hyd

hello hyderabad

ctrl + d (save and quit )
 

[root@localhost ~]# cp  hyd  s3

to check

[root@localhost ~]# cat s3
hello hyderabad

REMOVE A DIRECTORY

remove a directory using command ' rm -rf '

ls to check

[root@localhost ~]# rm -rf d2

[root@localhost ~]# ls

anaconda-ks.cfg  d5         Downloads           linux   Pictures  s3  Templates
c1               Desktop    install.log         linux1  Public    s4  Videos        d3
d4               Documents  install.log.syslog  Music   s2        s5

[root@localhost ~]# rm -rf  d3
[root@localhost ~]# ls
anaconda-ks.cfg  d5         Downloads           linux   Pictures  s3  Templates
c1               Desktop    install.log         linux1  Public    s4  Videos
d4               Documents  install.log.syslog  Music   s2        s5

REMOVE AN EMPTY DIRECTORY

remove an empty directory using command 'rmdir'

[root@localhost ~]# rmdir d1

[root@localhost ~]# ls

anaconda-ks.cfg  d4         Downloads           linux1    s2  Templates
c1               d5         install.log         Music     s3  Videos
d2               Desktop    install.log.syslog  Pictures  s4
d3               Documents  linux               Public    s5

REMOVE A FILE

remove a files using command 'rm' and then press yes 'y'
'ls' to check

[root@localhost ~]# rm s1
rm: remove regular empty file `s1'? y
[root@localhost ~]# ls

CREATE NESTED DIRECTORIES

create nested directories

[root@localhost ~]# mkdir -p c1/c2/c3/c4

to check the structure

[root@localhost ~]# ls -r c1
c2
[root@localhost ~]# cd c1
[root@localhost c1]# ls -r c2
c3
[root@localhost c1]# cd c2
[root@localhost c2]# ls -r c3
c4
[root@localhost c2]# cd c3

[root@localhost c3]# ls
c4

to check the working directories
 
[root@localhost c4]# pwd
/root/c1/c2/c3/c4

CREATE A SINGLE AND MULTIPLE DIRECTORY

create a single and multiple directories using command mkdir

[root@localhost ~]# mkdir d1

[root@localhost ~]# ls

anaconda-ks.cfg  Downloads           linux1    s1  s5
d1                    install.log              Music     s2  Templates
Desktop          install.log.syslog  Pictures  s3  Videos
Documents        linux                   Public    s4


[root@localhost ~]# mkdir d2 d3 d4 d5

[root@localhost ~]# ls

anaconda-ks.cfg  d4         Downloads           linux1    s1  s5
d1               d5         install.log         Music     s2  Templates
d2               Desktop    install.log.syslog  Pictures  s3  Videos
d3               Documents  linux               Public    s4
[root@localhost ~]#

CREATE A MUILTIPLE FILES

create a multiple files using touch command (0 byte files)


[root@localhost ~]# touch s1 s2 s3 s4 s5

     ls to check

[root@localhost ~]# ls

anaconda-ks.cfg   Downloads            linux      Pictures  s2  s5
Desktop                install.log              linux1    Public      s3  Templates
Documents           install.log.syslog   Music     s1           s4  Videos

Tuesday, March 11, 2014

TO CREATE, READ, APPEND A FILE

TO CREATE A FILE
 cta  >  file name 

ex:-
[root@localhost ~]# cat > linux
hi this is linux

use this command
ctrl + d ( to save and quit )


to read the file
cat  file name

ex :-
[root@localhost ~]# cat linux
hi this is linux

to append a file
cat   >>  file name

ex:-

[root@localhost ~]# cat  >>  linux
u r  from india

ctrl + d (save and quit)

TO SEE ALL CONTENTS FILES OF A DIRECTORY

TO SEE ALL CONTENTS FILES AND DIRECTORY OF A DIRECTORY

[root@localhost ~]# ls -a


verfication:-

.                             .dbus            .gstreamer-0.10     Pictures
..                            Desktop          .gtk-bookmarks      Public
.abrt                      Documents        .gvfs               .pulse
.adobe                    Downloads        .ICEauthority       .pulse-cookie
anaconda-ks.cfg    .esd_auth        .imsettings.log     .purple
.bash_history         .evolution       install.log         .recently-used.xbel
.bash_logout           .gconf           install.log.syslog  .ssh
.bash_profile          .gconfd          .local              .tcshrc
.bashrc                  .gnome2          .macromedia         Templates
.cache                    .gnome2_private  .mozilla            .thumbnails
.config                   .gnote           Music               Videos
.cshrc                    .gnupg           .nautilus           .xauthv6l5Fr


THE PERMISSION REGARDING THE CONTENTS OF A DIRECTORY

THE PERMISSION REGARDING THE CONTENTS OF A DIRECTORY

[root@localhost ~]# ls -l


total 104
-rw-------. 1 root root  1500 Mar  9 04:43 anaconda-ks.cfg
drwxr-xr-x. 2 root root  4096 Mar 11 23:04 Desktop
drwxr-xr-x. 2 root root  4096 Mar  9 04:56 Documents
drwxr-xr-x. 2 root root  4096 Mar  9 04:56 Downloads
-rw-r--r--. 1 root root 49234 Mar  9 04:43 install.log
-rw-r--r--. 1 root root 10379 Mar  9 04:40 install.log.syslog
drwxr-xr-x. 2 root root  4096 Mar  9 04:56 Music
drwxr-xr-x. 2 root root  4096 Mar  9 04:56 Pictures
drwxr-xr-x. 2 root root  4096 Mar  9 04:56 Public
drwxr-xr-x. 2 root root  4096 Mar  9 04:56 Templates
drwxr-xr-x. 2 root root  4096 Mar  9 04:56 Videos







[root@localhost ~]# ll


total 104
-rw-------. 1 root root  1500 Mar  9 04:43 anaconda-ks.cfg
drwxr-xr-x. 2 root root  4096 Mar 11 23:04 Desktop
drwxr-xr-x. 2 root root  4096 Mar  9 04:56 Documents
drwxr-xr-x. 2 root root  4096 Mar  9 04:56 Downloads
-rw-r--r--. 1 root root 49234 Mar  9 04:43 install.log
-rw-r--r--. 1 root root 10379 Mar  9 04:40 install.log.syslog
drwxr-xr-x. 2 root root  4096 Mar  9 04:56 Music
drwxr-xr-x. 2 root root  4096 Mar  9 04:56 Pictures
drwxr-xr-x. 2 root root  4096 Mar  9 04:56 Public
drwxr-xr-x. 2 root root  4096 Mar  9 04:56 Templates
drwxr-xr-x. 2 root root  4096 Mar  9 04:56 Videos

TO SHOW THE CONTENTS OF A DIRECTORY

To show the contents of a present working directory (folder)

[root@localhost ~]# ls
and press enter

verification:-

anaconda-ks.cfg  Documents  install.log         Music     Public     Videos
Desktop          Downloads  install.log.syslog  Pictures  Templates


PRESENT WORKING DIRECTORY

[root@localhost ~]#  pwd
 /root

The pwd command displays the absolute path name of current  working directory to the computer.

INSTALLING LINUX OPERATING SYSTEM

1. Restart the system and go to BIOS .
(with the help of press F2 in windows os, F8 in linux os )
2. Set the first boot device as DVD ROM.
3. Save the settings by pressing F10 and click Yes.
4. Insert Linux DVD and restart the system.
5. Press 1st option to install new os.
6. Select skip to avoid  media test.
7. Click net to proceed installation.
8. make sure installation language  English and click next.
9. Make sure installation language English and click next.
10. Select basic storage devices and click next.
11.Provide computer name and click next.
12.Select time zone and click next.
13.password and click next.
14.select create custom layout and click next
15.Recommended partition of linux
     /boot  =200mb
     /         =10000mb
     /home = 8000mb
     /var    =10000mb
     /usr    = 10000mb
     /swap =twice to ram size
16. select create
17. select standard partition
18. define mount point , file system, size and then click ok
19.select format
20.select write changes disk option
21.click next it proceed installation
22.click  next to install boot loader
23.select desktop , customize now and click next
24.If you want extra application to choose and then  install 
25.click next after it complete installation process
26.Reboot select
27 select licence agreement and click next
28.select forward adding a user in not mandatory
29.define date and time and select next
30. select finish
31. provide user name = root
32 provide password as you given at the time of installation