DevOps Day#2

Listing of basic Linux commands :

Listing commands:

  • List the sub directories and files avaiable in the present directory

      ls option_flag arguments
    

Examples:

  • List the files and directories in long list format with extra information

      ls -l
    
  • List all including hidden files and directory

      ls -a
    
  • List all the files having .sh extension.

      ls *.sh
    
  • List the files and directories with index numbers inodes

      ls -i
    
  • List only directories.(we can also specify a pattern)

      ls -d */
    

Directoy commands

  • Print work directory. Gives the present working directory.

      pwd
    
  • Change directory to the provided path

      cd path to directory
      cd devops ("devops" directory name)
    
  • Change directory to the home directory

      cd ~ or just cd
    
  • Go to the last working directory.

      cd -
    
  • Change directory to one step back.

      cd ..
    
  • Change directory to 2 levels back.

      cd ../..
    
  • To make a directory in a specific location

      mkdir directoryName
    

Examples:

mkdir newFolder              # make a new folder 'newFolder'

mkdir .NewFolder              # make a hidden directory (also . before a file to make it hidden)

mkdir A B C D                  #make multiple directories at the same time

mkdir /home/user/Mydirectory   # make a new folder in a specific location

mkdir -p  A/B/C/D              # make a nested directory