Unix Basic Command
Unix Basic Command
Basic Commands
I File and Directory Related commands
1) pwd
This command prints the current working directory
2) ls
This command displays the list of files in the current working directory.
$ls–l Lists the files in the long format
$ls–t Lists in the order of last modification time
$ls–d Lists directory instead of contents
$ls-u Lists in order of last access time
3) cd
This command is used to change from the working directory to any other directory specified.
$cd directoryname
4) cd ..
This command is used to come out of the current working directory.
$cd ..
5) mkdir
This command helps us to make a directory.
$mkdir directoryname
6) rmdir
This command is used to remove a directory specified in the command line. It requires the specified
directory to be empty before removing it.
$rmdir directoryname
7) cat
This command helps us to list the contents of a file we specify.
$cat [option][file]
cat > filename – This is used to create a new file.
cat >>filename – This is used to append the contents of the file
8) cp
This command helps us to create duplicate copies of ordinary files.
$cp source destination
9) mv
This command is used to move files.
$mv source destination
10) ln
This command is to establish an additional filename for the same ordinary file.
$ln firstname secondname
11) rm
This command is used to delete one or more files from the directory.
$rm [option] filename
$rm –i
Asks the user if he wants to delete the file mentioned.
$rm–r
Recursively delete the entire contents of the directory as well as the directory itself.