Index :
Linux Basic Command Part [1/3]
Linux Basic Command Part [2/3] NEXT >
Linux Basic Command Part [3/3] GO TO... >>
ls: Displays the content of a directory
If no external option is given, it will display the contents of present working directory.
Eg: ls ./abc
ls
ls ~/user
- a : Option to print all files(including hidden files)
- l : Option to give a long of file details.
Eg: ls -a
ls -al
ls -l /
NB: ~ : Denotes the home directory of current user
/ : Denotes the root directory of the Linux System.
Eg: ls /
ls -a ~/
pwd: Prints the current(present) working directory.
cd
Eg: cd ~NB: cd .. will make the terminal to move to the parent directory of present working directory.
cd /
cd . Will make the terminal to move to the current directory itself.
passwd : Changes the password of current user account.
touch
Eg: touch abc.txt
touch ~/abc.txt
nano : A simple text editor
cp
(File will be renamed if file_dest is not a directory).
-r or -R or –recursive : Recursive copy or copy all the subdirectories as well.
Eg: cp ./abc.txt ./dir2/efg.txt
cp -r ./abc ./dir2
mkdir
-p, --parents : Creates intervening parent directories if they do not exist.
mv Cut and paste source file to the destination and rename if dest is not a
directory. mv is used also for renaming a file.
Eg: mv ./abc/sample.txt ./efg
mv ./efg/sample.txt ./efg/sample2.txt
rmdir
rm
-r option can be used to remove directories as well recursively.
-i option can be used to warn before deleting.
command --help : Displays a simple help page for a command.
man
info
whatis
Eg: whatis ls
apropos
Eg: apropos editor
time : Displays the current system time.
cal : Displays the calender for the current month.
Eg: cal #Calender for the current month
cal 2 2013 #Calender for February 2103
cal 2012 #Calender for the year 2012
ps : Displays the processes created by the current user.
who : Displays all the users currently logged into the system.
w : Displays all the users currently logged into the system and their resours utilization.
cat : Display the content of a file on to the screen.
wc : Word Count – Counts the number of lines, words and characters in a text file.
Eg: wc sample.txt
which
exit orlogout : Terminates the current session.
Redirecting output of a command to file:
Eg: ls -al > new.txt
Typing two or more commands in a single line:
Eg: ls -al ; mkdir abc
Comments given after commands:
Eg: ls -al #Long listing of pwd contents.
echo “
Eg: echo “Hello World
Go To
Linux Basic Command Part [1/3]
Linux Basic Command Part [2/3] NEXT >
Linux Basic Command Part [3/3] GO TO... >>