Useful Basic Terminal Commands On Linux Mint 11
Author: Christian Schmalfeld <c [dot] schmalfeld [at] projektfarm[dot] de>
This tutorial is supposed to show useful terminal commands to people who are new to Linux.
1 Preliminary Note
Terminal commands are powerful tools if they are used correctly, but can cause great damage if you are not completely aware of what you are doing. Before using commands that are new to you, look up the manual page and make sure you have your files saved and backed up.
This tutorial comes without guarantee of any kind.
2 Root User
On Linux Mint there is only one user with administrative rights which is the so called root user. However every system user can log him- or herself in as root to execute commands that need administrative rights to be run. I am going to show some of them in this tutorial, so what you need to do first is to log yourself in as root. Open Terminal and enter
You will then be asked for your password. Type it in (the letters are invisible) and hit Enter. When logged in to root, the font color of the command line will change from green to red. You will need to be extremely cautious performing commands in this mode since you have no restrictions set by the system. Make sure you know exactly what you are doing and have backups of your files made. To quit root status, just type in
Instead of keeping root active the whole session, you can also use it for single actions only by placing sudo in front of the command, e.g. like this:
sudo shutdown -r 16:00
You will also once be asked to type in your password using this method.
3 Software Management
Instead of using package or software manager to manage your software, as always, you can do that by using Terminal. To do that you must be logged in as root user, accomlish that by using the commands from the previous step. I am going to show you how to install and uninstall software by the example of the Stellarium app. After you have logged in to root, use the apt-get command to install the app:
apt-get install stellarium
If you prefer not to be logged in as root, just put a sudo in front of the command:
sudo apt-get install stellarium
Type in your password to perform the command. After you are done with the app, uninstall it by replacing the install option within the command with remove.
apt-get remove stellarium
sudo apt-get remove stellarium
The apt-get command has a lot more options to choose from, which I will not explain here. For more information just open its manual page. To see how, see the end of the tutorial.
4 Useful Process Commands
Former Microsoft Windows users might miss the task-manager structure in Linux, in case any application just won't continue working or some other fatal error appears, but for that case Linux Mint has its own terminal commands. To print a snapshot of running processes, enter
ps -u [username]
and replace [username] with the name of the user you want a snapshot of the processes of. If you want a dynamic view of running processes, use the top command instead:
When using one of the above commands to view the running processes, you should have noticed the number in the first column, titled PID. This is the ID you need when you want to remove one of those processes. Should one them stop working due to misfunction or anything else, you may want to force close the process. The command you use for that is called kill. The most common uses are just the command followed by the PID (replace [PID] with a given four-digit number):
or place a 9 in between kill and the PID parameter to force kill a process. Be careful using this option though since killing important system processes might cause it to crash.
kill 9 [PID]
Please notice that processes do not have the same PID everytime they are run. Always doublecheck if you got the right PID before you actually kill or even force kill a process.
Another useful command is time. Followed by another command, it shows you how much time the command the follows actually needs to be run.
time sudo apt-get install stellarium
To shut down or reboot your system, there is the shutdown command. You can just perform instant shutdowns with it or set a specific time in multiple formats for when to do so. This can be used as sort of a time controller for your computer to automatically power off when you want it to.
shutdown [hh:mm] [message]
[hh:mm] is one of the possible formats to describe a time. View the manual page for more. You can enter a message instead of [message] which will then be shown shortly before shutdown. If you want a reboot after the shutdown, just put a -r option between shutdown and time.
shutdown -r 16:00 Going home after reboot, yay!