Home Classroom Linux Basics Linux Basics Part 2

Linux Basics Part 2


Say Hello to Linux

After the introduction on the February issue, today we are ready to start out Linux Basics series. First let me apologize for the absence from the March issue. I hope that break however gave you enough time to install or get access to a Linux system. While it is not mandatory to have a Linux system while you follow this series, it would be much better if you can try and practice the commands/operations along the way.

What is Linux?

You already know that Linux is an Operating System. I am pretty sure that you already have heard of commercial operating systems such as Microsoft Windows and Apple OS X. You may or may not have heard about classification of operating systems as Server operating systems and Desktop operating systems. While this kind of classifications are usually general and informal, nowadays these limits tend to blur. Anyway, you might be excited to hear that Linux is both a Server and Desktop capable operating systems. For example this article is written on a Laptop running a Linux system and when you see this on diGIT website, it will be hosted on a web server which is also running a Linux system.

As I said in the last article, Linux is probably the operating system running on the largest number of platforms with also a highly diverse set of implementations.

Is Linux a Unix?

Short answer is Yes and No. What is Unix anyway? UNIX was a name given (which later became a trademark) to an operating system developed by Ken Thompson and Denise Ritchie and several others in late 1960s. It was first owned by Thompson’s then employer Bell Labs of AT&T. Later UNIX developed into many different variations with different flavors, in which BSD UNIX (Berkeley Software Distribution by Computer Systems Research Group of the University of California, Berkeley) was one of the most notable. By today there are hundreds of different variants of the Unix family, but the original UNIX isn’t around anymore. In this sense Linux is a member of the Unix family which also includes the likes of FreeBSD, Solaris, OS X, MINIX, etc. However Linux does not have the legitimate right to use the UNIX trademark. This is the most notable reason for not calling Linux a Unix system. In order to avoid confusion the family of operating systems is usually called Unix-like systems. It can be noted that there is no pure descendants of the original UNIX developed and maintained anymore. Most of the existing Unix-like systems have incorporated developments from others. So I deem calling Linux a Unix-like operating system is as perfectly correct as it could be.

What is the latest Linux version? And what is Fedora, Ubuntu, Mint and all these?

So one of your friends gave you the latest version of Ubuntu Linux system which as of this writing is 8.10. You are happy to learn that until you find out that Fedora is already on version 10. This is a point where most new Linux users get confused.

The core part of a Linux system is called the Linux kernel. As of this writing the latest stable kernel version is Most of the Linux distributions such as Fedora, Ubuntu, Debian are shipped with a 2.6.2x series kernels usually a bit older than the latest stable version. For example Debian 5 has kernel version 2.6.26 while my Fedora 10 system currently runs a kernel in the 2.6.27 range.

Kernel version is not the only thing that defines the newness of a system. A lot of Desktop Linux users like to run newer versions of application software they use. For example as of this writing, the latest OpenOffice.org office suite version is 3.0.1 and the latest Firefox web browser version is 3.0.7. While newer versions are usually provided as updates, a lot of people find it convenient to use a Linux distribution which provides newer versions and which keeps updating regularly.

Technically speaking there is no meaning to the term “latest Linux operating system version”. However each and every different Linux distributions have a version number. It should be noted that the version numbering convention is not common to all the distribution. Ubuntu projects number their releases as in year.month syntax (Eg: 6.06, 8.04, 8.10, etc.) while Fedora uses an incremental numbering (Eg: 7, 9, 10, etc.). So you cannot compare Linux distribution by the version number. For example, Ubuntu 8.10 contains more updated software than Fedora 9.

What is this Distro thing anyway?

A Linux distribution, or more commonly spoken as a Distro is a Linux system bundled with other software, tweaks and enhancements usually complete with unique look and feel. Different distributions tends to be different in the approach they take. For example Fedora is usually targeting Desktop/Laptop users. So it usually includes software which are commonly used by desktop users. On the other hand a distribution like Red Hat Enterprise Linux is usually targeted for server environment. So it usually ship with server related software. However this is not to say that you can’t install server software on desktop distros or vice-versa. Unlike in Microsoft Windows and other commercial operating systems, there is no system capability limitation forced upon the user based on the distro you use.

