Linux Basic Commands


(A) File Handling

• mkdir – make directories
Usage: mkdir [OPTION] DIRECTORY…
eg. mkdir improgrammer
• ls – list directory contents
Usage: ls [OPTION]… [FILE]…
eg. ls, ls l,
ls improgrammer
• cd – changes directories
Usage: cd [DIRECTORY]
eg. cd improgrammer

• pwd print
name of current working directory
Usage: pwd
• vim – Vi Improved, a programmers text editor
Usage: vim [OPTION] [file]…
eg. vim file1.txt

 cp – copy files and directories
eg. cp sample.txt sample_copy.txt
cp sample_copy.txt target_dir
• mv – move (rename) files
eg. mv source.txt target_dir
mv old.txt new.txt

• rm remove
files or directories
Usage: rm [OPTION]… FILE…
eg. rm file1.txt , rm rf
• find – search for files in a directory hierarchy
Usage: find [OPTION] [path] [pattern]
eg. find file1.txt, find name
• history – prints recently used commands
Usage: history

(B) Text Processing

• cat – concatenate files and print on the standard output
Usage: cat [OPTION] [FILE]…
eg. cat file1.txt file2.txt
cat n
• echo – display a line of text
Usage: echo [OPTION] [string] …
eg. echo I love India
echo $HOME

• grep print
lines matching a pattern
Usage: grep [OPTION] PATTERN [FILE]…
eg. grep i
apple sample.txt
• wc print
the number of newlines, words, and bytes in files
Usage: wc [OPTION]… [FILE]…
eg. wc file1.txt
wc L

• sort – sort lines of text files
Usage: sort [OPTION]… [FILE]…
eg. sort file1.txt
sort r

(C) System Administration

• chmod – change file access permissions
Usage: chmod [OPTION] [MODE] [FILE]
eg. chmod 744
• chown – change file owner and group
Usage: chown [OPTION]… OWNER[:[GROUP]] FILE…
eg. chown remo myfile.txt

• su – change user ID or become superuser
Usage: su [OPTION] [LOGIN]
eg. su remo, su
• passwd – update a user’s authentication tokens(s)
Usage: passwd [OPTION]
eg. passwd
• who – show who is logged on
Usage: who [OPTION]
eg. who , who b, who q

(D) Process Management

• ps – report a snapshot of the current processes
Usage: ps [OPTION]
eg. ps, ps el
• kill – to kill a process(using signal mechanism)
Usage: kill [OPTION] pid
eg. kill 92275

(E) Archival

• tar – to archive a file
eg. tar cvf/home/archive.tar /home/original
tar xvf/home/archive.tar
• zip – package and compress (archive) files
eg. zip original
• unzip – list, test and extract compressed files in a ZIP archive
Usage: unzip filename
eg. unzip

(F) Network

ssh – SSH client (remote login program)
“ssh is a program for logging into a remote machine and for
executing commands on a remote machine”
Usage: ssh [options] [user]@hostname
eg. ssh -X guest@
• scp – secure copy (remote file copy program)
“scp copies files between hosts on a network”
Usage: scp [options] [[user]@host1:file1] [[user]@host2:file2]
eg. scp file1.txt guest@

(G) File Systems

• fdisk – partition manipulator
eg. sudo fdisk l
• mount – mount a file system
Usage: mount t
type device dir
eg. mount /dev/sda5 /media/target
• umount – unmount file systems
Usage: umount [OPTIONS] dir | device…
eg. umount /media/target

• du – estimate file space usage
Usage: du [OPTION]… [FILE]…
eg. du
• df – report filesystem disk space usage
Usage: df [OPTION]… [FILE]…
eg. df
• quota – display disk usage and limits
Usage: quota [OPTION]
eg. quota v

(F) Advanced Commands

• reboot – reboot the system
Usage: reboot [OPTION]
eg. reboot
• poweroff – power off the system
Usage: poweroff [OPTION]
eg. poweroff

• sed stream
editor for filtering and transforming text
Usage: sed [OPTION] [inputfile]…
eg. sed ‘s/love/hate/g’ loveletter.txt
• awk pattern
scanning and processing language
eg. awk F:’{ print $1 }’ sample_awk.txt

• find search
for files in a directory hierarchy
Usage: find [OPTION] [path] [pattern]
eg. find name
• locate – find or locate a file
Usage: locate [OPTION]… FILE…
eg. locate file1.txt

Leave a Reply

Order Form for 10GB in RS.6,500/Yearly


This will close in 0 seconds

Quick Order Form

    Contact Number

    This will close in 0 seconds