We can create Directory in Linux with the use of mkdir command.
mkdir - Make Directory
- To create a directory. Run
mkdir
command
# mkdir dir name
ex- #mkdir d1 D1 is the dir name.
- To create multiple directories
#mkdir d2 d3 d4
- To change a directory from the current directory:-
#cd <dir name>
ex- cd d1
- To recursively created directories:-
#mkdir -p india/blr
- To go back to one directory up:
#cd ..
- To go back directly to a home directory of the current user from any location in the system:
#cd
- Create the hidden file or dir:-
#touch .f1
#mkdir .d5
- To check hidden files #ls -a
To copy file
#cp source destination
#cp f3 f4
#cat f4 - Here you will see f3 content.
To Move file or dir:-
#mv source destination - cut and paste
#mv f1 d1
#mv d1 d2
Rename File or Dir.
#mv oldname newname
#mv f4 newf4
Remove file or Dir.
rmdir remove specified dir (empty)
rmdir -p remove both parent and child dir
rm -rf remove even non-empty files and dir
rm -r remove empty dir
rm -rp removes non-empty dir including parent & subdirectory
-r = remove
-rf = remove forcefully
Using the command line to get help:-
#whatis - one line output
#man - All details about the command
#apropos - all commands in a system that contain a specific keyword
ex- #whatis date
#man touch
SHELL in Linux:-
-The shell is the Linux command line interpreter. It provides an interface between the user and the kernel and executes programs called commands.
-For example, if a user enters ls then the shell executes the ls command.
- Shell types:-
Bourne shell (sh)
c shell (csh)
Korn shell (ksh)
z shell (ssh)
Bourne again shell (BASH).
- To check shell type:
#echo $SHELL
- Command Alias:
#alias dt=date
#alias dir=mkdir
#alias ip=ifconfig