Enough talking, let’s try something

When you boot a Linux system you will pass through different screen before finally presenting you with a login screen. People coming from Windows might be thinking whether there is a way to enable auto login into the system. It is possible, however most Linux distros by default does not allow that due to security concerns.


As any other operating system, Linux can also support many types of authentication systems. The most common type of these is the username/password based authentication.

You will be presented with a screen either with a Graphical User Interface (GUI) or a Command-Line Interface (CLI) in most common cases. It will prompt you for a username and a password. If you installed the system, you might have created the account yourself. If not contact your System Administrator for your login details.

If you are using a CLI to login, first type your username at the prompt and press Enter (Return) key. Then it will prompt for a password. Unlike when keying the username, the password prompt might not show the number of characters entered. This is also a security measure.


Fedora release 10 (Cambridge)
Kernel on an i686 (tty2)

ravana login: gaveen
Last login: Fri Mar 20 08:37:41 on :0
[gaveen@ravana ~]$

If you are using a GUI login to log in you might be greeted with many different graphical login prompts. In most you will have to either do as if it was a CLI login or click on your username if it is already available in a list. Then it will prompt for the password. Key in your password and press Enter (Return) key.

These steps will log you in to a Linux system. If you were using a GUI login screen, then most probably you will be taken to a graphical desktop environment completes with windows, menus, icons and a pointer. We will keep the topic of how to navigate and operate the GUI desktop to another month. From this point onward this issues article will concentrate on how to use a CLI to do simple tasks in your Linux system.

Opening a Terminal

If you used a CLI login prompt, most probably you’ll automatically get to a CLI based environment where you can execute commands. If you are in a GUI based environment you can start a terminal program. Click on the main menu and look for an entry similar to Terminal. For example in a Fedora Linux system, you can start the gnome-terminal program by following this menu path:

Applications –> System Tools –> Terminal

In come systems you can start a terminal program by right clicking on the Desktop and selecting Open Terminal entry. Whatever the case maybe you will get a window (the terminal program) where you can enter commands to execute.

Eg: You might get a terminal with a prompt similar to

[gaveen@ravana ~]$

What the prompt say will be different in your system, but you will most probably get a terminal with a blinking cursor. This is your new friend.

You might be wondering what are the parts displayed in the prompt saying thing like ravana and gaveen. Do not worry about that for now. For the curious, in a Fedora system the prompt is displayed as <code>[username@hostname pwd]$</code> pattern where username is your login username, hostname is the name of the computer and pwd is the current directory. According to that gaveen is the username and ravana is the computer name I’m working in. We will discuss these later, so you do not have to worry.

New Command: ls

One of the most basic commands you’ll learn is ls. It is so simple and yet you will use it many many times than you would care to remember in your life. What is does is list the contents of a directory.

New Term: Directory
Think of a directory as a place where you keep other directories and files. If you have used other operating systems before, you might already know about a similar concept called Folders. If you are more comfortable with calling these things Folders, you are free to do so.

New Convention: Abbreviated Names
Think of ls as a shorten form of the word list. Like ls many Unix/Linux commands are actually shorten forms of more descriptive terms. This convention not only applies for commands for commands (Eg: ls, cp, rm), but also for system directory naming too (Eg: tmp, proc, mnt).

So lets go ahead and execute ls command.

Eg 1:

[gaveen@ravana ~]$ ls
Documents   Pictures    Public    Templates   Videos
Desktop     Download    Music     Projects    Software

Example 1 shows how the ls command lists the contents of my directory. Yours might differ from the above listing. If nothing appears after you run the ls command, that means that there is nothing inside the directory your working on.

Now let us list the contents of a different directory. Let us list the contents of the directory Music.

Eg 2:

[gaveen@ravana ~]$ ls Music
Hindi   Music   Sinhala   Tamil   Western

