• 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
  • File and Directory Permission

    File and Directory:

    ‘ll’ is used to display the information about the files and directory including date, time, users,group, size, name and permission.

    Four symbols are used when displaying permission.

    R : Read

    W : Write

    X : Execute

    - : no permission

    -rwxrwxrwx : files

    drwxrwxrwx : directory

    files and directory permission are symbolized by ten character.

    If we want to change permission, then there are two methods:

    1. symbolic
    2. Numeric

    1. Symbolic Method:

    Syntax:

    Chmod mode directory/filename

    Mode Option:

    1. u,g,o
    2. w,r,x
    3. +,-
    4. =

    1. # chmod u+rwx file or directory : in case of user only
    2. # chmod ug+rwx file or directoty : in case of user and group
    3. # chmod u+w,g+r,o+x directory/file
    4. # chmod u+rw,g+rw directory/file
    5. # chmod u-r, g-w,o-rw directory/file
    6. # chmod ugo+rwx file/directory
    7. # 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
  • Getting Help

    Getting Help:

    The command that are used to get the help are discussed as :

    1. Whatis

    Display a short description of command , it uses a database that is updated nightly. Often not available immediately after installation.

    Syntax:

    # Whatis cal

    1. Help

    Display usage summary and argument list

    Syntax:

    --help

    Example:

    #Date –help

    1. Man and Info:

    Both provide documentation for command. Almost every command has a “man” page. Collection of pages are called linux manual.

    # man date

    # info date

    Viewing Text Page

    Syntax:

    #less [option] [filename]

    Example:

    # less abc.txt

    scroll with arrows/PgUp /PgDown

    /text : search for text

    n : Next Match

    Option:

    -c : Clear before displaying

    -s : Squeeze multiple blank lines into a single blank line

    Simply we can also use “less” along with pipe | as

    # ll |less

    more
  • Moving and Renaming File and Directory

    Moving and Renaming File and Directory

    Syntax:

    # mv : move /rename files and directory

    Example:

    # mv [option] file destination

    example:

    # mv t.txt /home/rohan/

    more than one file can be moved at a time if the destination is a directory

    # mv [option] file1 file2 file3 destination

    more
  • Copying File and Directory

    Copying File and Directory:

    1. Copy file:

    Syntax:

    # cp [source]filename [destination]

    1. Copy directory

    #cp –r [source]directory [destination]

    to copy a directory into another directory recursively

    1. cp –rf [source]directory [destination]

    to copy a directory forcefully

    syntax used for copy file or directory:

    cp [option] file destination

    option:

    -I : interactive : ask before overwriting file

    -r : Recursive

    -p : Preserve

    -f : forcefully

    More than one file can be copied at a time if the destination is directory

    Syntax:

    cp [option] file1 file2 file 3 Destination

    more
  • Creating file and Directory

    Creating file and Directory:

    1. Creating file:

    The ‘cat’ command is used to create a file

    Syntax:

    # cat > filename

    example:

    # cat > abc.txt

    (Ctrl +D) is used to save the file.

    1. View the content of file

    Syntax:

    # cat filename

    Example:

    #cat abc.txt

    #cat –b abc.txt

    1. Creating Directory

    The ‘mkdir’ command is used to create directory

    Syntax:

    Mkdir [directory_name]

    Example:

    # mkdir rohan

    Option used:

    cd : To change directory

    cd .. : To come out from directory

    cd : to jump to root directory

    cd - : to jump to previous directory

    Deleting Files and directory:

    Syntax:

    For file:

    rm

    example:

    rm abc.txt

    for directory

    syntax:

    rmdir

    Note: Only empty directory will be deleted)

    If we want to delete the tree structure of directory then we need to use the following command

    Syntax:

    rm –rf

    where

    r = recursively

    f= force

    in order to remove non empty directory

    Syntax:

    rm –r

    example;

    rm –r rohan

    this will remove directory step by step ,first remove sub directory and then finally main directory.

    Another method of creating file :

    Touch : this command is used to create a blank file with size zero.

    # touch

    Example:

    #touch abc

    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