They offer different flash templates with latest features.
Login

Forgot password
Register
Back
Written by:
Alexio
Score: 226
votes: 233
Format: Article

 Linux Terminal Command Reference


System Info

date – Show the current date and time
cal – Show this month's calendar
uptime – Show current uptime
w – Display who is online
whoami – Who you are logged in as
finger user – Display information about user
uname -a – Show kernel information
cat /proc/cpuinfo – CPU information
cat /proc/meminfo – Memory information
df -h – Show disk usage
du – Show directory space usage
free – Show memory and swap usage

Keyboard Shortcuts

Enter – Run the command
Up Arrow – Show the previous command
Ctrl + R – Allows you to type a part of the command you're looking for and finds it

Ctrl + Z – Stops the current command, resume with fg in the foreground or bg in the background
Ctrl + C – Halts the current command, cancel the current operation and/or start with a fresh new line
Ctrl + L – Clear the screen

command | less – Allows the scrolling of the bash command window using Shift + Up Arrow and Shift + Down Arrow
!! – Repeats the last command
command  !$ – Repeats the last argument of the previous command
Esc + . (a period) – Insert the last argument of the previous command on the fly, which enables you to edit it before executing the command

Ctrl + A – Return to the start of the command you're typing
Ctrl + E – Go to the end of the command you're typing
Ctrl + U – Cut everything before the cursor to a special clipboard, erases the whole line
Ctrl + K – Cut everything after the cursor to a special clipboard
Ctrl + Y – Paste from the special clipboard that Ctrl + U and Ctrl + K save their data to
Ctrl + T – Swap the two characters before the cursor (you can actually use this to transport a character from the left to the right, try it!)
Ctrl + W – Delete the word / argument left of the cursor in the current line

Ctrl + D – Log out of current session, similar to exit

Learn the Commands

apropos subject – List manual pages for subject
man -k keyword – Display man pages containing keyword
man command – Show the manual for command
man -t man | ps2pdf - > man.pdf  – Make a pdf of a manual page
which command – Show full path name of command
time command – See how long a command takes

whereis app – Show possible locations of app
which app – Show which app will be run by default; it shows the full path

Searching

grep pattern files – Search for pattern in files
grep -r pattern dir – Search recursively for pattern in dir
command | grep pattern – Search for pattern in the output of command
locate file – Find all instances of file
find / -name filename – Starting with the root directory, look for the file called filename
find / -name ”*filename*” – Starting with the root directory, look for the file containing the string filename
locate filename – Find a file called filename using the locate command; this assumes you have already used the command updatedb (see next)
updatedb – Create or update the database of files on all file systems attached to the Linux root directory
which filename – Show the subdirectory containing the executable file  called filename
grep TextStringToFind /dir – Starting with the directory called dir, look for and list all files containing TextStringToFind

File Permissions

chmod octal file – Change the permissions of file to octal, which can be found separately for user, group, and world by adding: 4 – read (r), 2 – write (w), 1 – execute (x)
Examples:
chmod 777 – read, write, execute for all
chmod 755 – rwx for owner, rx for group and world
For more options, see man chmod.

File Commands

ls – Directory listing
ls -l – List files in current directory using long format
ls -laC – List all files in current directory in long format and display in columns
ls -F – List files in current directory and indicate the file type
ls -al – Formatted listing with hidden files

cd dir – Change directory to dir
cd – Change to home
mkdir dir – Create a directory dir
pwd – Show current directory

rm name – Remove a file or directory called name
rm -r dir – Delete directory dir
rm -f file – Force remove file
rm -rf dir – Force remove an entire directory dir and all it’s included files and subdirectories (use with extreme caution)

cp file1 file2 – Copy file1 to file2
cp -r dir1 dir2 – Copy dir1 to dir2; create dir2 if it doesn't exist
cp file /home/dirname – Copy the filename called file to the /home/dirname directory

mv file /home/dirname – Move the file called filename to the /home/dirname directory
mv file1 file2 – Rename or move file1 to file2; if file2 is an existing directory, moves file1 into directory file2

ln -s file link – Create symbolic link link to file
touch file – Create or update file
cat > file – Places standard input into file
cat file – Display the file called file

more file – Display the file called file one page at a time, proceed to next page using the spacebar
head file – Output the first 10 lines of file
head -20 file – Display the first 20 lines of the file called file
tail file – Output the last 10 lines of file
tail -20 file – Display the last 20 lines of the file called file
tail -f file – Output the contents of file as it grows, starting with the last 10 lines

Compression

tar cf file.tar files – Create a tar named file.tar containing files
tar xf file.tar – Extract the files from file.tar

tar czf file.tar.gz files – Create a tar with Gzip compression
tar xzf file.tar.gz – Extract a tar using Gzip

tar cjf file.tar.bz2 – Create a tar with Bzip2 compression
tar xjf file.tar.bz2 – Extract a tar using Bzip2

gzip file – Compresses file and renames it to file.gz
gzip -d file.gz – Decompresses file.gz back to file

Printing

/etc/rc.d/init.d/lpd start – Start the print daemon
/etc/rc.d/init.d/lpd stop – Stop the print daemon
/etc/rc.d/init.d/lpd status – Display status of the print daemon
lpq – Display jobs in print queue
lprm – Remove jobs from queue
lpr – Print a file
lpc – Printer control tool
man subject | lpr – Print the manual page called subject as plain text
man -t subject | lpr – Print the manual page called subject as Postscript output
printtool – Start X printer setup interface

Network

ifconfig – List IP addresses for all devices on the local machine
iwconfig – Used to set the parameters of the network interface which are specific to the wireless operation (for example: the frequency)
iwlist – used to display some additional information from a wireless network interface that is not displayed by iwconfig
ping host – Ping host and output results
whois domain – Get whois information for domain
dig domain – Get DNS information for domain
dig -x host – Reverse lookup host
wget file – Download file
wget -c file – Continue a stopped download

SSH

ssh user@host – Connect to host as user
ssh -p port user@host – Connect to host on port port as user
ssh-copy-id user@host – Add your key to host for user to enable a keyed or passwordless login

User Administration

adduser accountname – Create a new user call accountname
passwd accountname – Give accountname a new password
su – Log in as superuser from current login
exit – Stop being superuser and revert to normal user

Process Management

ps – Display your currently active processes
top – Display all running processes
kill pid – Kill process id pid
killall proc – Kill all processes named proc (use with extreme caution)
bg – Lists stopped or background jobs; resume a stopped job in the background
fg – Brings the most recent job to foreground
fg n – Brings job n to the foreground

Installation from source

./configure
make
make install
dpkg -i pkg.deb – install a DEB package (Debian / Ubuntu / Linux Mint)
rpm -Uvh pkg.rpm – install a RPM package (Red Hat / Fedora)

Stopping & Starting

shutdown -h now – Shutdown the system now and do not reboot
halt – Stop all processes - same as above
shutdown -r 5 – Shutdown the system in 5 minutes and reboot
shutdown -r now – Shutdown the system now and reboot
reboot – Stop all processes and then reboot - same as above
startx – Start the X system

Recommended reading:

Cheat-Sheets.org – All cheat sheets, round-ups, quick reference cards, quick reference guides and quick reference sheets in one page. The only one you need.

Tutorial: The best tips & tricks for bash, explained – Linux Tutorial Blog / Quality Linux tutorials without clutter

LinuxCommand.org – Learning the shell, Writing shell scripts, Script library, SuperMan pages, Who, What, Where, Why

LinuxManPages.com – General commands, System calls, Subroutines, Special files, File formats, Games, Macros and conventions, Maintenence commands, Most Popular Man Pages

Linux Man Pages from die.net – Man pages are grouped into sections, to see the full list of Linux man pages for a section, pick one. Or you can browse Linux man pages by name; choose the first letter of the name of the Linux command, function, or file you are interested in.

Linux Newbie Guide: Shorcuts and Commands – Linux essential shortcuts and sanity commands; Common Linux commands - system info; Basic operations, network apps, file (de)compression; Process control; Basic administration commands, accessing drives/partitions; Network administration tools, music-related commands, graphics-related commands.

Sudo Manual Pages – Sudo (su "do") allows a system administrator to delegate authority to give certain users (or groups of users) the ability to run some (or all) commands as root or another user while providing an audit trail of the commands and their arguments. For more information, see the introduction to Sudo. Sudo is free software, distributed under an ISC-style license.


Tags: terminal commands
Created: 3 years ago.
Last edited: 1 month ago.
Read 15824 times.

Comments
1 week ago

screaming-goat
Great info! Also thanks for the Recommended reading section much needed as well! Thanks much!!  
2 weeks ago

Johnfromct
This is very helpful. I love this site. Thanks for all the info.  
1 month ago

Gannet
Very useful. We need something like this aimed specifically at XP refugees. Do you know of one?  
1 month ago

jalberto
Thanks  
1 month ago

Squashfs
Thanks. BM. :)  
1 month ago

Alexio
@breaker - Thank you so much for your suggestions! Just added the "Linux Man Pages from die.net" link to the "Recommended reading".  
1 month ago

Alexio
@fuLLcoLLapse & @breaker - I added the "Sudo Manual Pages" link to the "Recommended reading" section.  
1 month ago

Alexio
@linux_commands & @jfleen - The website LinuxCommand.net is no longer available...  
1 month ago

Alexio
@lib2know - Thank you very much! The commands are now listed in the "Network" section.  
1 month ago

Alexio
@gangmei - Thank you for the correction!  
2 months ago

gangmei
Need correction: cp file /home/dirname – Copy the "file" called "filename" to the /home/dirname directory

Correction: cp file /home/dirname – Copy the filename called "file" to the /home/dirname directory
 
2 months ago

lib2know
Great work!
Important but missing is iwconfig and iwlist in the network section.
 
2 months ago

looh
wish I saw this earlier, thaks a lot  
2 months ago

Logicdude
I need it, very helpful  
3 months ago

Gurwinder
good one sir  
3 months ago

blew10
Great really liked it..  
3 months ago

netopyr
Thanks for this very good work!  
4 months ago

melsevier
I suggested this and was told that it was a stupid, and definitely was not an idea! I am glad to see someone finally created it. This is awesome! Thank You So Much!!!  
5 months ago

Datei
love it !!!  
5 months ago

jfleen
Love this. Thank you so much. Also, thanks to linux_commands for the reference at http://www.linuxcommand.net

Man, I love this community.
 
6 months ago

ericvictor66
Very usefull, thank you!  
7 months ago

Thejan
This is very helpful. Thanks.  
8 months ago

FaizanAnsari
thats really help full most instructors never taught this
 
8 months ago

pogiako12345
Oh man thank you so much for this!  
10 months ago

jahid_0903014
thanks  
10 months ago

mr_turners
Very usefull. For a cheatsheet, about Linux (Mint)  
1 year ago

CodieLM
useful resource, thanks!  
1 year ago

linux_commands
You can find other linux commands in here too, and you can also learn some scripting as well

http://www.linuxcommand.net
 
1 year ago

Thejan
This is very useful and thank you so much. This was a my major problem when I going to work - specially when I going to install software..... Again Thank you very much.  
1 year ago

sujitnag
short and nice.  
1 year ago

ford
very helpful for a beginner  
1 year ago

soconn
this is a great resource!  
1 year ago

Tux909
nice tut  
2 years ago

xud00bux
fantastic for a beginner! Thx  
2 years ago

piyush
thank you
 
2 years ago

Thinker
Nice Guide. Thanks  
2 years ago

roht
very handy.  
2 years ago

dazw2000
Thank you so much for this information, my one major problem is all of the command line switches and if there in upper or lower case and are of the same context/meaning for each of the commands. Also the installation of new applications .deb .sh (compressed tar.bz/bz2 gz) .run.
Ok deb opens with the software center but the rest what a nightmare.
Great tutorial and very helpful
 
2 years ago

konasteph
Thanks for doing this for all of us. This helps to make linux mint a true community effort ..Thanks to this and other tutorials I got to where I am, using LMDE as my platform, and I am no longer looking for this sort of info as much as in the beginning. But that is exactly the point: These tutorials helped me and others to reach this point, where we use LM and its all working for us!!  
2 years ago

arnshahz
hi...

im newbie and slow learner... tq for the tutorial... need to know basic command line and willin to learn...
 
2 years ago

joroxrd
Thank you!  
2 years ago

kututech
Thanks a lot, this very helpful  
2 years ago

davey1986
Thank you, this is very useful!!!  
2 years ago

jerincon
Tks! Very useful reference... to bmrks!  
3 years ago

konasteph
thanks greatly bing search finds this article quickly...respectable.  
3 years ago

sunewbie
Thank you, very useful.  
3 years ago

Anleoje
Thank you :)  
3 years ago

Labby
This will come in handy for sure! Promoted and subscribed.  
3 years ago

WillemUK
Great tutorial for learning terminal commands.
Checking back here when i am stuck or want to try out something.
 
3 years ago

gingembre
Thanks, alexio... May I translate that in french for some users ?  
3 years ago

breaker
Nice list. I have used most of these, and I have to say for the most part, the man pages are the most helpful. Let me suggest a couple others (I use these often);

sudo and gksudo - run something as a superuser (cli and gui)

NOTE: add an ampersand after a command to have it run in the background and return the shell to the user, example "gksudo gedit [filename] &"

history - this gives you a numbered list off all previously typed commands, then to repeat one of the commands just enter !123 or whatever number it is. Goes along with !! and up arrow key...

less [filename] - From man page - less is a program similar to more (1), but which allows backward movement in the file as well as forward movement.Also, less does not have to read the entire input file before starting.

nano - simple text editor in the terminal (easier than vi or emacs)

mount - mount something somewhere, very handy...

dmesg - get system messages, stuff like "dmesg |tail" helps after inserting a usb device such as a flash drive to see what's up with it

nslookup - query Internet name servers interactively

keyboard shortcut to switch terminals - CTRL+ALT+F1 thru F7, F7 is your normal GUI tty7, but in case you need a full-screen terminal you can switch and login to F1, F2, etc

apt version [package] - see the version of an installed package

for df, I suggest "df -h" it makes it more human readable

md5sum - print or check md5sums (man md5sum), also sha1sum, etc.

"sudo fdisk -l" lists the partition tables for all of your devices then exits

chown - change ownership of a file, sometimes helpful

See the new Tron? It was cool how they used whoami and ps axu and stuff.

Remember the TRS-80/DOS command tron? A debugging command it means trace on, troff turns it off.

Get linux man pages in a nice web browser format by visiting http://linux.die.net/man/
 
3 years ago

trollboy
Nice tutorial, but when compiling from source, yo should read the supplied readme file as it is almost but not quite always as simple as configure, make, make install  
3 years ago

DJ_KIM
ok, what would I use to get it to find trackers  
3 years ago

Alexio
@DJ_KIM - You should use the command

sudo avgctl

and not sudo-avgctl.

Anyway, just follow all the steps from the tutorial posted at http://www.ihaveapc.com/2011/07/how-to-install-and-use-avg-antivirus-in-linux-mint-ubuntu/
 
3 years ago

DJ_KIM
I downloaded both the deb and the tar files, because I wasn't sure which one to use, as some programs use tar and others use deb. When I try to install it again, it says already installed and asks if I want to re-install, which I tell it yes.

I also tried it without the dash between sudo and avgctl, and it still told me not found.
 
3 years ago

DJ_KIM
I did the sudo-avgctl in the terminal and it says not found  
3 years ago

Alexio
@DJ_KIM - After installing AVG Anti-Virus Free Edition for Linux (the DEB file is about 93.5 MB), use the Terminal command "sudo avgctl" (without quotes) and reboot your system to ensure that AVG related services (a.k.a. daemons) start properly.

After the system reboot, open the terminal and issue the command "sudo avgupdate" (without quotes) to update the AVG Anti-Virus definition files.

After the update is completed, issue the command "sudo avgscan / -a -H -c" (without quotes) at the terminal to perform a full Anti-Virus scan on your system.

The above command scans all files in your system. The option ‘-a’ instructs the AVG Anti-virus scanner to scan the compressed archive files too. The option ‘-H’ instructs the scanner to use heuristics while scanning. The option ‘-c’ instructs the scanner to scan cookies too.

Reference used: How To Install And Use AVG Antivirus In Linux Mint / Ubuntu
 
3 years ago

DJ_KIM
I have a Linux with Mint on it. I just installed AVG for Linux on it, and now I can't find it. Any suggestions as to where I might be able to find it on the computer? I can find the folder where it was downloaded to, and I can install it and re-install it, but I can't find it to run it. Please help.

Thanks.

Kim (newbie here)
 
3 years ago

LONNIEFUTURE
Thanks this will definatly be handy!  
3 years ago

bustertech
Thanks for writing this. I'm new to linux and have the goal of learning something about this OS everyday. So far, I love it. It's a challenge when all you've ever done is windows. In some ways it's so much easier than windows and in some ways it's driving me insane. I'll get there though. It's so impressive that my old compac evo N610c was trashable as far as windows OS but with linux, it's got new life and will be a viable product for years. I've bought a wireless card and am going to install another stick of 512MB ram to get a gig but it's running at a respectable rate now for the age of the box. Thanks to everyone out there who write tutorials, reply in chat and work on the apps for making linux. It's the most impressive community I've ever found online.  
3 years ago

Alexio
@fuLLcoLLapse - You can read the Sudo Manual Pages.  
3 years ago

fuLLcoLLapse
dude, how about the "sudo" and its sub commands?BTW, thank u for this ref.  
3 years ago

nurtel9
I like this, thx  
3 years ago

nezzbit
thanks big help  
3 years ago

bAPTIST
Thank you  
3 years ago

wanda
Great thanks.  
3 years ago

Firoz_usf
I just want it thanks a lot.  
3 years ago

Tonya
Great tutorial! Thank you so much!  
3 years ago

gileon
Exactly what I was searching for :)!  
3 years ago

gonye
Great summary!  
3 years ago

tirebiter
Way cool! Just enough to keep the average user going without overload.  
3 years ago

Sol_Badguy
Great tutorial!  
3 years ago

hass
very good.  
3 years ago

nicu
Thanks, perfect for a beginner like me.  
3 years ago

mikefreeman
Awesome! Definitely bookmarking this tutorial!  
3 years ago

grim
Amazing tutorial! Helped me a lot, thanks!  
3 years ago

akash211
Very good tutorial  
3 years ago

efthialex
Very Good job! (y)  
3 years ago

zaenal1234
+1  
3 years ago

rituraj
Thanks, very helpful...  
3 years ago

EDDE_E
Nice!!! Exactly what I was looking for. Excellent reference for the terminal.  
3 years ago

itonggant
this is what I need, many thanks...  
3 years ago

Russ
Many THANX, again something useful. GR8  
3 years ago

Ki3rk3gaard
Ur the Man Alexio ! Kool Beenz home skillet !  
3 years ago

m4daredsun
Impressive... I'll keep a printout on my desk.

Thanks Alexio for compiling this list!
 
3 years ago

aiacomp
Thanks, very helpful.  
3 years ago

Edster
I've been looking for this! Thanks Alexio!  
3 years ago

Tony
At my age, the whoami command is very useful.  
3 years ago

Ki3rk3gaard
This is kool beenz just like high school i've got a cheat sheet ! Thanx Lex  
3 years ago

Tony
Very helpful.  
3 years ago

Elisa
Cool :-)  

Other tutorials from Alexio