Search Suggest

Linux Basic Command Part [1/3]

Basic BASH Commands:

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 : Changes the working directory to the directory specified.
Eg:  cd ~
cd /
NB: cd .. will make the terminal to move to the parent directory of present working directory.
cd . Will make the terminal to move to the current directory itself.

passwd : Changes the password of current user account.

touch : Creates a new file
Eg: touch abc.txt
touch ~/abc.txt

nano : A simple text editor

cp : Copies a source file to a destination directory with or without renaming
(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 : Creates a new directory.
-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 : Deletes an empty directory.

rm : Removes a file.
-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 : To get the manual page for a command. Press 'q' to exit.

info : To get the info page for a command.

whatis : gives a short description about the command.
Eg: whatis ls

apropos : search the manual page names and descriptions for commands
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 : Displays the actual location of the command / application.

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 “” : Prints a text into console.
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... >>


Đăng nhận xét