• Checking Free Space

    Checking Free Space:

    In order to check the free and usage space per file system and directory and each sub directory we have two command

      1. df
      2. du

    the ‘df’ command reports on a per file system basis. It report total disk space , disk space used , disk space free

    #df –h

    -h : used multipliers such as G or M for gigabytes and Megabytes

    The ‘du’ command reports the number of kilobytes contained by the items within a directory

    #du –s

    #du –h

    -s : used to request only the summary directory information

    #du –s /etc

    more
  • Symbolic links

    Symbolic links:

    A symbolic link point to another file. We can display the link name and the referenced file by ‘ls –l’

    #ls –l pf

    lrwxrwxrwx 1 root root pf->/etc/passwd

    file type: l for symbolic link

    the content of the symbolic link is the name of the file that is referenced

    Syntax:

    Ln –s filename [linkname]

    Example:

    Ln –s /etc/passwd password

    There are seven fundamental file type

    - : regular file

    d : symbolic link

    b : block special file

    c : character special file

    p : named file

    s : socket

    character special file are used to communicate with hardware one character at a time. Block special file is used to communicate with hardware a block of data at a time : 512 bytes, 1024 bytes, 2048 bytes

    ls –l /dev |less { to check c and b files}

    named pipe type of file that passes data between processes. It stores no data itself socket file are used for inter process communication.

    more
  • Redirecting Input /Output

    Redirecting Input /Output

    The standard Output of command , which normally display on the terminal can be redirected into a file. Similarly standard error, which normally display on the terminal can be redirected into a file.

    Common redirection operator

    > : command>file : output command to file

    >> : command>>file : Append output of command to file

    < : command>file : receive input from file

    2> : command2>file : error from command to file

    2>> : command2>>file : append

    Example:

    #find /etc –name passwd

    this command will search for all file name passwd in /etc and its subdirectories

    now we can redirtect the standard outpout

    #find /etc –name passwd > output

    output is a file where command output will be stored. Standard error is still displayed on the screen

    #cat output

    If the target file of the file redirection with > already exists, the existing file will be overwritten. To append data to an existing file use >> to redirect instead of >

    #find /etc –name passwd >> output

    Redirecting standard Error

    We can redirect standard error with 2>

    #find /etc –name passwd 2>errorfile

    standard output is displayed on the screen , redirect further standard error, appending to the same file with 2>>

    #find /etc/ -name passwd 2>>errorfile

    #cat errorfile

    more
  • User and Group Administrator

    User and Group Administrator

    There are three type of user account in Red hat Linux

      1. Super user or Administrative account
      2. Regular user account
      3. service account
    1. Super User created automatically at the time of installation
    2. Regular user Account;
    1. Using command line method ‘useradd’ or ‘adduser’ command
    2. Graphical method by using Red hat user manager utility

    a.

    # adduser user_name (Recommended : minimum 6 character used in password)

    # passwd user_name

    Example:

    #adduser rakesh

    #passwd rakesh

    Now open the file /etc/passwd to check the entry of user

    #vi /etc/passwd

    it contain 7 entry of each user

    1. Username
    2. Password
    3. userid
    4. groupid
    5. blank (User information field ) comment
    6. home directory
    7. login shell

    password entry for each user will be stored in /etc/shadow

    # vi /etc/shadow

    now in order to check the Userid, Group we use /etc/login.def

    # vi /etc/login.def

    when any user account is created then user will get userid, groupid automatically from /etc/login.def

    5th field is used for user information or comment

    6th field is used for home directory. When any user is created its default home directory is created inside /home

    /home/rakesh

    7th field is login shell. Default shell for user is /bin/bash

    different shells are used

    ksh, sh, csh, tcsh,zsh

    shell is an user interface between user and O.S. linux command shell is a prompt that allow us to interact with our system by executing various command.

    In order to check the shell available use /etc/shells

    # vi /etc/shells

    in order to get the information about the group we need /etc/group

    #vi /etc/group

    it contain four field

    1. Group name
    2. password
    3. GroupId
    4. Member of group

    # finger : this command is used to get the information about the user

    Syntax:

    #finger username

    #finger rakesh

    #id : this command is used to get userid, groupid of the user

    syntax:

    #id username

    #id rakesh

    Creating Group:

    Syntax:

    #groupadd groupname

    #groupadd –g gid groupname

    Example:

    #groupadd raj

    Exercise:

    Create a user that should have uid=1000 shell=sh description and home directory as /data

    Sol:

    #useradd –u 1000 –c rakeshpundir –s /bin/sh –d /data rakesh

    #passwd rakesh

    Grpahically

    System Setting :-> User & Group

    OR

    #system-config-user

    Every user have two group one is elementary group or primary group and secondary group

    -g : Primary Group

    -G : Secondary Group

    Creating Group

    #groupadd g1

    #groupadd g2

    Steps:

    1. adding group to the user

    #usermod –g g1 –G g2 rakesh

    2. To change id of the user

    #usermod –u 1001 rakesh

    3. change comment

    #usermod –c rakeshsingh

    4. change home directory

    #usermod –d /rakesh-home rakesh –m

    5. change shell

    #usermod –s /bin/bash rakesh

    6. change user login name

    #usermod –l newname oldname

    #usermod –l rajesh rakesh

    7. Change Group name

    #groupmod –n newname oldname

    #groupmod –n group1 g1

    8. change Group id

    #groupmod –g 2005 group1

    more
  • Vi, vim Editor

    Vi, vim Editor


    Vi is the standard file editor for Unix and Vim is the standard file editor for Linux

    For Red hat Linux vi and Vim both are same

    There are three mode of vi editor

    1. command mode
    2. insert mode
    3. save and Exit Mode
    1. Command mode is again divided into 3 mode
    1. Cursor movement
    2. Copy, paste, delete, undo
    3. Text search
    1. Cursor Movement

    J : Down

    K : UP

    L : RIGHT

    H : LEFT

    1. Copy, paste delete, undo

    dd : delete particular line

    yy : copy particular line

    u : Undo

    p : paste

    ndd : n is the number of line to be deleted

    nyy : n is the number of line to be copied

    1. Text Search

    /text

    example

    /then

    1. Insert Mode

    Option I, insert, a ,o, O

    i : insert mode start at the point where cursor is. Same is used with

    insert option

    a : insert mode start after one character

    o : insert mode start after one line

    O : insert mode start before one line

    1. Save and Exit

    :q : Quiet

    :q! : forcely quiet

    :wq! : save and forcely quiet

    :wq : save and exit

    more
  • Representation Of Media Devices

    Representation Of Media Devices:

    All the device file are stored in /dev/

    Hard disk ; /dev/hdx

    Where x is

    a : /dev/hda : Primary master

    b : /dev/hdb : Primary slave

    c : /dev/hdc : Secondary master

    d : /dev/hdd : Secondary slave

    In case of SCSI, Sata or USB we will use : /dev/sda

    CD-rom:

    /dev/cdrom

    /dev/cdrom1

    /dev/cdrecorder

    Floppy:

    /dev/fd0

    /dev/fd1

    to access partition of windows in linux

    #mount –t vfat /dev/hdax /mnt

    in order to check the label of any partition

    #e2label /dev/hdax

    where x is number

    Mounting CD Rom

    # mount –t auto /dev/hdc /media/cdrom

    -t : file type

    auto : file type

    in order to check where cdrom is attached we can open the file fstab

    #vi /etc/fstab

    now in case of RHEl 3.0 we have to use command in order to unmount.

    # umount /media/cdrom

    and then eject the cdrom

    in case of RHEL 4.0 we simply type

    # eject

    Mounting Floppy

    #mount –t auto /dev/fd0 /media/floppy

    in case of floppy we have to umount first then only we remove floppy otherwise all content of floppy may be lost or floppy may be physically damaged.

    # umount /media/floppy

    Mounting USB media :- directed by the kernel as SCSI device

    /dev/sdax

    Vi Editor:

    Using vi , we can create or modify any file

    more
  • Linux file system

    Linux file system:

    Figure

    Root : it is an home directory of super user (root) administrator

    Etc : it is the location of all configuration file and directory used for server

    configuration or system configuration

    dev : it is a location of the device file

    home : it is a location of home directory or regular users

    proc : it is a virtual file system or directory not actually store on the disk and

    contain system information

    # cat /proc/meminfo

    # cat /proc/cpuinfo

    boot : contain kernel and boot related files

    sys : it is also a virtual directory and contain system information

    media : it is a mount point of removable disk like cdrom floppy usb drive etc.

    tmp : it contain all temporary file

    usr : it is used for software installation

    lib : it contain all library files

    bin : it is the location of all executable files or command or user command

    /usr/bin also contain user command

    sbin : it contain all system command or super user command /usr/sbin

    mnt : it is a mount point for physical hard-disk or partition

    opt : optional directory and used for temporary working

    var : it is a variable file system or directory and contain all log and error

    message

    file system type:

    Dos : Fat 16

    95/Xp/2000 : FAT32

    Xp/NT/2000 : NTFS

    Linux : EXT2,EXT3

    UNIX : VXFS

    k� K i u �� x�� "'># chmod ugo+rwx file/directory
  • # chmod ugo-rwx file/directory
    • + is used to add permission
    • - is used remove permission

    chmod ugo=rw directory/file

    this command will assign read/write permission to u,g,o

    suppose we have one file as

    test.txt

    permission : -r- - r- -r- -

    chmod u=w,g=wx,o=w test.txt

    this command will assign write to user, write/execute to group and write to other while remove the previous permission.

    The main difference between +,= are + operator simply add the new permission with previous one and = assign the new permission while removing old (new permission overwrite an old)

    1. Numeric Method:

    In this method, calculation are based on following numbers

    r=4 w=2 x=1 0= no permission

    Example:

    #chmod 777 file/directory

    in this case user get 7 means that user has permission of read/write/execute, group get 7 means read/write/execute and ame for other

    # chmod 531 file/directory

    in this case user get 5 means that user has permission of read/execute, group get 3 means write/execute and other get 1 means that other has permission to execute.

    #chmod 742 file/directory

    7 : User : rwx

    4 :Group : r

    2 : Other : w

    more
.

FEEDS FROM THIS BLOG

FEEDJIT Live Traffic Feed

My Zimbio   Blog Directory - OnToplist.com   Red Hat Enterprice Linux RHCE RHCT RHCA RHCSS  Powered by  MyPagerank.Net  Academic blogs & blog posts   BlogRankers.com  TopOfBlogs  BuzzCritic     Academics  Blog Directory  Hihera.com  Technology Blogs - Blog Rankings   Visit blogadda.com to discover Indian blogs  Academics Blogs  Computers (Linux) - TOP.ORG    Rallyshare    Yahoo bot last visit powered by MyPagerank.Net     The Weblog Review  blogarama - the blog directory  SEO services    Academic blogs & blog posts