Our blog pages are comprised with easy learning of IT Technology in Cisco Firewall Linux Microsoft AWS Cloud Azure Cloud and Etc.., We are posting our articles through our Blogs for Cisco Firewall Linux Microsoft AWS Cloud Azure Cloud
working with directories
Brief overview of the most common commands to work with directories: pwd, cd, ls, mkdir, rmdir, cp and mv. These commands are available on any Linux (or Unix) system.
1) pwd
Open a command line interface (also called a terminal, console or xterm) and type pwd. The tool displays name of current/working directory
2) Mkdir
mkdir - make directories. Create the DIRECTORY(ies), if they do not already exist.
a) mkdir students ( create a directory students if it is not already exists)
b) mkdir one two three ( create multiple directory under current working directory)
c) mkdir -p x/y/z ( Create parent directories as needed. It create x inside working directoy and y inside directory x and z inside directory y)
3) tree
tree - list contents of directories in a tree-like format.
4) ls
ls - list directory contents
Usage : ls options filename/directoryname
Main options:
l – long list
a – including hidden files / directories
r -- reverse order while sorting
d -- list directories themselves, not their contents
h – list files / directories with human readable size
5) cd
Used to change current working directory. Only for directory not for files.
Usage: cd options directoryname
cd directoryname / directoyname with path (To change current working directory.)
cd .. (To change into parent directoy or to change one directory up )
cd .. /.. (To change two directory up)
cd ~ (To change into users home directory)
cd / ( To move to “/” )
cd /root/students (To change into students directory)
6)rmdir (or) rm -rf
rmdir -- To remove empty directory
rm -rf – (option r – recursive , -f force) To remove directory and everything inside the directory
7) cp
Used to copy files and directories
cp [OPTION] SOURCE DEST
cp filename dest. diretory / with path
cp -r directory dest. Directory / with path
8)mv
Used to move and rename a file and directory
mv SOURCE DEST.
To move file or directory
mv file/directory destination directory
To rename file or directory
mv file/directory newfilename/newdirectoryname