DOS COMMANDS
1) pwd: Print name of current/working directory
Description: Print the full filename of the current working directory.
syn: pwd
Example :
vishnu@vishnu-HP-Pro-3090-Microtower-PC:~$ pwd
/home/vishnu
2) mkdir - Make directories
Description: IT can create directory or directories, if they don't already exist.
Syn: mkdir [directory]....
Ex 1: vishnu@vishnu-HP-Pro-3090-Microtower-PC:~/Desktop$ mkdir EEE-B
One directory is created with name EEE-B
Ex 2: vishnu@vishnu-HP-Pro-3090-Microtower-PC:~$ mkdir EEE-B CP
Two directories are created with names EEE-B and CP
3) cd – change directory
Description: cd (change directory) is used to change current working directory
sny: cd path
Ex 1: vishnu@vishnu-HP-Pro-3090-Microtower-PC:~$ cd Desktop
vishnu@vishnu-HP-Pro-3090-Microtower-PC:~/Desktop$
Working location is changed to Desktop from home
Ex 2: vishnu@vishnu-HP-Pro-3090-Microtower-PC:~$ cd Desktop/EEE-B
vishnu@vishnu-HP-Pro-3090-Microtower-PC:~/Desktop/EEE-B$
Use forward slash ( / ) to move to the nested directories
vishnu@vishnu-HP-Pro-3090-Microtower-PC:~/Desktop/EEE-B$ pwd
/home/vishnu/Desktop/EEE-B
If you want to move one step backward to the current working directory use cd ..
Ex 3:vishnu@vishnu-HP-Pro-3090-Microtower-PC:~/Desktop/EEE-B$ cd ..
vishnu@vishnu-HP-Pro-3090-Microtower-PC:~/Desktop$ pwd
/home/vishnu/Desktop
if you want to move directly to the home location type cd and press enter.
Ex 4: vishnu@vishnu-HP-Pro-3090-Microtower-PC:~/Desktop/EEE-B$ pwd
/home/vishnu/Desktop/EEE-B
Your current working directory is EEE-B
vishnu@vishnu-HP-Pro-3090-Microtower-PC:~/Desktop/EEE-B$ cd
vishnu@vishnu-HP-Pro-3090-Microtower-PC:~$ pwd
/home/vishnu
After the command executed your current working directory is home.
4) cp: copy files and directories
Description : copy contents from source file to destination file.
Syn: cp [source file] [ destination file]
Before copying the file from source to destination create a file a.txt in EEE-B
Ex 1: vishnu@vishnu-HP-Pro-3090-Microtower-PC:~/Desktop$ cp EEE-B/a.txt CP
The file a.txt is copied into the destination folder CP
if you want to copy a directory use the option -R.
5) mv : move or rename files
Descrption: move or rename source file to destination file.
Syn: mv [source file] [ destination file]
Ex 1: vishnu@vishnu-HP-Pro-3090-Microtower-PC:~/Desktop$ mv EEE-B/a.txt CP
The file a.txt is moved into the destination folder CP
6) rm: remove existing files.
Syn: rm [file]
Ex 1: vishnu@vishnu-HP-Pro-3090-Microtower-PC:~/Desktop$ rm CP/a.txt
It will remove the file a.txt from the directory CP
7) rmdir: Remove empty directories
Description: Remove the directory or directories, if they are empty.
syn: rmdir [directory]...
Ex 1: rmdir CP
the directory is removed because it is empty
Ex 2: vishnu@vishnu-HP-Pro-3090-Microtower-PC:~/Desktop$ rmdir EEE-B
rmdir: failed to remove ‘EEE-B’: Directory not empty
Ex 3: vishnu@vishnu-HP-Pro-3090-Microtower-PC:~/Desktop$ rmdir EEE-B CP
vishnu@vishnu-HP-Pro-3090-Microtower-PC:~/Desktop$
Here both directories are removed at a time
8) man: manual
Description: An interface to the online reference manuals
syn: man [command]
Ex 1: man mkdir
MKDIR(1) User Commands MKDIR(1)
NAME
mkdir - make directories
SYNOPSIS
mkdir [OPTION]... DIRECTORY...
DESCRIPTION
Create the DIRECTORY(ies), if they do not already exist.
Mandatory arguments to long options are mandatory for short options
too.
-m, --mode=MODE
set file mode (as in chmod), not a=rwx - umask
-p, --parents
no error if existing, make parent directories as needed
-v, --verbose
print a message for each created directory
9) cat: concatenate files and print on standard output
syn: cat [option] [file]
Ex 1: cat > a.txt - a.txt file is created.
cat >> a.txt - append the data into a.txt
cat a.txt - display the data in a.txt
cat > b.txt - b.txt file can be created.
cat >> b.txt - append the data into b.txt
cat b.txt - display the data in b.txt
cat >> a.txt b.txt – concatenate the files and stored it in a.txt