Linux file system

Standard directory structure
      / ­ the topmost
      /dev ­ all the devices are accessible as files
      /var ­ “variable” data such as mails, log files, databases
      /usr ­ almost all the packages installed
      /etc ­ configuration files
      /home ­ home directories for all the users
      /root ­ home directory of the privileged user root
      /mnt ­ used to mount other directories/partitions.

Metacharacters ­These are special characters that are recognised by the shell.

* ­ matches 0 or more characters.
     eg: ls *.c

? ­ matches any single character
    eg: ls ab?.c

[] ­ This will match any single character in the range.
     eg: ls tut[0­9].m
     This will find files such as tut0.m, tut9.m etc.,

> ­ Redirect standard output to a file.
    echo “hello world” > hello.txt
>> ­Appends standard output to a file.
    eg: echo “Hello Again” >> hello.txt

< ­ Takes standard input from a file

| ­ This is pipe character. Sends the output of first command as input for the
second command.

mkdir – make directory
     usage: mkdir <dirname>
     eg: mkdir ­p path/test/test1
     ­p ­­> no error if existing, make parent directories as needed

cd ­ change directories
    Use cd to change directories. Type cd followed by the name of a directory to
access that directory.

mv­ change the name of a directory
    Type mv followed by the current name of a directory and the new name of
the directory.
    Ex: mv testdir newnamedir

Comments

Popular Posts