Things Every New Linux User Should Know
Easing into using a Linux distro
Many users who switch to Linux from Windows™ in search of a free alternative are disheartened to see that things Linux does things differently. A few of them stick to Linux and learn, but most of them declare it difficult and go back to using Windows™. Linux is not really a difficult operating system; It’s just… different. There are a few things that become second nature to a Linux user which seem alien to a new user. I’ve made a list of a few things that I find absolutely necessary for every new user to know.
Bear with the ™ signs. I’m very afraid Microsoft™ will sue me otherwise
1. What is a terminal/ shell/ console?
A shell can be thought of as the equivalent of the Windows™ command prompt, where you type commands to get things done. A terminal, a shell and a console are theoretically and historically different, but as a Linux user you can use these terms interchangeably. Whenever someone tells you to use any of these, start Applications->Accessories->Terminal. It’ll display a prompt like ‘username@hostmachine:~$’ in a nice GUI window. Or try pressing ‘ctrl+alt+F1/F2/F3…/F6′ to switch to one of the six text only virtual consoles and again ‘ctrl+alt+F7/F8/F9′ to switch back your GUI. Each of the screens is a virtual console/terminal with a shell running on it. More than one person can be logged in on the same computer (but different consoles) at the same time and programs can run on these consoles independent of each other. So you could be writing your college assignment on one terminal and downloading updates to your software on the other.The most commonly used shell today is the bash. Almost all distros ship with bash installed as their default shell.
2. Why will I want to use it?
For a Windows™ user it is extremely rare to have to use the command prompt, but in Linux you’ll find the terminal used quite a lot. The terminal is an integral part of any Linux-based OS. Many great Linux applications have only a CLI (think wget, vi, etc.) and almost all the GUI applications too have powerful options that can be used only when opened from the terminal. So get comfortable with the shell. You are going to have to use it a lot.
3. What are root /su/ sudo? Why do I need them?
The ‘root‘ aka the ‘superuser‘ is an account that has all the powers. There is only a single root account for a machine and it is strongly advised not to misuse it. You should login as root only when needed and never in the graphical environment since logging in as root and using a Windows™ OS are equally dangerous.
In Linux, a normal user has access only to his own files, implying that whatever he may try, he cannot destroy the system or harm other user accounts (but he may go ahead and delete his own files :P). But the root account has access to all the accounts and the system files, thus for maintenance you’ll need to be logged in as root. You can do this in three ways
1. Login as root from one of the virtual consoles (remember that logging in as root from the GDM is strongly discouraged).
2. Login as a normal user and use the ‘su’ command to login as root.
3. Login as a normal user and use the ‘sudo’ command to execute a single command.
The first approach is straightforward. Switch to one of the virtual consoles and login as the root. When you complete your task, logout. But the second approach is the most common. Whatever your usual account is, login into that, and when you need to use something that needs administrator privileges, type ‘su’ in a terminal. It’ll ask you for the root password, and after typing in that you can act as the superuser. Logout when you’re done. For both the above approaches, the root password is essential and both allow you to become the root for some time.
However some distributions like Ubuntu find it too risky to hand the root password to the user. ‘What if the user doesn’t understand how strongly we discourage logging in as the root user??’. So they don’t give the root password. Instead they add the first user to a ‘sudoers’ group by default. Any user in the sudoers group can execute single commands as the superuser, but they can never login as root. This is the new default way of root access. A normal user in the sudoers group can execute a command as superuser by prefixing ‘sudo’ to the command. The password is the user’s password itself.
Although Ubuntu adds the first user to the sudoers list, not all distributions do. To add a normal user to the sudoers list, the file you need to edit the file /etc/sudoers. Only the superuser can modify the file. So login as root by one of the first two methods and type ‘visudo’. Add the following code at the end of the file
<username> ALL=(ALL:ALL) ALL' (replace <username> with your own username).
Now you too can use the ‘sudo’ command like any Ubuntu user.
When you use superuser access, just keep one thing in mind ‘With great power, comes great responsibility’
5. What are shell scripts and how do I run them?
A shell script is the Linux equivalent of a batch script, only many times more powerful. A shell script is a normal text file that the shell understands. It usually ending with the extension ‘.sh’. You can read a shell script in any text editor and even modify it.
Most scripts will run by simply double-clicking them in nautilus, but if some script does not run you’ll need to run it in the terminal and check. You can do this by typing ‘./<nameofscript.sh>’. One of the most common errors is ‘Permission denied’ error. To solve this, use one of the methods for root access as mentioned in point 3.
4. How do I install software in Linux?
If you’re reading this, you’ve definitely installed either an RPM (Red Hat, Fedora, OpenSuse, etc.) or a DEB (Debian, Ubuntu, Mint) distro. If not, then you really amaze me (read this if you have seriously installed Gentoo, Arch or some very obscure one).
Downloading and installing software in Linux is extremely easy. Although not apparent to a Windows™ user, it is one of the easiest thing you’d ever have done on a computer. Windows™ users are used to searching on the internet for a software, downloading .exe file from the internet, double clicking it and clicking next.. next.. next.. till the finish button appears. In Linux, however, the process of searching, downloading and installing software has been integrated. There are huge repositories of packages (softwares) stored on the internet that a user can search, download, and install from all integrated into one program.
Most distributions provide an easy GUI front-end for package management. If you have one then I’d suggest you stick to it until you’re comfortable using the command line. Note that installing software being a sensitive task, requires special permission. So the program will ask for password. Refer point 3
I’m listing the guides to using them. Choose the one that applies
sudo aptitude install (if you know what you want)
sudo aptitude remove (if you know what you don’t want)
sudo aptitude purge (if you know what you never want to see on your system again)
GUI: Add/Remove Software
Command Line: Yum
Same as Ubuntu
Command Line: Zypper
Same as Ubuntu
Other ways of installing software
However, unknowingly sometimes new users download binary packages (files with .deb or .rpm extensions) like they would download their Windows™ software. Unless you’re using a minimal install, your version of distro should be able to download the dependencies and install these packages successfully (double-click them). However, this method is not preferred, since the package could be from an untrusted source, or even outdated. So, always prefer the version in the official repository and don’t download directly from the internet unless inevitable.
From Tarballs (.tar.gz)
Sometimes newbies also download tar balls (.tar.gz) from the internet for installing. (I did not know there existed another way to install software for longer than I’m proud of :P) These are compressed sources that can be installed on any distro. This is definitely the most powerful/most difficult way to install a piece of software. The only reason for downloading them should be because the version of software you want is not available for your distribution or because you want to understand the code and probably edit it (smells kinda advanced).
First of all, you need to extract the folder somewhere. You could do it using a GUI archiver like file-roller (open the file by double clicking) and then start the terminal for the rest of the process or extract from the terminal itself like this
Next, cd to the directory
There usually is an INSTALL, or README file in the folder. Read it by
(You could even read it in gedit)
The instructions in that file will override any instructions that are to follow here. These instructions are the general ones that work in most of the cases.
Run the configuration shell script. It might tell you to choose options of installation.
Read the output. If it fails then try to resolve the problems (usually involves missing devel packages and library packages)
Run it again and repeat until the script does not return any errors
Once the configuration is successful, call the GNU make utility
This will compile the source code.
Now finally install the software
5. Why can’t I play mp3 and Flash??
That’s because these have not been licensed under GPL, so some Linux distros cannot distribute them freely. But all distros offer support for free codecs like Ogg/Vorbis. However, it’s very easy to install the required codecs for mp3 and flash too.
If you try playing an mp3 file, the player should automatically download and install the required codecs for you, but if it doesn’t, then you need to install the package called gstreamer-plugins-ugly. It is easily available in the repositories. This will add support for mp3 and most other audio formats also.
For Flash, you’ll need to install the package flashplugin-nonfree from the repository or download the latest binary from the internet and install.
6. What are the shell commands I’ll need to use often?
Googling for basic shell commands will give you some great sites that cover many day-to-day commands. So do that. Here I’m listing for you only those commands which I feel are very important and don’t have any easy GUI alternative.
man command (MANual page): This is probably the most important command for any new Linux user as he can understand any other command if he knows how to use this one. To read the documentation about any command, type man followed by the command. To scroll down, press Enter (Return). Press ‘q’ to quit.
cd folderpath(Change Directory): To change to that folder.
ls (List fileS): Type ‘ls’ to get the names of all the files/folders in the directory. Different types of files/folders are coloured differently (when possible)
mkdir foldername(MaKe DIRectory): To create a new folder inside the current folder.
rm filename (ReMove): To remove a file from your harddisk. (You can of course do this in nautilus too)
rm -r folderpath (ReMove Recursively): To delete a folder and all the files in it recursively.
mount (list MOUNTed filesystems): To get the list of all the partitions that have already been mounted.
mount partitionname folderpath (MOUNT a filesystem): Here, you supply the partition name and the folderpath where you wish to mount it. The partition name is of the type ‘/dev/sdx’ or ‘/dev/hdx’. Use sdx for modern SCSI drives and hdx for the old drives. Here x is replaced by a, b, c, etc. to refer to the disk number. That means, /dev/sda is the first hard disk, /dev/sdb is the second hard disk, and so on. Further, the partition number is attached to the end. That means, ‘/dev/sdc2’ is the second partition of the third hard disk and ‘/dev/sda4’ is the forth partition of the first hard disk. You can mount a partition only as a superuser. Refer point 3
umount folderpath (UnMOUNT a filesystem): This command unmounts the filesystem mounted by the mount command
nano filename: Nano is a simple and very capable text editor that runs in the terminal. It should help you if ever your GUI fails you.
This should do for now. If you know these things, switching to Linux becomes pretty straightforward.
Happy Tuxing! 🙂
- How to mount a windows partition on Linux automatically on each start up (computerandu.wordpress.com)