Learning Linux, information and tutorial for newbies (Part 2)

<–PART 1.

This is the continuation of the Learning Linux blog post. Click the link above for Part 1. If you’re coming here directly, you might want to look at that first.

We continue now our discussion of learning Linux and how it’s different from Windows. As I mentioned in the previous post, Linux is very different from Windows. However, understanding and using Linux is not so difficult, as some people might think.

Files and Folders

Linux has a rather strict folder structure. Linux defines a bunch of system folders that serve different purposes. Generally, normal users do not have access to change what is in these folders. All of the user’s documents, downloads, etc. is stored in one folder made especially for that user. There is also no “Program Files” where all the applications are installed in their own folders. It should also be noted that Linux folder’s are case sensitive, i.e. the folder name PROGRAMS is not the same as programs Some of these folders that Linux defines are given below (though not all).


Contains the executable programs available to the users. Most of the important system programs and other basic programs are stored here.


Contains configuration files for various applications.


This is the folder where the user folders are kept. For example, a user named “foo” will have a folder /home/foo where their documents, downloads, etc. are kept. Not that Linux uses a forward slash ( / ) which is different from Windows’ back slash ( \ ) for folder paths. So Windows would have C:\Documents and Settings\Users\foo whereas Linux has /home/foo


Stores temporary files used by the system and it’s programs.


Stores files that change very often.


This is a folder that stores secondary programs, for example programs that a system administrator might have installed that all user’s can use. /usr has folders similar to the overall system so programs can be locally installed to this folder.

/ (the root folder)

Notice that all folders begin with a forward slash. This means that all folders are part of the folder that is called the root folder, and is represented by just the forward slash ( / ) without anything following it.

It should be noted that there may be some differences between the exact structure of the files and folders between the various distros may exist. Also, the list above doesn’t cover a lot of the other folders that you will find in a standard Linux system.

There is one other difference between Windows and Linux, because of which a lot of people consider Linux to be “harder” and “more advanced” than Windows. This is the Linux command line. Linux comes from a tradition of operating systems that didn’t need the GUI to work.

Linux system administrators used the command line interface to execute commands and do everything on their systems. There are several advantages to using the command line over the GUI, like it being more much more lightweight, being able to easily do it remotely, being able to “script” i.e. pre-program actions into the system, etc.

Regardless, using Linux will involved using the command line some time. Most users can get by without touching it most of the time, however, it is a very powerful and important part of any Linux system that cannot be ignored by someone wishing to learn Linux.

The Command Line Interface

The Linux CLI is often referred to as the Terminal or Linux Console or Bash Shell. These are terms for various things but that is not important right now. Linux has some basic commands that it inherits from it’s UNIX roots which are common to all Linux distributions.


Change Directory.

Used to move from one folder to another in the CLI.


cd /home/foo : change to “foo’s” home directory

cd .. : change one level higher.

cd ~ : change to current user’s home directory (~ is a shortcut to that).


List Files

List files in a folder.


ls : list the files in the current folder.

ls /usr : list the files in the /usr folder.


Make a Directory

Make a new folder.


mkdir /home/foo/birthday-videos.


Change password.


This is probably the most used command in Linux. It lets a user execute commands as the “Superuser”. The “superuser” is the administrator user on every Linux system which has full permissions across the system. They can do anything. This will be explained in a section below:


sudo mv birthday-videos /var/www/html/video

Moves the folder birthday-videos to the folder video in the /var/www/html folder. Usually, a normal user does not have write access to that folder, but with the sudo command, a user can execute that command if they are given the proper permission (i.e. to use sudo).


This is an alternative to sudo. It executes the command as if it were executed by the root user themselves. One key difference is that any user can execute su but they have to provide the root password, while a user can only use sudo if they are given that permission, but they only require their own password.


su -c 'passwd' Execute the password command as root, thereby changing the root password.

These commands have a basic, common structure that is followed by most if not all commands. Each command has a certain three parts: the command name, the flags, and the arguments. A standard command may look like this:

<command_name> [flags] [arguments]


The command name is of course, the short name of the command that you execute. Generally these are files found in the /bin, /sbin, /usr/bin and other folders that are part of the PATH variable.


A flag is a mini-command used to modify what the main command does. They usually start with a dash ( – ) followed by a letter or a double-dash ( — ) followed by a longer command name.

For example, the ls command has a -l flag which gives you more information about the files in the folder you specify.


These are the actual inputs you give to an input. For example, in the ls command, the folder name you specify is the command’s argument. Flags can also have their own arguments. For example, the -c in the su command is a flag, and 'passwd' is it’s argument.

You may notice that Linux’s permissions may be a little strict. For example, most of the folders in the / (root) directory cannot be changed by an ordinary user without su or sudo.

This is actually one of the many advantages of Linux. Many, many viruses are deterred because of this strict permissions model, which is why (among other reasons) a Linux virus is so rare, it’s often considered a myth.

Permissions, Groups and chmod

Linux’s permissions can be frustrating at times, however this model has more advantages than one might think.

Linux gives three kinds of permissions to each file or folder: “user”, “group” and “world” (or other).

“User” means the person that owns the file, usually it is the person that created it. “Group” means people who are in the group that owns a file, and “other” means everyone else.

Linux users are divided into groups, and permissions can be set for the “user” of a file and the “group” of a file (which may not be the same). Meaning that a file has a “user” and “group” associated with it. This information can be viewed with ls -l.

Screenshot from 2017-06-16 11-58-13.png
Permissions as shown by ls -l

The ls -l command, among other things shows us which user and group a file belongs to and what the permissions are.

The permissions are visible in the first column as shown in the image. There are three types of permissions that a user, group, or everyone else can have. Read permission (r), write permission ( w ) and execute(x). The first column itself is divided into three columns, one for the user, one for the group and one for “world” i.e. everyone else.

If an entity does not have one of the r, w or x permissions, it is shown as a dash ( – ). For example, for the file a.out, the user can read, write and execute the file (which is why it has “rwx” for the user and so can the group (hence the second rwx). However, all others do not have the write permission and that is why they have “r-x” because the write permission is missing.

These permissions can be modified with the chmod command. The chmod command is part of a set of ch* commands that alter the permissions, users and groups of a file or folder.

For example, if we change the permissions on “a.out” so that the group does not have write and execute permissions, we could do it with the following command:

chmod g-wx a.out

The “g-wx” implies that we subtract the write ( w ) and execute (x) permission from the group (g). If we wanted to add them back in, we would simply do

chmod g+wx a.out

Similarly, we can do the same for users and world permissions with “u” instead of “g” for users and “o” for world / other.

The Linux Permissions model goes far, far deeper and an experienced system administrator can fine tune the permissions much, much further with ACLs, PAM and of course, SELinux, however we shall not cover these here.

On a final note as far as permissions are concerned, users and groups can be changed with the chown command, for example:

chown foo:bar a.out

would set the user for a.out as “foo” and the group for a.out as “bar”.

One should remember that setting a group is important because every user within that group will get the “group” permissions on that file.

Installing Software

One of the reasons that being comfortable with the command line is important, is because that is the best way to install new software. You can use the graphical utilities, like Ubuntu Software Center (for Ubuntu) and “Software” for Fedora but often you may find, it is better to do it from the command line. Linux has a centralized “package manager” which takes care of downloading and installing software. Usually the package manager is a command that is somewhat unique to the different flavours of Linux.

This means that Debian uses the apt command while CentOS (and RedHat) use the yum command. Derivatives of a distro often use the same commands. All derivatives of Debian, for example, use the apt command to install software. This means that Ubuntu, Kali and Linux Mint all use the apt. Fedora, which is also derived from RedHat like CentOS uses the dnf command which is nothing but a better version of yum that CentOS uses.

To install software, you simply need to write the command and say “yes” when prompted. For example, to install a program called htop on Fedora, you need to write:

sudo dnf install htop

And the command will handle all the rest. In contrast, on Debian based OSes, you’ll need to write sudo apt install htop.

Package managers are useful for what is known as Dependency Resolution, meaning simply that they search and download all the necessary files that a program needs. If the file is already installed in the system, it skips that file, which is why often installing a package (software) from a package manager is smaller than it’s windows counterpart.

All of this software is stored on the internet in special servers called “Repositories”. These are files that are cloned and made available by universities, organizations and just good people all across the world. The package manager automatically connects to these repositories and downloads the necessary files. If a file is not in the default repositories, we might need to install them.

For example, to install VLC, we will need to “enable” i.e. install the RPMFusion repository on Fedora (and CentOS). Instructions on how to do that can be found here.

Once we have the RPMFusion repository installed, our package manager can search it to install new software.

Ubuntu has a somewhat unique system that is used to install software that may not be available in any repository. This is the Ubuntu PPA system. PPAs are specific mini-repositories that hold the files necessary for a specific piece of software. However we will not go in depth here. Instead we will cover another important part of installing Linux software: installing from ​.deb or .rpm files.

These are the raw package files for any piece of software. We may need to sometimes install a software that is not open source but does have a Linux version, for example Google Chrome.

To download Google Chrome, we will need to download the .deb or .rpm from the Google Chrome website. Once it is done, we could let the graphical package manager handle it. Or we can use the CLI.

For Debian and Debian based distros (Ubuntu, etc.) we can use

sudo dpkg -i followed by sudo apt-get install -f (apt-get is a slightly older version of apt).

Or for Fedora/CentOS we can use sudo rpm -i . There is a local install option for the dnf and apt commands, for example we can do,

sudo dnf install /path/to/package.rpm if that seems easier.

This concludes our discussion of the absolute basics for a Linux System. There will be a future blog post on how to install Linux onto a Virtual Machine. However, the concepts covered here are vital to use and work on Linux comfortably and not be frustrated by its quirks and differences. Of course this is in no way comprehensive, however, I hope it is enough to get one started and dive into the deeper aspects of Linux.

These are some recommended books to help you get started:

How Linux Works: What every superuser should know.

Linux Bible


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s