Professional Documents
Culture Documents
Linux distributions support various GUIs (graphical user interfaces) but the old
command line interface (bash) still proves to be easier and quicker in some
situations. Bash and other Linux shells (http://www.hongkiat.com/blog/basic-shell-
commands-for-bloggers/) require you to type in commands to complete your tasks,
and thus gets named the command line (http://www.hongkiat.com/blog/plain-
english-terminal-commands-betty/) interface.
Commands are directives for the computer to carry out a task. You can use
commands to shut down your computer, or show a list of files in the current
directory or the contents of a text file, or to show a message on the screen. They’re
easy and powerful at the same time.
If you are new to this and have always wanted to try it out, we’ve compiled a list of
various basic Linux commands that you can learn and use for various tasks in
several Linux distros (http://www.hongkiat.com/blog/elementary-os-luna/). The list
is not exhaustive but it should make for a good start for beginners or intermediate
Linux users or administrators.
ls – List
ls lists the contents (files and folders) of the current working directory. It’s the
same as you opening a folder in file explorer to see its contents in GUI.
cd – Change Directory
cd <directory> sets the given folder (or directory) as the current working directory
for the current running session of the terminal (or bash). It’s the same as you
opening a directory to do some operations using file explorer in GUI.
cp – Copy
cp <source‐file> <destination‐file> copies the file or folder from one location to
another location. You can use its cp ‐r <source‐folder> <destination‐folder>
option to copy folders recursively.
mv – MoVe
mv <source> <destination> moves a file or folder from one location to another
location. It can also act to rename the file or folder if the file or folder is in the
current working directory but the file or folder has a new name.
cat – concatenate and print files
cat <file> concatenates and prints files on the standard output (i.e., the monitor
or computer’s screen). It’s the same as you viewing contents of text files using text
viewer or editor in GUI.
Find
This command searches for files matching specified criteria in the given location.
You can use find <folder‐to‐search> ‐name <file‐name> its ‘-name’ option to
make a case sensitive search and find <folder‐to‐search> ‐iname <file‐name> to
make a case-insensitive search for files with the given file names.
1 find <folder‐to‐search> ‐iname <file‐name>
tar
This command creates, views and extracts tar archives. You can use tar ‐cvf
<archive‐name.tar> <file1‐OR‐file2‐OR‐both‐to‐archive> to create, tar ‐tvf
<archive‐to‐view.tar> to view and tar ‐xvf <archive‐to‐extract.tar> to extract
tar archives.
gzip
gzip <filename> creates and extracts gzip archives. You can use its gzip ‐d
<filename> to extract gzip archives.
unzip
unzip <archive‐to‐extract.zip> unzips a given zip archive. You can use unzip ‐l
<archive‐to‐extract.zip> to view the contents of the zip file without extracting it.
It’s the same as you using an archive program to extract zip archives in GUI.
help
<command‐name> ‐‐help lists all the available commands in the terminal. You can
use ‘-h’ or ‘–help’ (help has two hyphens here) option with any command to get
help for that specific command.
whatis – What is this command
whatis <command‐name> shows a single-line description for the given command.
man – Manual
man <command‐name> shows the manual page for the given command.
exit
exit ends the current terminal (bash) session. It’s the same as you clicking on the
close button in the title bar of any application to close that application in GUI.
ping
ping <remote‐host‐address> pings a remote host (server) by sending ping packets.
It can be used to check for network connectivity or the status (up and running or
otherwise) of a server. It’s the same as you pinging a host using the network
manager in GUI.
who – Who Is logged in
who shows the list of currently logged in users.
(http://www.hongkiat.com/blog/free
Should Bookmark (http://www.hongkiat.com/blog/more
Dropbox
iconsetwebsites/) spacedropbox/)
su – Switch User
su <username> switches to a different user. Super user (root) can switch to any
other user in the terminal even without using their password.
(http://www.facebook.com/sharer.php?
u=http%3A%2F%2Fwww.hongkiat.com%2Fblog%2Fbasic-
linux-
commands%2F&t=29%20Linux%20Commands%20You%20Must%20Know)
(http://twitter.com/share?
text=29%20Linux%20Commands%20You%20Must%20Know&url=http%3A%2F%2Fwww.hongkiat.com%2Fblog%2Fbasic-
linux-
commands%2F&via=hongkiat)
uname
(https://plus.google.com/share?
uname shows important information about your system such as kernel name, host
url=http%3A%2F%2Fwww.hongkiat.com%2Fblog%2Fbasic-
linux- kernel release number, processor type and various others. You can use uname
name,
commands%2F&t=29%20Linux%20Commands%20You%20Must%20Know)
‐a to view all information.
Popular In Hongkiat
df – Disk space Free
df shows information about the file system’s disk space usages – used and 10 Interesting Talks
Designers Must
available storage space on your hard disk and other storage devices. You can use df Watch
(http://www.hongkiat.com/blog/must
(http://www.hongkiat.com/b
‐h to view the space usages in human readable form (i.e. memory in GBs).
watchtalks
designers/)
watchtalks
designers/)
Web Design
(/Blog/Category/Design)
9 Coolest Kids That
Will Definitely Inspire
You!
(http://www.hongkiat.com/blog/coolest
(http://www.hongkiat.com/b
kidsthat
inspire/)
kidsthatinspire/)
People
(/Blog/Category/People)
404 Not Found & 9
Most Common HTTP
Errors Explained
(http://www.hongkiat.com/blog/common
(http://www.hongkiat.com/b
httperrors/)
httperrors/)
ps – ProcesseS Hosting
(/Blog/Category/Hosting)
ps displays information about the running processes of the system.
20 Free VPN Services
– Best of
(http://www.hongkiat.com/b
(http://www.hongkiat.com/b
(http://www.hongkiat.com/blog/free
virtualprivate
virtualprivate
networks/)
networks/)
Internet
(/Blog/Category/Internet)
How to Manage Gen
X, Y and Z in the
Workplace
(http://www.hongkiat.com/blog/gen
[Infographic]
xyz
workplace/)
(http://www.hongkiat.com/b
xyzworkplace/)
Office
(/Blog/Category/Office)
8 Ways to Get More
Free Space on
Dropbox
(http://www.hongkiat.com/blog/more
(http://www.hongkiat.com/b
space
dropbox/)
spacedropbox/)
Desktop
(/Blog/Category/Desktop)
15 Fun Games for the
Bored Designer
(http://www.hongkiat.com/b
(http://www.hongkiat.com/blog/games
totestdesignskills/)
totestdesign
Desktop
skills/)
(/Blog/Category/Desktop)
Google Polymer –
How It’ll Change the
Way Web Apps are
(http://www.hongkiat.com/blog/google
Built
polymer/)
(http://www.hongkiat.com/b
polymer/)
Toolkit
shutdown (/Blog/Category/Toolkit)
shutdown shuts down your computer. You can use shutdown ‐r to restart your
computer. 12 YouTube Tricks
You Probably Didn’t
Know
Did you use or practice some of these commands? Do you know any other useful (http://www.hongkiat.com/blog/youtube
(http://www.hongkiat.com/b
tipstricks
Linux command for beginners? Kindly let us know using the comments section. 2015/)
tipstricks2015/)
Social Media
(/Blog/Category/Social-
Media)
Now Read:
9 Linux Commands & Codes to be Wary of
(http://www.hongkiat.com/blog/linux-commands-to-avoid/)
15 WordPress Plugins
to Supercharge
Search Function
Search Function
(http://www.hongkiat.com/blog/wordpress
(http://www.hongkiat.com/b
search
plugins/)
searchplugins/)
WordPress
(/Blog/Category/Wordpress)
8 Classroom
Management Apps for
Tech Savvy Teachers
(http://www.hongkiat.com/blog/classroom
(http://www.hongkiat.com/b
management
tools/)
managementtools/)
Desktop
(/Blog/Category/Desktop)
CSS Shorthand vs.
Longhand – When to
Use Which
(http://www.hongkiat.com/blog/css
(http://www.hongkiat.com/b
shorthand
longhand
shorthandlonghand
notations/) notations/)
(http://www.hongkiat.com/blog/linux-commands-to-avoid/) Coding
(/Blog/Category/Coding)
Cornerstone: The
Readers also read: WordPress Page
Builder Web
(http://www.hongkiat.com/blog/cornerstone
Designers Will Love
pagebuilder/)
(http://www.hongkiat.com/b
pagebuilder/)
WordPress
(/Blog/Category/Wordpress)
Read more posts on: linux (http://www.hongkiat.com/blog/tag/linux/) ,
20 Free, Multi
linux commands (http://www.hongkiat.com/blog/tag/linuxcommands/) Purpose Iconsets You
Should Bookmark
(http://www.hongkiat.com/blog/free
(http://www.hongkiat.com/b
iconset
websites/)
iconsetwebsites/)
Icons (/Blog/Category/Free-
Icons)
9 WordPress Plugins
That Use Artificial
Intelligence
(http://www.hongkiat.com/blog/artificial
(http://www.hongkiat.com/b
intelligence
wordpress
intelligence
themes/) wordpressthemes/)
WordPress
(/Blog/Category/Wordpress)
WordPress Theme
Divi 2.4 Gets A
Revamp & New
Revamp & New
3 Comments Hongkiat.com
1 Login (http://www.hongkiat.com/blog/wordpress
Features
themedivi/)
(http://www.hongkiat.com/b
Recommend ⤤ Share Sort by Newest
themedivi/)
WordPress
Join the discussion… (/Blog/Category/Wordpress)