Friday, September 25, 2020

I.List Commands :


ls : List of file and directories presente in the current working directory.

ls <path> : dIsplay the files directories in the given path.

Ls –a : display all the files and directories including hidden files and directories

// Note : Any file or directory name atart with  ‘.’ Get the hidden property (it is useful to disable the primary visibility)

Ls –l (or) ll : Display the long list information.

Ls –s : Size in blocks

Ls –r : Display the list in filenames decending order.

Ls –t : Display the files in modification date order (recent – old).

Ls –t –r : Display files in modification date order (old – recent).

Ls –i : Display the Inode no

Ls –l filename : Display the properties of the given file.

Ls –l directory : Display the properties of all the file and directories in the given directory.

Ls –l –d filename/directoryname : Display the properties of given file or directory

Stat filename/directoryname : Detailed information of the given file or directory.

File file/directoryname : Type of the content present in the given file.

Tree directory : Given directory structure in a moderate view.

Tree –d directory : Given directory structure with only directories.

I.                     Wildcard Characters :

space : Useful to provide the multiple files as List

ls –l –d <filename> Desktop.

? : Represent single wild card Character

                        *: Represents multiple wild card characters

                       Ex : Display the list of files start with ab

                                Ls –ld ab*

Ques: Display the list of file having second character as a?

Ls –ld ?a*

a-z / A-Z / 0-9 : Represents the range

Ex : Display the list of files start with m or n or p or q

Ls –ld m* n* p* q* / ls –ld [m-q]*

Du <directoryname> : Total memory usage of the directory

Du –s <directoryname> : Display the summarised size

Du –s –h : Display the size in human readable format (KB/MB/GB).

Dc :Desktop calculator

12 23 + p    ->  // 35

P -> prints the output

Q -> quit.

 

Bc : Bench calculator

12+23

Q -> close.

; -> useful to execute multiple commands at a time

Date; cal; who

Printf “text” : Display the text on the screen

\n \t : use to print the new line and tab space

Printf “Today date is $(command)” : Display the given text along with the given command output.

Ex:

Printf “today date is $(date) and machine name is $(hostname)”

Echo “text” : Display the text on the screen (move to newline)

II.                   Directory commands:

2 types of paths

1.       Absolute path : path start from /.

This path is same to access the same directory from anywhere in the file system.

2.       Relative path :  Path start from current working directory.

This path works only from the current working directory

1.       Change the directory

Mkdir directoryname

Mkdir dir1 dir2 dir3 dir4………

Mkdir “directiryname” / mkdir directory\ name

Mkdir path / directoryname

Mkdir path / {dir1,dir2,dir3, . . .}

Mkdir –p path : create the given path

2.       Change the directory :

Cd path : change to given directory path

Cd . . : move to parent directory of the current working directory

Cd - : move to previous working directory

Cd    : move to user login directory.

3.       Move and rename :

Mv srcdirname dstdirname

Mv dir1 dir2 dir3 dir4 dir5 . . .

Case 1 : Destination directory does not exist (rename)

Rename the source directory with the destination directory.

Case 2 : Destination directory Exists (cut and paste)

Move the source directory with the destination directory

4.       Copy the directory

Cp –r srcdirname dstdirname

Cp –r dir1 dir2 dir3 …

Case 1 : Destination directory does not exist

Create the copy of the source directory with the name of destination directory

Case 2 : Destination directory Exists

Create another copy of source in destination directory.

5.       Remove the directory

Rmdir dir1 dir2 dir3 . . .

Note : It can delete only empty directories

Rm –r –f dir1 dir2 dir3 . . .

2 comments:


  1. Thanks for helping us understand this topic. you have written it in a way that makes it
    very simple to understand. Thanks you so much.

    click here

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete