Linux Terminal Command Reference

System Info

date – Show the current date and timecal – Show this month's calendaruptime – Show current uptimew – Display who is onlinewhoami – Who you are logged in asfinger user – Display information about useruname -a – Show kernel informationcat /proc/cpuinfo – CPU informationcat /proc/meminfo – Memory informationdf-h – Show disk usagedu – Show directory space usagefree – Show memory and swap usage

Keyboard Shortcuts

Enter – Run the commandUp Arrow – Show the previous commandCtrl + 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 backgroundCtrl + C – Halts the current command, cancel the current operation and/or start with a fresh new lineCtrl + 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 commandcommand !$ – Repeats the last argument of the previous commandEsc + . (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 typingCtrl + E – Go to the end of the command you're typingCtrl + U – Cut everything before the cursor to a special clipboard, erases the whole lineCtrl + K – Cut everything after the cursor to a special clipboardCtrl + Y – Paste from the special clipboard that Ctrl + U and Ctrl + K save their data toCtrl + 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

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

Searching

grep patternfiles – Search for pattern in filesgrep -r patterndir – Search recursively for pattern in dircommand | grep pattern – Search for pattern in the output of commandlocate file – Find all instances of filefind / -name filename – Starting with the root directory, look for the file called filenamefind / -name ”*filename*” – Starting with the root directory, look for the file containing the string filenamelocate 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 directorywhich filename – Show the subdirectory containing the executable file called filenamegrep TextStringToFind /dir – Starting with the directory called dir, look for and list all files containing TextStringToFind

File Permissions

chmod octalfile – 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 allchmod 755 – rwx for owner, rx for group and world
For more options, see man chmod.

File Commands

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

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

Network

ifconfig – List IP addresses for all devices on the local machineiwconfig – 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 iwconfigping host – Ping host and output resultswhois domain – Get whois information for domaindig domain – Get DNS information for domaindig -x host – Reverse lookup hostwget file – Download filewget -c file – Continue a stopped download

SSH

User Administration

adduser accountname – Create a new user call accountnamepasswd accountname – Give accountname a new passwordsu – Log in as superuser from current loginexit – Stop being superuser and revert to normal user

Installation from source

Stopping & Starting

shutdown -h now – Shutdown the system now and do not reboothalt – Stop all processes - same as aboveshutdown -r 5 – Shutdown the system in 5 minutes and rebootshutdown -r now – Shutdown the system now and rebootreboot – Stop all processes and then reboot - same as abovestartx – 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.

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.

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.

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

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!!

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.

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.

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.

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 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.