Example 2 shows that when when we run the ls command for Music directory it shows us the content of that as Hindi, Music, Sinhala, Tamil, Western.

Now what if you want to list contents of more than one directory.

Eg 3:

[gaveen@ravana ~]$ ls Music Software
Hindi  Music  Sinhala  Tamil  Western

Setups  Sources

Example 3 show how to list the contents of directories Music and Software. As you can see, contents are listed separately.

If you follow this patter you can list more than two directories. All the parameters you pass in this manner to the ls command will be considered a directory (or a file) and will be listed. Let me leave that exercise for you to try out.

As you have seen, the ls command does the simple task of listing the contents of a directory. All you have seen so far is simple listings. It’s not all. The ls command can do more things. Let us try something then.

Eg 4:

[gaveen@ravana ~]$ ls -l Software
total 8
drwxrwxr-x 41 gaveen gaveen 4096 2009-03-18 23:40 Setups
drwxrwxr-x 33 gaveen gaveen 4096 2009-03-19 23:52 Sources

Example 4 will give a more detailed listing of the directory Software. The “-l” option (think of it as shorten for long) is responsible for that. The letters given with a “-” (hyphen) after the command are the options of the command. There are many more options for ls command as well as for most of other Linux commands. We shall discuss them on our way. Another thing to notice is options can be combined to get desired results.

Lets get the option “-h” (human friendly formatting) can be used along with the “-l” option to get a long list which is formatted more human friendly. Which means the sizes will be display in kilobytes (kB), megabytes (MB) and gigabytes (GB). See Example 5.

Eg 5:

[gaveen@ravana ~]$ ls -lh Software
total 8.0K
drwxrwxr-x 41 gaveen gaveen 4.0K 2009-03-18 23:40 Setups
drwxrwxr-x 33 gaveen gaveen 4.0K 2009-03-19 23:52 Sources

New Command: pwd

When you work in a Linux system you are bound to traverse through many directories and file systems. It is easy to get lost. How would you find your current location? How would you know in which directory you are working in? The answer is the pwd command. Think of it was an abbreviation of “Present Working Directory”. The pwd command will tell where you are.


[gaveen@ravana ~]$ pwd

The example shows you that pwd command produces the output of the current working directory. No matter where ever you are in your system, the pwd command will tell you where you are.

New Command: cd

Now that you know how to list the contents using the ls command, and to check your working directory using pwd command, you must be wondering how to go to other directories in your computer. To achieve this we use the cd command. Think of it as an abbreviation of “Change Directory”. The syntax is simple. First you type cd and then after a space the destination directory.

Eg 1:

[gaveen@ravana ~]$ pwd
[gaveen@ravana ~]$ cd Music
[gaveen@ravana Music]$ pwd

In example 1 you can see that we used the cd command to change into the Music directory and used the previously learned pwd command to confirm out location. The first pwd command is given to confirm that we were not in the Music directory in the first place.

Next Month

If you read the article carefully you might me wondering why the working directory is list as <code>/home/gaveen/Music</code> when we changed into the directory named “Music”. The reason is because it is the actual location of the “Music” directory. Which means that the directory “Music” is in a directory named “gaveen”, which in turn is in a directory named “home”. It might get a little confusing if I try to explain where that “home” directory is. That’s why we leave to to the next month.

In the next diGIT issue we will discuss the Linux file system hierarchy. After that you will be able to find your way inside any Linux system. Meanwhile try to get your hands on a Linux system and try different things. Read more about Linux online and try to practice what you learn. Until we meet again in the next month have a good time, welcome the summer and have a happy Sinhala and Tamil new year!



Gaveen is a Linux System Administrator with several years of industry experience and is a strong FOSS promoter. He is pending graduation from University of Wolverhampton and also holds a certification from Red Hat. He also conducts Linux trainings with Red Hat training partners. Being highly enthusiastic about computing, he supports a keen interest in Ruby programming too. When not distracted by his wide range of interests including reading, music, cricket, etc.,he regularly blogs at Gaveen's Blog


Leave a Reply