Published January 21, 2018 by

Useful Basic Linux Command

Here is some basic Linux command which can help you use more easily day to day Linux system.


Command
Description
ln
Create shortcut
Example:
# ln –s subhash.doc /root/serverkaka/
less
Open or view a plain text file in a viewer. Hit Q for quit
Example:
# less subhash.txt
df
Show amount of free disk space on all attached filesystems.
Example:
# df –h
free
Show amount of free memory.
Example:
# free –mt
‐t: Show totals column
‐g: Show output in gigabytes
‐m: Show output in megabytes
grep
Search through a specified file for a word or phrase. First, specify the word, and then the file to be searched through.
Example:
# grep –i serverkaka subhash.txt
‐i: Ignore upper/lowercase
man
View the manual page for a specified command.
Example:
# man ls
vim
Simple text editor. Hit  Esc +:wq for saving.
Example:
# vim /root/Subhash.txt
locate
Find specified file
Example:
# locate -i subhash.doc
‐i: Ignore upper/lowercase when searching
ls
List files and folders.
Example:
# ls ‐l
‐l: show permissions, ownership etc...
‐a: Show including hidden files
‐h: Show in KB, MB etc...
cd
Change Directory.
Example:
# cd /root/
cp
Copy file or folder
Example:
# cp -r /root/subhash /opt/website/
-r: copy include sub file/folder
pwd
Show present work directory
Example:
# pwd
mv
Move file or folder. Also use for rename files/folders if a new destination is not specified.
Example (moving):
# mv /root/subhash.doc /opt/website/
Example (renaming):
# mv subhash.doc serverkaka.doc
rm
Delete file/folder
Example:
# rm -rf /root/subhash.doc
date
Show system current time and date
Example:
# date
su
Switch another user
Example:
# su subhash