Linux-Working with directories

To print working directory

pwd

To change directory

To return to home directory

cd

To change into specified directory name

cd <directory name>

To change to home or other path relative to home

// ~ is an alias for your home directory
cd ~

To move up one directory

cd ..

To return to previous directory

cd -

To list all files in the current directory

To list all files in the current directory, in column format

ls

To list the files in the specified directory

ls <directory name>

To list files in “long” format, 1 file per line with additional information

ls -l

To list all files, including “hidden” files

ls -a

To show the directory’s detailed information

ls -ld <directory name>

To list all files whose names begin with the letter “d” in the /usr/bin directory

ls /usr/bin/d*

To list files based on their size

ls -sh

To create a directory

mkdir <directory name>
    eg: mkdir dhan
mkdir -p <directory path>
    eg: mkdir -p /home/sng/dhan

To create directories in multiple paths

mkdir -p parent/{child1,child2,child3}
    eg: mkdir -p work/{in,out,pending}/{a,b,c}

To delete a directory

rmdir <directory name>
    eg: rmdir /tmp/myfiles/