3) Some Basic Commands and its Use



 COMMAND AND ITS USE
___________________________________________________________________

  • Linux Operating System is more popular for command line. More command given below:-

useradd
Use create new user.
#        useradd ɸ user name
#        passwd ɸ user name
                                or
#        useradd ɸ -p ɸ type password ɸ user name

su
Use loging with other user.
#        su ɸ - ɸ user name

whoami
Use show current logging user.
#        whoami

logout or exit
Use use for logout.
#        logout

userdel   
Use delete user.
#        userdel ɸ -r ɸ user name

                 groupadd
Use create the group user.
#       groupadd ɸ group name

usermod
Use → change user Id and group Id.
#        usermod ɸ - u ɸ 1440 ɸ username
#        usermod ɸ - g ɸ 1340 ɸ username

cat
Use show under content of file.
#        cat ɸ file name
                                or
Use show user information.
#        cat ɸ /etc/passwd
  or
Use show group information.
#        cat ɸ /etc/gshadow
                       or
Use show password information.
#        cat ɸ /etc/shadow

pwd
Use → show current location.
#        pwd

vim, vi, nano, touch(for blank file)
Use create the text file.
#        vim ɸ file name
           press  i  (for insert)
                         type your text
                              press Esc  key
                              press Shift + :
                             type wq (for exit)
             
rm
Use delete text file.
#        rm ɸ file name

mkdir
Use create directory (Folder).
#        mkdir ɸ directory name
or
Use create sub directory in directory in parent directory.
#        mkdir ɸ - p ɸ dir1/dir2/subdir

rmdir
Use delete directory.
#        rmdir ɸ directory name
#        rmdir ɸ - p ɸ dir1/dir2/subdir
#        rmdir ɸ -r ɸ directory name
#        rmdir ɸ directory name/*
#        rmdir ɸ -rf ɸ directory name
echo
Use → create many file.
#        echo ɸ {type different file name with coma sign} .log
#        echo ɸ (file name){a..c} {1.3} .log

touch
Use → create blank file.
#        touch ɸ file name {1…5} .text

ls
Use listing
#        ls
or
Use show all file listing. (with hidden file)
#        ls ɸ - a
or
Use show user list
#        ls ɸ /home
or
Use show file detail list.        {l = show in long list                                         
#        ls ɸ - l h                     h = show file size} 
or   
Use show inode number of file and directory.                                         
#        ls ɸ - l i                    { i = show inode no.}        
  
mv
Use move file or directory.
#        mv ɸ text file name or directory name (to) ɸ directory name (in)

cp
Use copy the file.
#        cp ɸ text file name (to) ɸ directory name (in)

           cd
Use change directory.
#        cd ɸ directory location
  or
Use go previous mod
#        cd ɸ -


chmod
Use set permission.
#        chmod ɸ permission value ɸ file name
              or
#        chmod ɸ user name + permission type ɸ file name/directory name
#        chmod ɸ user name – permission type ɸ file name/directory name

chown
Use Change file owner name.
#        chown ɸ new owner name ɸ file name

chgrp
Use Change file group name.
#       chown ɸ new group name ɸ file name

 ln
Use create soft link (shortcut) of original file. 
#        ln ɸ - s ɸ original file ɸ softlink
     or
Use create hard link (mirror file) of original file.
#        ln ɸ original file ɸ hardlink

man
Use any command information help.
#        man ɸ command

Some filter command commands:-
        Pipeline (:) →Pipeline command used for joined two or more commands.
        Filter command → Filter command used for filtering of any characters.

sort
Use show list by sort with character serial
#        sort ɸ file name (short list by alphabet)
#        sort ɸ - k ɸ file name (short list by alphabet in column <k1, k2 or k3>)
#        sort ɸ - n ɸ - k ɸ file name (show list by number in column)

uniq
Use uniq command used for repeated case (name or word). The uniq command don’t work without sort command.
           
              #        cat ɸ file name ɸ : ɸ sort ɸ : ɸ uniq (show repeated case in single times)
              #        cat ɸ file name ɸ : ɸ sort ɸ : ɸ uniq ɸ - c (count to repeated case)
              #        cat ɸ file name ɸ : ɸ sort ɸ : ɸ uniq ɸ - d (show repeated case in single times)
             #        cat ɸ file name ɸ : ɸ sort ɸ : ɸ uniq ɸ - D (show repeated case in repeated times)
             #        cat ɸ file name ɸ : ɸ sort ɸ : ɸ uniq ɸ - f (avoid comparing to repeated case)
             #        cat ɸ file name ɸ : ɸ sort ɸ : ɸ uniq ɸ - i (ignore differences to repeated case)

wc
Use wc command used for counting characters (line, word, bytes or character)
             #    wc ɸ - l ( for line)
             #     wc ɸ - w (for word)
             #     wc ɸ - c (for bytes)
             #     wc ɸ - m (for charatesr)

grep
Use grep command used for search by character.
             #        grep ɸ character ɸ file name (search by character with case sensitive)
             #        grep ɸ - i ɸ character ɸ file name (search all by character)
             #        grep ɸ - v ɸ character ɸ file name (search without character with case sensitive)
             #        grep ɸ - v i ɸ character ɸ file name (search all without character )
             #        grep ɸ - A ɸ character ɸ file name (search by character with after line <A1, A2,…> )
             #        grep ɸ - B ɸ character ɸ file name (search by character with before line <B1, B2,…> )
             #       grep ɸ - C ɸ character ɸ file name (search by character with after & before line )

cut
Use → cut command used for cut data in file.
             #        cut ɸ - d dimeter ɸ - f1 ɸ file name (cut file with dimeter and field) Demeter → , : ; /     f → field
            #         cut ɸ - c dimeter ɸ file name (cut file with character)                                                                                                                    

tr
Use → tr command used for translating.
       #        Tr ɸ character(to) ɸ character(in)     {a → A},   {(a-z → A-Z)}
……………..more option available…………………………

locate
Use → show for location of any file.
       #        Locate ɸ file name
……………more option available……………………..

find
Use → find to any file or directory.
      #       find ɸ type file
…………….more option available……………………

gzip
Use → compress to file.
       #        gzip ɸ file name

gunzip
Use → uncompress to compress file.
       #        gunzip ɸ file name .gz

zip
Use → compress to file with zip
       #        zip ɸ - r ɸ file name .zip ɸ file

unzip
Use → extract to zip file.
       #        unzip ɸ file .zip

tar
Use → take backup of more file in single file with compress format.
       #        tar ɸ - c v f ɸ backup folder . tar ɸ file1 ɸ file2 ɸ file3
                       or
Use → show backup file content list.
       #        tar ɸ - t v f ɸ backup folder . tar
                      or
Use → extract and restore to backup file.
       #        tar ɸ - x v f ɸ backup folder . tar
                      or
Use → take backup in compress format.
       #        tar ɸ - c v f ɸ backup folder . tar















Comments