Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

linux command syntax

[ak@localhost ~]$
ak=username
localhost=hostname /PCname
~ = user hime directory
$ = user level

hostname == Display Linux Machine Name =====> hostname name

w == Display Logging User Lists

pwd (print working directory) == Display current directory location

$date == Display Date and Time


#date --set="STRING"
#date --set="Tue Dec 1 18:19 2020"
#cal == Display Calander

expr == Calculator

expr no1 + no2

expr no1 \* no2 (x)

expr no1 / no2 (/)

ls == list of file and directoies


#ls and
#ls -l ===> show all information file
#ls -a == Dispaly Hidden File and Directory

===================================================================
File /Folder Directory command
===================
cd == Change Directory
#cd /root
#cd .. (one back directory)
#cd ~

mkdir == Make Directory

#mkdir foldername

rmdir == Remove Directory


#rmdir DirName
#rm -rf folder (include delete sub folder)

* = All Files and Dir


#rm -rf * (All Delete)

#touch == Create a new file


#mv == Move File or Directory
#cp == Copy File and Directory

Run Level
=======
init 0 == Shutdown linux machine
init 6 == Reboot linux machine

ln == Create Link or Create Shortcut

df -h == Dispaly Hard Disk Partition Information


fdisk -l == Display Partition Table
lvmdiskscan == Dispaly Hard Disk Partition Information

#ln -s OriginalDirPath ShortcutDirPath


#ln -s /usr/bin /opt/mybin

top == Display Background Process Information

lsusb == list of usb devices

lsblk == list of block devices or list of storage devices

#mv SourcePath DestinationPath


#mv /opt/Mydir /mydir/Mydir
#cp /opt/Mydir /mydir/Mydir

Note file create/edit


=============
vi == File Editor

#vi filename
Press I = Insert Key
You can type any key....
Press Esc Key
:q == Quit without Saveing
:q! == Force Quit without Saving
:wq == Save and Exit
:wq! == Force Save and Exit

nano == File Editor

#nano filename
cat == Display contents of file with single page
#cat filename

less == Display contents of file with page by page


#less filename
Press q key to exit

grep == Display word

clear == Clear Screen

You might also like