Here I am listing very basic UNIX commands to help out beginners. To open terminal, you can use keyboard shortcut ctrl+alt+t
whoami: display logged in user id
pwd: display present working directory
cd: change working directory
syntax: cd <Destination Directory Path>
Destination directory path can be absolute path or relative path to PWD
Example: if you are in a sub-directory and want to move one step up, you can use
to move two directory upwards, you can use
and so on. If you want to go to root directory no matters which is your present working directory(PWD), you can use
Here ~ defines the root directory.
ls: list content in current directory
To list content of another directory, you can use
ls <directory path>
create directory in working directory
mkdir <directory Name>
Create directory in a path
Example: mkdir /home/Desktop/test-directory
Create directory and sub-directory in one command
mkdir -p example/example2/example3
this will create example directory in working directory and nested sub-directories inside example directory
If you want to delete an empty directory, you can use rmdir command:
rmdir <directory Name>
To delete a directory with content, use rm command
rm -r <directory Name>
Here -r option is used to remove directories and their contents recursively.
If you want to create a file in current directory, you can use touch command:
touch <file Name>
Example: touch file.txt
View content of file
Example: cat file.txt
To copy a file to a destination with same file name, you can use following syntax:
cp <Source File> <DestinationPath>
Example: cp file.txt /home/Desktop
To copy file with a different name, you can provide new-file-name with destination path.
Example: cp file.txt /home/Desktop/new-file-name.txt
Its just like cut-and-paste action. To move a file to a different location, you can use:
mv <source File> <destinationPath>
Example: mv file.txt /home/Desktop
To display disk usage of current directory, you can use du command.
when run du command, you will see space occupied by every file. To get total disk usage in one line, you can use -s option here -s stands for summary. This will show total size in KBs.
Output: 257404 .
To make it more readable format, you can use -h (human readable) option.
du - sh
Output: 252M .
If you want to check disk usage by a directory, you can specify directory path with du command.
du -sh ~/Downloads/
Output: 17G /home/user/Downloads/
whatis: display one-line manual page descriptions
syntax: whatis <command>
man: It shows detailed description or we can say manual page for any command
syntax: man <command Name>
cal: displays a calendar and the date of Easter
Show calendar for specific month and year: cal Month Year
cal 10 2020
To display system’s ip, you can use ifconfig command.