A Beginner's Guide to the Linux Command Line

BoraMurdar

Community Manager
Thread author
Verified
Staff Member
Well-known
Aug 30, 2012
6,598
1. What is a home directory in Linux?
Linux is a multi-user operating system, which means that more than one user can access the OS at the same time. To make things easy, each user is assigned a directory where they can store their personal files. This directory is known as a user's home directory.

Home directories are found under the home directory. For example, my home directory is/home/himanshu. Please note that a user’s home directory has the same name as their login name. If you are a Windows user, you can think of a Linux home directory as a user specific directory usually present inside C:\Documents and Settings or C:\Users.

Users have complete control over their home directory as well as all its sub-directories. This means that they can freely perform operations like create and delete files/directories, install programs, and more, inside their home directory.

2. How to check the present working directory?
Whenever you open a command line shell in Linux, you start at your home directory. This is your present working directory, which changes as you switch to some other directory. Use the pwdcommand to check the complete path of your present working directory at any point of time.

Here is an example:

2014-06-17-image-5.png


The pwd command output, shown in the screenshot above, indicates that the user is currently in thePictures directory, which is inside the himanshu directory, which in turn is a subdirectory of the homedirectory. In this case himanshu@ubuntu:~/Pictures$ is the command line prompt.

3. How to switch directories?
Use the cd command to navigate through the Linux filesystem. This command requires either a directory name or its complete path depending upon where the directory is present.

For example, if your present working directory is /home/himanshu/pictures, and you want to switch to/home/himanshu/pictures/vacations, then you can simply run the command: cd vacations. In this case, the command line shell will search for the vacations directory inside pictures. A path relative to the present working directory is also known as relative path.

But in case you want to switch to /home/techspot, you’ll have to run the command: cd /home/techspot. The complete path, that begins with a forward slash (/), to a directory is also known as its absolute path. To quickly switch to the previous directory in the tree, run: cd .., or if you want to switch to the previous working directory run cd -

4. How to view directory contents?
Use the ls command to list the contents of a directory. If the command is run without any argument, it displays the contents of the present working directory.

Here is an example:

2014-06-17-image-6.png


To view the contents of any other directory, you can either specify its name (if it’s a subdirectory) or its complete path (if it’s not a subdirectory) as an argument to the ls command.

If you observe closely, the output of the ls command is color coded. These different colors represent different types of files, making it easy to visually identify them. Some of the basic colors that you should know are: Blue (Directories), White (Text files), Red (Archives), Cyan (Links), Green(Executables), and Pink (Images).

5. How to view the contents of a file?
Use the cat command to view the contents of a file. This command expects a filename as an argument. As you can see in the screenshot below, the cat command displayed the contents of thearg.c file. However, there is a limitation. If the file is large, the output might be too big for the command line shell screen to accommodate.

2014-06-17-image-7.png


In that case you can use use the less command along with the cat command: cat [filename] | less. The| symbol represents a pipe, which redirects the output of the cat command to the less command, which in turn makes it possible for you to navigate through the file's content using the arrow keys on your keyboard to scroll up and down. To quit the display mode press the q key.

6. How to create a new file?
Use the touch command to create a new file. The command requires a filename as argument. For example, to create a file named test.log in the present working directory, just run the command: touch test.log.

To create a new file at a location other than the present working directory, use the absolute path. For example, touch /home/himanshu/practice/test.log.

Tip: To write anything into a newly created file, use a command line editor like Vi or Vim.

7. How to rename/copy/delete a file?
Use the mv command to rename a file. For example, to rename log.txt to new_log.txt, run the command: mv log.txt new_log.txt. As always, if the file is not present in the present working directory, use the absolute path.

You can also use the mv command to move a file from one location to other. This is the equivalent of a cut-paste operation via GUI. For example, to move log.txt (present in current directory) to/home/himanshu, run the command: mv log.txt /home/himanshu.

To copy a file from one directory to another, use the cp command. Like the mv command, cp also requires a source and a destination. For example, cp log.txt /home/himanshu would create a copy oflog.txt (with the same name) in the /home/himanshu directory.

To remove a file, use the rm command. This command expects a filename as an argument. For example, rm log.txt will remove the text file, if present in the current directory, while rm /home/himanshu/practice/log.txt will remove the text file present inside the practice directory.

To remove directories, use the -r command line option with the rm command. For example, rm -r /home/himanshu/practice/ would delete the practice directory with all its subdirectories and files.

8. How to search for files?
To search for files within a given directory, use the find command. The command requires directory path and filename as argument. For example, to search for a file named inheritance.cpp in the/home/himanshu/ directory, use the find command in the following way:

2014-06-17-image-8.png


I used sudo in the find command above to remove certain permission errors. You can skip it.

If a directory path is not specified, the find command searches in the present working directory.

You can also use wildcards with the find command to get the most out of it. For example, if you want to search all .c files present in the /home/himanshu/practice directory, use the find command as shown below. The '*' character is a wildcard that can represent any number of characters. For example, tech* can represent tech, techspot, techreport, and more.

2014-06-17-image-9.png


9. How to search text within files?
To search text within files, use the grep command. The command expects a keyword and a filename as arguments, and outputs lines that contain the keyword. For example, to search all the lines in the file /home/himanshu/practice/wazi/gdb/test.c that contain the keyword ptr, use the grep command in the following way:

2014-06-17-image-10.png


Use the -n command line option in case you want grep to display line numbers in output.

2014-06-17-image-11.png


Tip: To search a keyword in all the files present in the current directory, use the * wildcard character as the filename.

Please note that unlike the find command, the grep command doesn’t search within subdirectories by default. However, you can enable this functionality by using the -R command line option while running the grep command.

10. What is the auto-complete feature?
While working on the Linux command line, typing long paths, file names, and more can feel like a burden. Use the tab key to auto complete these long names and paths easily. For example, to write/home, you can just write /ho and press tab. The command line shell will auto complete the name for you.

In the example above, it was easy for the shell to guess the name home because there was no other similar candidate in the / directory. But in case the shell encounters similar names while auto completing, it will display those names and you'll have to write a few more letters for the shell to know the correct name.

Here is an example:

2014-06-17-image-12.png


The shell displayed all the names that it can use for auto completion. If, for example, you wanted to write techspot, then you’ll have to type in at least c to resolve the ambiguity. Once done, you can hit the tab key again to autocomplete the name.

11. What is root?
Root is the only user that has control over the entire Linux system. It is capable of doing what normal users can’t, such as, changing ownership of files, adding or removing files from system directories, and more. As you can guess, the root account is mostly used by system administrators only.

The top level directory in a Linux system, represented by forward slash (/), is known as root directory. It is the same directory that contains the home directory, which further contains user specific directories. However, you shouldn’t confuse / with the root user’s home directory, which is located under / by the name of root.

12. What are man pages?
To learn more about Linux commands, you can head over to their respective man (or Manual) pages that come preinstalled with Linux. To open a man page, just run the man command followed by the command name. For example, run man rm to open the manual page of the rm command. You can find a lot of useful information about Linux commands this way.

2014-06-17-image-13.png


13. How to access file metadata like size, permissions, and more?
Use the ls command with -l option to display file metadata in output. For example:

2014-07-04_06-35-12.png


Each line in the output contains metadata information related to a file or a sub-directory present in the current directory. This information can be divided into the following eight parts:

+permissions that apply to the owner
|
| +permissions that apply to all other users
| |
| | +number of hard links
| | |
| | | +file size +last modification date/time
_|_ _|_ | _|___ ________|__
drwxr-xr-x 3 himanshu himanshu 4096 Jul 3 14:26 Desktop
__ ________ ________ ______
| | | |
| | | +name of file/ directory
| | |
| | +group the file belongs to
| |
| +owner of the file
|
+permissions that apply to the members of the group the file belongs to

The first character represents the file type. For example, in the line shown above, d indicates this is a directory. Other values can be: - for normal file, s for socket file, l for link file, and more.

The next 9 characters represent permissions -- r - read, w - write, x- execute. The first set of three characters represents the owner’s permission, the next three are group's permission, and the final three represent permissions granted to others who are neither the owner, nor the part of the group the file belongs to. In the example shown above, the owner has read, write and execute permissions, while the group as well as others both have only read and execute permissions.

Tip: Use the -h command line option along with -l to display file size in human readable format.

14. How to change file permissions?
Use the chmod command to alter file permissions. There are two ways in which this command can be used. The first method, also known as letters method, uses +, -, and = signs to add, remove, and assign permissions. Letters a, o, u, and g represent all, others, owner, and group respectively.

For example, the chmod u=rwx somefile command assigns read, write, and execute permissions to the owner of the file somefile. Similarly, the chmod o+w somefile command adds write permission for others, the chmod g-r somefile removes read permission from the group the file belongs to, and thechmod a+x somefile command adds execute permission for everyone.

Specifying a is not mandatory, which means that setting permissions like +x or -r without specifying owner, group or other automatically applies it to all.

The second method is the numbers method and it uses 4, 2, and 1 instead of r, w, and x. The values are added together in sets of 3 to give us a three digit number denoting permissions.

For example, the chmod 761 somefile command gives rwx, rw, and r permissions to the owner, group, and others, respectively. Here 7 represents the sum of numbers corresponding to r,w, and x. Similarly,6 represents the sum of numbers corresponding to r and w, while 1 represents x.

15. How to change file timestamps?
Use the touch command to change file timestamps. There are three types of timestamps associated with a file: Access time, Modification time, and Change time. While the first two are self explanatory, the third one represents the time when the inode information or the meta data related to file last changed. Use the stat command to display these timestamps:

2014-07-04_07-29-34.png


To change the file access time to the current time, use the touch command with the -a option: touch -a somefile. Similarly, the -m option changes the file modification time to the current time.

To change file timestamps to a time other than the current time, use the -t command line option. For example, the command touch -t 201407020900.01 -a somefile changes the access timestamp ofsomefile to 2014/07/02 09:00:01. You can also pass a specific date and time in human readable form. Use the -d command line option for this. Here are some examples:

touch -d "2013-01-10 10:00:07" -a somefile

touch -d "next sunday" -m somefile

touch -d "3 hours ago" -a somefile

16. How to determine file types?
Use the file command to determine file types. As shown in the example below, the command expects a filename as an argument. You can also use the wildcard * in place of file name to display the file type for every file in the current directory: file *

2014-07-04_07-45-30.png


17. I’ve downloaded an executable file, but it doesn’t execute, why?
In Linux (and other *nix systems) whether a file is executable or not depends solely on its permissions, not on its extension or content. When a file is downloaded, its original permissions are not known, and is hence given a default set of permissions that are determined by umask.

If the user really intends to execute the downloaded file, they’ll have to explicitly give executable permissions to it using the chmod command explained above. Giving permissions manually also helps prevent virus, worms, and more from infecting your system without your knowledge.

18. How to print the number of new lines, words, and bytes in files?
Use the wc command to print newline, word, and byte counts for a file. Here is an example:

2014-07-04_07-52-37.png


In the output shown above, 5 represents the number of lines, 12 represents the number of words, and52 represents the number of bytes. You can also use the -l, -w, and -c command line options to separately produce number of lines, words, and bytes, respectively in the output.

19. How to display disk usage of files and directories?
Use the du command to display disk usage of files and directories. Here is an example:

2014-07-04_07-56-49.png


Note - The -h command line option is used to produce the size in human readable format.

An important thing to note here is that the du command outputs the resident size of a file, which could be different from the actual size that the ls -l command displays. The reason behind this difference is either slack space or sparse files.

To display the combined size of a directory as well as all its subdirectories, use the -s option, while -Scan be used to display separate sizes. To display the amount of disk space available on the file system containing a specific file or directory use the df command.

2014-07-04_08-02-54.png


Here again, the -h option is used to display the output in human readable format. If the df command is run without any file/directory name, it'll show disk usage for all the file systems.

2014-07-04_08-03-27.png


20. How to compare two files?
Use the diff command to compare two files. The command examines both the files and produces the output in a particular format to let you know what changes are required for the files to match. The command requires two filenames as arguments, as shown in the example below.

2014-07-04_08-11-41.png


Use the diff command to compare these files:

2014-07-04_08-12-27.png


Decrypting the output shown above, 5c5 means that the fifth line of somefile is changed, and should be replaced by the fifth line of the file anotherfile. The line in question from the first file is marked with a< symbol, while line from the second file is marked with a > symbol.

Note- Besides c, which signifies a changed line, the diff command also points which lines need to be added (a) and deleted (d) for the files being compared to match.

More complex examples of this command can be found here.

21. How to view the first few and last few lines of a file?
Use the head and tail commands to quickly view the first and last few lines of a file. These commands come in handy when you just want to have a quick peek inside the file. For example, the head -n2 somefile command displays the first 2 lines of the file somefile. Similarly, the tail -n3 somefile command displays the last 3 lines of the file.

Not only lines, you can also quickly view a specified number of bytes using these commands. For this, use the -c command line option instead of -n. By default, when the number of lines is not specified, both the commands display 10 lines in the output.

22. How to store and view the output of a command at once?
Use the tee command to simultaneously write the output of any other command to standard output as well as to one or more files. For example, the ls | tee ls-dump command displays the output of the lscommand on console and stores the output in the file ls-dump.

While the tee command is mostly used for capturing and analyzing logs at the same time, it can also be used to speed up your workflow. For example, the echo "Linux command line" | tee file1 > file2command writes the string to both files in one go.

23. How to compress and uncompress a file?
Working on Linux requires you to deal with archives like .tar, .tar.gz, .bz2, and more. To create as well as uncompress these archives you can use the tar command.

For example, the tar -cvf practice.tar practice/ command compresses the practice folder and creates a.tar archive named practice.tar. The -c command line option tells the tar command to create an archive,-v displays the files added to the tarball , and -f specifies the filename.

To uncompress the .tar archive created above, use the tar -xvf practice.tar command. The -x command line option signals the command to extract the archive. This command untars the file in the current directory. Use the -C option to specify a different target directory.

To create .tar.gz and .tar.bz2 archives, add an extra -z and -j command line option, respectively. The command to uncompress these archives is same as the one used for .tar files. Use the -t command line option (along with v and f) in case you just want to list the contents of an archive.

Tip - To deal with .zip files, use the zip command.

24. How to edit a file using Vim editor?
While the Vim editor is one of the most powerful command line text editors, it also requires you to learn a lot of keyboard shortcuts. But the basics of editing are simple and easy.

To open a file in the editor, run the vim command with the file name as an argument. For example, vim textfile. If the file textfile doesn’t exist in the specified directory, the editor will create and open a new file by that name, otherwise it will open the existing file.

There are two operation modes in Vim: command mode and insert mode. The editor opens the file in command mode, where you can move the cursor using the arrow keys on your keyboard, but cannot edit the file until you press i -- activating the insert mode as shown below.

2014-07-04_08-44-02.png


Once you are done editing the file, you have to press the Esc key to come out of the insert mode and into the command mode before being able to save the file.

2014-07-04_08-45-49.png


To save the file, type the :w command and then hit Enter.

2014-07-04_08-48-29.png


To quit the editor, type the :q command and press Enter, or :wq to save and quit in one go.

Note - To quickly copy or delete a line, switch the editor to the command mode, bring the cursor to the desired line, and type yy or dd, respectively. To paste, press p in the command mode.
From TechSpot
 
S

Sr. Normal

- Ironic Mode on -

Seeing how bad it makes for me learn English , you should all learn Spanish .​

- Ironic Mode off-

It's a great tutorial, certainly evil is that the translator also translates commands me and finally I is a bit confusing.
I 'll translate for paragraphs so I enjoy it more .

Thank you for sharing your knowledge again .

Have a good day
 

sid_16

Level 20
Verified
Top Poster
Well-known
Jul 19, 2013
954
Hello Linux user,
This guide is a copy paste from the original article here- The ultimate guide to Linux for Windows users

All right, so let's say you are a Windows user, and you have HEARD of Linux. You want to try this new technology, but the quantity of information coming towards you from enthusiastic veterans is simply overwhelming. Let's break it down.

linux-commandments-tux.png


Tasks for today
We have a lot on the agenda. We will begin with several questions and answers on the common differences between the two operating systems. After that, I will discuss the more technical parts. And after that, we will talk about actually installing Linux. The flow may not seem logical at first, but trust me.


Table of Contents

  1. What is Linux?
  2. What is it good for?
  3. Major differences between Windows and Linux
  4. Where do I find Linux?
    1. Linux architecture
    2. Linux distribution
    3. What makes these distributions different?
    4. Components of a Linux distribution
    5. Desktop environment
    6. Gnome Desktop Environment
    7. K Desktop Environment
    8. Unity desktop environment
    9. Cinnamon desktop environment
    10. Other desktop environments
  5. Linux package managers
    1. Yellowdog Updater, Modified (YUM)
    2. ZYpp (libzypp)
    3. Advanced Packing Tool (APT)
    4. Other package managers
    5. Underlying binary format
  6. Linux command line
    1. Popular commands
    2. Top 20 commands & builtins
    3. Filesystem layout
    4. Disk layout
    5. Special devices
  7. Let's assemble all together
  8. What do we have so far?
    1. Significant complexity
    2. Command line is useful
  9. So where do I find Linux?
    1. Major Linux distributions
  10. How do I start?
    1. How do I install Windows?
    2. How do I install Linux?
    3. How do I use Windows and Linux together?
  11. How does Linux work?
    1. Linux boot process
    2. Runlevels
    3. Users
  12. Common desktop activities
    1. Getting to know Linux desktops
    2. Common software
    3. Common games
    4. Common tasks
    5. Pimping guides
    6. Additional guides
  13. Best Linux resources
  14. Serious questions to all readers
  15. Updates & user questions
  16. Conclusion

What is Linux?
Linux is an operating system, very much like Windows. It came to life in 1991, by merging the Linux kernel developed by Linus Torvalds, with the GNU set of programs and applications. Because of this, Linux is sometimes referred to as GNU/Linux.

The Linux kernel has been developed and released under a GPL license, which means that its source code must be freely available to anyone. However, over the years, companies have shipped Linux packaged with proprietary code included, as well as charged money for use and the support model. In the home segment, most if not all versions of Linux are free of charge. Sometimes, you will hear words like free and open-source. This is what those folks mean by that.

What is it good for?
Believe or not, Linux has many uses everything around you. It is the prevalent operating system everywhere except the desktop. Your Android smartphone is in fact a Linux box. Your router, your TV, your fridge, they all run Linux underneath.

Linux is also the top choice for super-computers, it is heavily used in the digital world for development and production of 3D movies, and it is the bedrock of the Web and most data centers in the world, due to its highly flexible and extensible nature, as well as relatively low usage costs.

lg-smart-tv-final.jpg


samsung-s4-book.jpg


Major differences between Windows and Linux
All right, but so far, this does not tell us anything about where to find Linux, how to install it, or how to use it. Now, we will walk through a handful of concepts and pain points that pose a serious block for most Windows users. We will elaborate on all those strange and alien ideas and bridge over them with elegance.

Where do I find Linux?
Indeed, you may assume that there is a single Linux entity where you can find Linux, much like Microsoft provides Windows. This is not the case. Linux is not a single entity. In fact, you do not use Linux directly. Which is why we must explain Linux architecture first.

Linux architecture
To do this, we will begin with Windows. For home users, Windows is essentially the desktop they see and use. In Windows XP, it was called Luna. In Windows 7, it's known as Aero. In Windows 8, you have the Modern (Metro) interface. But this is not the whole of the operating system.

Windows, like any operating system, has several layers:

  • Kernel - the heart of the operating system, which initializes and interfaces with the hardware, schedules tasks and manages memory, and actually allows you to use your system as you normally do.
  • Drivers - Software that interfaces between hardware peripherals, like the network card, graphics card, hard disk, and others, and the kernel, and effectively allows applications to utilize hardware resources. The drivers are usually supplied by third-parties, like Atheros, AMD, Nvidia, Hitachi, and many others.
  • Graphical interface - what you see and perceive as the desktop.
  • Applications - software that runs on the desktop.
In Windows, the first three components are tightly coupled. You have a single desktop interface, and it cannot be detached from the underlying kernel. You must use Windows as it. You cannot have a different desktop interface. You can change themes, but the core remains the same.

In Linux, things are a little different:

  • Kernel - Because of a slightly different design (Computer Science nonsense), the functionality of the Linux kernel is not identical to Windows. First, the kernel can be compiled with drivers. This means you get support for hardware out of the box and you do not need third-party software. Second, you can load new drivers on the fly. We will address this soon. Effectively, because of the free and open-source nature of the kernel, it is possible to bundle drivers into it. This means the Linux kernel supports a wide range of hardware devices out of the box.
  • Drivers - Some software cannot be distributed freely, due to licensing reasons. Therefore, you may not have all the drivers you need available, and you must go to third-party vendors to obtain them. This is perfectly understandable.
  • Graphical interface - This is the big difference. Linux can run without a graphical interface. Two, there are actually several graphical interfaces available for Linux. Not just different themes, but actually complete sets of libraries that communicate between the kernel and the applications. Imagine using the OSX interface on Windows, that's the best analogy.
  • Applications - Same as with Windows.
So what do we have here? The major differences in the architecture of Windows vs. Linux is that: a) Linux can bundle drivers into the kernel and load them on the fly b) Linux can run without a graphical interface, or with many different ones.

Now that you understand this basic difference, we will now talk about how Linux is shipped to users. We will now elaborate on another important concept - distribution.

Linux distribution
Linux distribution is a unique set containing: kernel, one or more desktop environments, and an application bundle. This is the actual product that you use directly. You use Linux distributions, and inside, they are powered by the Linux kernel.

Linux distributions are developed and maintained by companies as well as individuals, hobbyists, volunteers, and community users. Large, successful companies ship their distributions to the commercial market along with expensive, long-term support contracts. At home, most distributions can be used free of charge.

Let us name several popular Linux distributions. For home users, the most popular name is Ubuntu, a Linux distribution created by the Canonical Group, a company based in the UK. Canonical offers Ubuntu for free. It means you can go to the Ubuntu website and download the operating system. We will soon elaborate on how this is actually done.

Another popular distribution is Linux Mint, which is a community-developed effort. Linux Mint is partially based on Ubuntu. It is also available for free. You also have openSUSE, which is a product of Novell, a company that also has an enterprise flavor available for use by business and large data centers. Likewise, there is Fedora, a product of RedHat, the largest Linux company in the world. I have named these four as the top candidates, but there are many, many more distributions available.

What makes these distributions different?
All right, so let's break them down some more, shall we.

Ubuntu is composed of: Linux kernel + Unity desktop environment + apps.

Linux Mint is composed of: Linux kernel + Cinnamon desktop environment + apps.

Fedora is composed of: Linux kernel + Gnome desktop environment + apps.

openSUSE is composed of: Linux kernel + KDE desktop environment + apps.

As you can see, a pattern begins to emerge. The big difference between most distributions is in which desktop environment they choose to use, and the application set. This begs a question. If you were to use Gnome in openSUSE, would that make it the same as Fedora?

The answer is: no.

I have oversimplified the comparison, of course. The differences are larger than just the use of desktop environments. But this opens another layer of complexity before us. Now, let's see all the core components of a typical distribution.

Components of a Linux distribution
We have the following:

  • Kernel - Every single distribution uses its own kernel, ever so slightly modified. The default Linux kernel is known as the mainline. It is maintained on kernel.org, and the changes in it are governed by a large body of professionals, most of which are employed by large Linux companies, with the ultimate veto vote in the hands of the Linux founder, Linux Torvalds. Every distribution uses its own kernel adaptations. The kernels between different Linux distributions are often not mutually compatible.
  • Graphical interface - As we mentioned earlier. Do remember that Linux distributions can run WITHOUT one, if needed. For example, most server and enterprise flavors are normally configured without a desktop interface, because it is not needed.
  • Applications - Each distributions packages its own set. You can enhance the default by installing additional programs of your own. This is done through centralized management facilities very similar to Windows update, known as package managers. Quite often, each distribution uses its own unique facility.
  • Package manager (Linux update) - We are now introducing a new concept, but do not be alarmed. This Android Play Store. This is exactly that. Because of the free and open-source model, most Linux software can be distributed in a centralized manner from common servers. These servers are known as repositories. Think of them as Windows update servers really, only custom tailored per distribution. The software component that communicates with the repositories and allow users to download software as well as updates is known as the package manager. Most distributions use their own unique package manager.
Let us compare to Windows then, shall we? In Windows, you have the kernel plus the one default desktop interface. You also have applications, Windows update, plus you must manually download programs that are not part of the standard Windows bundle, due to licensing restrictions.

In Linux, you have distributions. Each distribution comes with its own slightly modified kernel, its own default desktop interface plus optional additional other desktop interfaces, its own set of applications, and its own package manager, a Linux update facility that allows the system to install programs and updates for the WHOLE distribution, because of the very convenient licensing rules.

Disclaimer: Linux distributions can ship only a subset of all the available software in the world. For example, if you need specialized payware, you will still need to manually download and install the software. But for the free and freely-redistributable components, Linux distributions can provide free updates, updates and additional downloads from their centralized repositories.

Now let's talk a little more about desktop environments and package managers, because they seem to be the big differences when compared to Windows.

Desktop environment
A desktop environment (DE) is an implementation of the desktop metaphor made of a bundle of programs running on top of a computer operating system, which share a common graphical user interface (GUI). A desktop environment typically consists of icons, windows, toolbars, folders, wallpapers and desktop widgets. These components are controlled by a piece of software called a window manager, which is responsible for the placement and appearance of windows within a windowing system in a graphical user interface.

Now, we dive one more step deeper - the window manager.

In Windows, you have the Desktop Window Manager (dwm.exe), which does the hard work in displaying the Windows interface to users. Do note that DWM is tightly coupled with the kernel's graphical subsystems and is largely non-replaceable.

In Linux, you have the X windows system, which does pretty much the same thing as DWM, except that the nomenclature of concepts and terms is different. The X sits between the kernel and the graphical interface. The X is composed of the display server and the window manager. This allows it to be separate from the kernel, unlike Windows.

So, the desktop environment now comes down to the following:

  • User applications.
  • Graphical interface.
  • Display server + windows manager.
Underneath these, you have the kernel and the hardware. So what is a desktop environment? It is a set of programs, an interface, a display server, and a window manager. Let us introduce a few.

Gnome Desktop Environment
This is a desktop environment that you will most likely encounter if you install the default version of Fedora, for example. GDE uses the Gnome Shell as its graphical interface, X11 protocol to talk to the display server, X.Org display server, and Mutter window manager. Gnome Desktop Environment is focused on simplicity and ease of use, with few options shown to the user.

gnome-36-activities.jpg


K Desktop Environment
KDE is a default environment for openSUSE. It utilizes the KDE Plasma via X11 or Wayland protocol to talk to X.Org or Weston display server, and it uses the KWin window manager. KDE is more Windows-like in appearance, and it features option-rich menus.

opensuse-13-1-installed-desktop.jpg


Unity desktop environment
This is the default for Ubuntu, and only Ubuntu. Unity mostly relies on Gnome components, but Canonical has expressed desire to use its own implementation of a new display server called Mir, rather than using the Wayland/Weston combination, which has caused somewhat of a rift in the Linux community. Unity has been designed with multiple form factors in mind, including touch, because of the Canonical's desire to use Ubuntu on smartphones and tablets.

ubuntu-saucy-desktop.jpg


Cinnamon desktop environment
Cinnamon DE is the default in Linux Mint. Originally, Cinnamon uses a fork of Gnome Shell, but recently it has removed all dependencies on the graphical interface and uses its own internal implementation. The default window manager is called Muffin.

olivia-desktop-final.jpg


Other desktop environments
There are many others. But I have purposefully avoided mentioning them to avoid confusion. For example, there's is also Xfce, which uses Xfce4-panel + X11 + Xorg + Xfwm, then there's MATE, which uses Gnome Panel + X11 + Xorg + Metacity. Then, LXDE uses LXSession + X11 + LXDM + Openbox. There are still more. To make things even worse, there are also special, compositing window managers available for older desktop environments, including the popular Compiz. And now I dare show this image:

ultimate-linux-guide-de-schema.png


Note: Image taken from Wikimedia, licensed under CC BY-SA 3.0.

Linux package managers
As we have mentioned earlier, Linux package managers are collections of software tools designed to automate the process of installing, upgrading, configuring, and removing software packages for a computer's operating system in a consistent manner. The said consistency is maintained by using a database of software dependencies and version information to prevent software mismatches and missing prerequisites. Packages distributed by package managers consist of software, applications and data. These packages also contain metadata, such as the software's name, description of its purpose, version number, vendor, checksum, and a list of dependencies necessary for the software to run properly. Upon installation, metadata is stored in a local package database.

A package manager normally work as follows:

  • Package manager is launched.
  • User performs an action - installation, upgrade, etc.
  • Package manager consults its internal list of servers - repositories - and contacts them with the requested action, including resolved dependencies and other requisites.
  • Necessary packages are downloaded and installed.
This is exactly how Windows update works, except that package managers can be used to manage the whole distribution, except a very small number of proprietary components and manual installations done by the user.

The licensing terms of a distribution dictate what software can be bundled with the distribution, what software can be made available for download from the repository, and what software may only be hosted at the official vendor servers. For example, in some countries, distribution of MP3 codecs is not legal without a royalty fee. Therefore, the user will have to initiate the download of codecs using the package manager. Another scenario is that the user will have to configure an additional repository to be able to download a piece of third-party software.

Like desktop environments, there are many package managers. To make things worse, here too, we are dealing with several layers of complexity and fragmentation. Package managers are normally composed of the following:

  • Graphical interface - a visual tool much like Windows update or Android Play Store.
  • Command line interface - a command prompt (cmd) like work environment.
  • Underlying logic engine - the software that resolves dependencies and controls the system.
  • Underlying binary format - packages are archived in a unique way.
Now, let's us briefly explore some of the package managers and the different ways they can be used. We will touch on the repository management, additional third-party sources, installation of software, and more in greater detail later in this guide.

Yellowdog Updater, Modified (YUM)
Borrowing some from my Netrunner article, this is the default package management framework in RedHat-based distributions. For you, this means Fedora. Now, to complicate things still further, the graphical interface used with YUM depends on the desktop environment. YUM can be used with Apper in KDE, or it can be used with YUM Extender in an older implementation of Gnome, version 2.x as opposed to the recent 3.x family. The command line is identical, and it invoked by the yum command. We still have not discussed Linux command line, but we will soon enough.

ultimate-linux-guide-yum-frontend.jpg


ZYpp (libzypp)
This is the default package manager in openSUSE. The frontend is called YaST, and the command-line component is called zypper.

ultimate-linux-guide-zypp-yast.jpg


Advanced Packing Tool (APT)
APT is used in many Linux distributions, including Ubuntu and Linux Mint. There are many frontend components available for APT. To name a few, there are Ubuntu Software Center, Muon, Synaptic, and many others. The command line component is apt, but the full usage depends on the invocation of a desired function.

ultimate-linux-guide-apt-usc.jpg


Other package managers
Like with the desktop, there is a very long tail of package managers and their implementations. Let's do a bit of a name dropping. Puppy Linux uses its own package manager called PETget. Slackware uses slackpkg, Gentoo uses Entropy, Archlinux uses pacman, and so forth. It's really complicated. And hardly the bottom of our stack.

Underlying binary format
The Linux reality also becomes a little more difficult when you consider the fact that package managers work with multiple, mutually-incompatible package formats. To give you the best of analogy, think of Windows cabinet files (CAB) and Setup information files (INF). Together, these two can be used to define an installation package, for example.

In Linux, there are several package types. The most popular ones include:

  • RedHat Package Manager (RPM) format - RPM files are archives that contain installation files and scripts, which are then installed in the right places in the Linux filesystem structure. RPM is mostly used with RedHat and SUSE Linux flavors, as well as other distributions that are partially based on these two.
  • Debian (DEB) format - DEB files do the same thing, except the format is different. It is not possible to use Debian files on RPM-enabled systems, and vice versa. Package files can be converted, but due to significant differences in the architecture, the installations will probably not work. DEB is used by all Debian-based distributions. Debian is a distribution itself, but it is a foundation for many others, including Ubuntu, Linux Mint, and more.
Both RPM and DEB files can be managed directly, without package managers. Users can install, remove or upgrade installed software. This is very similar to running Windows MSI or EXE installer filers manually, rather than going through Windows update, for example. On top of that, regardless whether packages are being installed using a package manager or manually, RPM and DEB systems also have their own internal databases, which are used to manage the consistency of installations.

Additional package formats exist, including PUP, PET, TGZ, XZ, and more.

As you can see, most package managers have a graphical and command line interface elements. This means you can manage software in a distribution even without a desktop environment. That's our next topic.

Linux command line
Let's talk about the Windows command line first. Believe it or not, Windows has a very rich and powerful command line. Several implementations really. There's the standard command prompt, and you will sometimes want and need to use it. Then, there's the new PowerShell. Last but not the least, let us not forget the whole WMIC framework, which really lets you control the whole of Windows using command line only.

wmic-sample.png


win7-slipstreaming-mount-done.jpg


Linux command is very similar, except that you can launch it from within the desktop, much like Windows, but also on a system that runs no desktop. The command line is then usable through what is called a console. Imagine your monitor showing a blank black monitor with a blinking cursor in the top left corner, and a tiny prompt marked $ or # or some other symbol. This is exactly that.

All Linux systems have multiple consoles available, which you can switch between using keyboard shortcuts. This allows you to work in both the graphical and command-line interfaces at the same time. We will address this soon.

So what does one do on the command line? One executes commands. How is this done? Well, let us briefly touch on what the user actually sees and does when working with the command line.

ultimate-linux-guide-console.jpg


The blinking prompt, so to speak, is not just some ethereal entity. A console itself is a container. A special program runs inside the console window called a shell.

A Linux shell is a command-line interpreter or shell that provides a traditional user interface. Users direct the operation of the computer by entering commands as text for a command line interpreter to execute, or by creating text scripts of one or more such commands. The most popular Linux shell is BASH. There are others, like TCSH.

Users typically interact with a Unix shell using a terminal emulator. Terminal emulator is a program that emulates the behavior of a standalone console. For example, to give you a good analogy, the Windows CMD is an emulator, because it wraps the program in a desktop window with its own additional functions, but inside, it behaves like the old DOS prompt. The same thing in Linux.

Popular terminal emulators include xterm, Konsole, Gnome Shell, and many others. All of these are programs that you can launch on a typical Linux system, like you would anywhere else. Open a desktop menu, find the program, and launch it.

ultimate-linux-guide-menu-launch-emulator.jpg


Popular commands
The fine details of how Linux shells are used are beyond the scope of this article. Still, I am going to give you a brief overview. Let's look again at that prompt, shall we.

ultimate-linux-guide-console.jpg


What you see is the name of the user currently running the shell, which is roger, the name of the host, which is roger-laptop, a divider in the form of a colon mark, a tilde sign which signifies that the current folder we are working is the home folder of the current user, and the dollar sign is the standard sign for a regular user in Linux.

Now, the user can run commands. For example, dedoimedo.exe. This is what we want to run. So how would you go about doing that. Very much like Windows, with some small differences in syntax.

dedoimedo.exe would execute the command by searching a special list of default paths where the system expects to find the dedoimedo.exe command. If the command does not exist there, it cannot run. In other words, it is not in the PATH.

./dedoimedo.exe would run the command in the current folder. BTW, let's learn another word. Directory. It is not that strange, and in DOS, folders were called directories, and there's even the command dir, to display the contents thereof.

So yes. What's the big difference from the earlier attempt. Dot and slash. We now learn another concept, and that is that every Linux directory has two special hard links. BTW, hard links are a type of file. Anyhow, a single dot (.) is a hard link to the directory itself, while two dots (..) is a link to the parent directory, i.e. one above.

Again, this is nothing magical. This is also true in DOS. Familiar with cd .. to go back up one level? Same thing here. This is your way to navigate up and down the hierarchy of directories.

Slash (/) is the default delimiter in Linux, denoting a new level of hierarchy in the file system. In DOS and Windows, it is the back slash (\). So now, things are really familiar. What you would mark in Windows as c:\users\roger would become something like c:/users/roger. This is not fully correct, but bear with me.

Therefore, dot slash (./) means execute the command in the parent directory, followed by the file name itself. Likewise, ../dedoimedo.exe would try to look for execute the command in the directory one level up, and ../../../dedoimedo.exe would go three levels up.

How far up, you ask?

Well, In Linux, the top of the filesystem hierarchy is marked with the slash (/). This is known as the root of the filesystem, because everything originates there. And compared to Windows, there are no multiple roots. While in Windows you have c:, d:, e: and others, in Linux there's only one root. You can compare root to My Computer, if you want.

Therefore, you can now execute the dedoimedo.exe file using a full path rather than a relative path, like before. Using the earlier analogy, /users/roger/dedoimedo.exe is the full path to our command. In Linux, users' home directories are normally marked as /home, and so it becomes /home/roger/dedoimedo.exe.

Now, we can finally play with commands. Linux commands can be shell builtin commands, in which case there is no full path. Change directory (cd) is a good example. Or they can be external commands, located somewhere in the filesystem. Commands take options, flags, switches, and arguments, much like Windows.

We mentioned dir earlier. In DOS, you can do just dir, but you can also do dir /? to get all the options, or dir /p to pause the run when the screen buffer fills, /a to show all attributes, /l to user lowercase, and more.

Linux commands also take these extra options. How would you know, though? For any command, you can do a couple of neat tricks to learn more.

man command

This will invoke the manual page for the command. Think of it as pressing F1 inside a console. You will get a long, detailed explanation what the command does and how it can be used. You can also always read man pages online, if you want.

command -h or command --help

This will display a shortened help, similar to Windows /?, allowing you to quickly master the commands you want and need. For most people, the second option is faster, but not necessarily better for learning.

Top 20 commands & builtins
And now, here are the top 20 commands, which will help you find your way around during the first few hours of your use of Linux. Please note that this is just the tip of the iceberg, and therefore, you should not think you're done after you have executed these. Remember, Linux is case-sensitive.

ls - This command with list files. Like DOS dir. It also has many flags. For example, -a will list all files, including hidden ones. -l will list all file attributes, including owner, size, permissions, full path, etc.

ls -ltr /home/roger

ps - This command will display the running processes in a list. Think of it as a one-time snapshot of a command line task manager. The exact details of this command works, and what all the little fields mean is beyond the scope right now, but you might want to look at my extremely advanced and extensive hacking articles one and two and three and four. Too advanced for you right now, you've been warned!

ps -ef

cd - This is a shell built in. It allows you to change directories. cd <path>, either relative or absolute, will take you where you want to go, provided the path exists. Some special options exist. cd - will take you to the previous directory. cd on its own will change your path into your home directory. cd ~ will do the same thing.

cd /home/Movies

pwd - This command will show your current location in the filesystem

pwd

cat - This command lets you print the content of a text file to screen, or to a file.

cat "/home/special\ file\ with\ spaces"

less - This is a very basic text viewer. Like cat, you can use it to see file contents, but you the stream will not run uninterrupted, you can read screen buffer at a time, back and forth, and even do some basic search.

less /var/log/messages

which - Executed against a program name, it will show the full path for the program.

which firefox

mkdir - This command lets you create directories. The -p flag lets you nest them.

mkdir -p /home/dirs/in/depth

touch - This command will create empty, 0-length files.

touch me

cp - This command will copy one or more files.

cp igor igor.bak

mv - And this one will move (cut it).

mv igor1 igor2

rm - Warning! This command will delete files and/or directories. Remember, with the right privileges and the use of wrong permissions, you can easily destroy your system. It is very important to be careful when running the rm command.

rm /home/roger/certain-unneeded-file

chmod - This command can change permissions on a file or a directory. For example, you may want to change a file so that it is readable only. In that case, you will remove the other permissions, leaving only read in place. For more details on the Linux file permissions management, take a look at this tutorial.

chmod 700 /home/secrets.txt

chown - Similar to the command above, chown allows you to change the user and group ownership of a file. For instance, change it from roger to bodger.

chown roger:mygroups /tmp/file.old

echo - This is a very useful and practical command that can display lines of text and values stored in the shell environment variables to the screen. For example, echo $PATH will display the contents of the PATH variable. So if you have a problem with running a file, then you might want to check whether its path is included in the PATH. You can also use it on conjunction with rm to learn first what kind of files you would remove before actually deleting.

echo $DISPLAY

export (in BASH) - This command lets you configure environment variables, so that programs that rely on their presence can use them. For example, when you try to run a command without using the full path, the shell itself will consult the PATH variable to determine where to look for the file. If you need to change the variable, you will use the export command. The TCSH equivalent is setenv.

export JAVA_HOME=/usr/lib/java

du - This command lets you check the estimated usage of a directory. This is useful if you want to check the space usage or a quota of a particular directory on your system.

du -Shi /home/videos

df - This commands lets you see the usage of all mounted filesystems. The word mounted means effectively in use. This is a very handy way to check what your disks contain. The usage is equivalent to the disk management facility in Windows.

df -lhT

find - This command can be used to search for files on your filesystems. The evil twin of the find command is the locate command. The big difference is that locate uses a pre-built database, which makes it faster, but the results might not fully reflect the actual most up to date content of the filesystem.

find . -name \*movie\*

grep - This command can be used to search for string patterns in text files. Let's say you have several files, and you want to look for words doctor and sister in there. Well then, a typical search with grep would be:

grep -Eir 'doctor|sister' /home/*

There are many other useful commands. For example, top is the command line task manager. With kill, you can terminate offending processes. You can create archives, like for instance ZIP, TAR, TGZ, BZ2, and others from files and directories using the tar command. You can print the beginning and end of files with head and tail commands, respectively. You can also manipulate text stream with the very complex yet awesome programs sed and awk. Then, dd lets you write direct copies of files. And the list goes on and on.

Most importantly, commands can be chained - using the pipe (|) symbols. This lets you stream the output of one command as the input of another, and create a complex execution. For example, list a content of a file, sort if alphabetically, then count unique entries. This kind work is the basic principle for scripting.

cat file.txt | sort | uniq -c

You can also do system administration from the command line. Install software, schedule updates, shutdown or reboot the system, start or stop services, and more. Now, let us see three examples of how we can use package management from the command line. We will demo using the three leading utilities we mentioned earlier:

apt-get install firefox

yum update kernel-devel

zypper search vlc

Fully mastering the command line is a long and arduous journey. You want to learn how to write your own scripts and programs. You want to able to run unattended tasks that maintain your system, or combine the execution of multiple programs into one.

At this point, my highly useful commands & configurations tutorial might be of use. Furthermore, some neat BASH tricks could also be of use.

Filesystem layout
We talked about commands. But what about the system that contains these commands. So maybe a brief overview of the filesystem hierarchy and architecture is needed. Again, we will use the Windows analogy to make it simple.

So in Windows, you have the C: drive. Under it, there's C:\Windows, which contains core system files. There's Users, which contains users' personal folders. There's C:\TEMP, which is used for temporary files. However, there might be multiple drives on your system, and there is no single view to check them all, unlike the root in Linux. The closest analogy would be My Computer. Anyhow, the classic Linux filesystem hierarchy will look something like the following:

  • /bin contains basic programs (binaries) like cat, ls, awk, etc.
  • /boot contains files necessary to boot the system.
  • /etc contains critical system configuration files.
  • /home contains users' directories EXCEPT one special user.
  • /lib contains system libraries.
  • /opt contains optional installations.
  • /root is the home directory of the special user called root.
  • /tmp contains temporary files.
  • /usr contains programs like Firefox, VLC, LibreOffice, games.
  • /var contains system logs and runtime files.
There are other paths, but they are not important right now. Each one of these can be called a directory, but it can also be called a filesystem, because the actual data may reside on a remote server. For example, /home directories could be network drives, formatted with their own filesystem.

The default Linux filesystem format is EXT (at revision 4), but many other file format exist, including EXT2, EXT3, BTRFS, XFS, and more. In a nutshell, they are equivalent to the Windows FAT, FAT32 or NTFS file formats, with many additional differences.

Most if not all Linux distributions can natively see and use (read & write) to Windows filesystems, whereas Windows does not have a default ability to do the same thing with Linux filesystems. Therefore, if you connect a drive formatted with one of the Linux filesystems to a Windows box, it will be visible but it will appear unformatted or unusable.

Disk layout
One last thing before we go up and piece our complex puzzle into a single piece. Disk management. We did mention the du and df commands, but the output may be confusing to someone who has never worked with Linux before. Once you figure it out, it is fairly trivial, but not the first time.

I have explained the disk notation in my tutorials linked above. But we shall briefly recap. Windows marks disks the following way: Disk<number>, e.g. Disk0, Disk4, etc. Partitions are marked with letters, e.g. K:, M:.

Linux marks disks based on their controller type. IDE disks are marked hd<letter>. SATA or SCSI disks are marked sd<letter>. For example, the third SATA disk is sdc. Partitions are marked numerically, from 1 onwards, with the first four reserved for primary partitions, and numbers 5 and above for logical partitions. For example, the second primary partition on the first IDE disk is hda2. The first logical partition on the first SATA disk is sda5. This is correct for the MS-DOS partition table. With the GPT scheme, this are slightly different, but still the notation is correct. Virtual machine disks used inside virtualization software may be marked with vd or xd or other letter combinations.

Special devices
Floppy disks are marked as fd, CD-ROMs often as sr or cd. Special devices like cameras, scanners or printers may get their own unique labeling scheme, which can depend on the vendor, model type as well as the specific distribution implementation.

Let's assemble all together
Now, let's take a look at our distributions once more.

Ubuntu is now a special, modified Ubuntu kernel + Unity desktop environment + DEB file format + apt command line package manager + Ubuntu Software Center GUI package manager + its own application stack.

Linux Mint uses its own kernel + Cinnamon + DEB file format + apt + Software Center + its own application stack. The same applies to Fedora and openSUSE and many dozens of other distributions. And there's STILL more granularity, which we have not touched yet, but we might elaborate later on.

What do we have so far?
Let us recap all of what we have learned in this tutorial.

Significant complexity
As you have learned so far, Linux is not a single entity. It is a complex matrix of components. Mastering Linux means mastering many different things. And if you are interested in trying different distributions, it often means you learning a complete stack of applications, desktop behavior, package management, and more.

In Windows, there is only one dimension. In Linux, it's the number of distributions multiplied by the number of desktop environments multiplied by the number of package managers multiplied by the number of application bundles. It is really very difficult to know them all well, and they are sometimes very different. Therefore your Linux exploration should initially focus on a single distribution and its own unique set.

Command line is useful
One thing that can help you if you want to try multiple Linux distributions is to use the command line, because you will maintain a higher level of consistency than with GUI tools, which significantly differ between desktop environments.

So where do I find Linux?
Well, now that we know what Linux is all about, we CAN finally download it. In fact, we will download and use a Linux distribution, one of the many that we have mentioned earlier. Now, let's elaborate on the available choices.

Major Linux distributions
I have mentioned four, and we will focus on these four. For new users, going into the full list of several HUNDRED available Linux distributions is a bad idea. And now that we are here, let's introduce another word - distro, short for distribution.

Ubuntu is one of the most popular Linux distros in the world. It is very easy to install and use, and it has a large install base. Many veteran Linux users recommend this particular flavor of Linux to new users. If you are interested, please take a look at my review of the latest edition to get a hunch what this is all about.

ubuntu-saucy-desktop.jpg


Ubuntu family is very rich, so you might also be interested in Kubuntu, which comes with the KDE desktop, or Xubuntu, which comes with the Xfce desktop. These two are more like Windows in spirit and feel, so new users might find them easier to master.

kubuntu-saucy-final.jpg


xubuntu-saucy-nvidia-running.jpg


Linux Mint is another highly popular distro, perhaps even more than Ubuntu according to some sources. Now, this is really an excellent choice for most Windows users, because it comes with pretty much everything pre-configured out of the box. I even voted this the best distro of 2013. Both Mint and Ubuntu offer five years of free updates for their long-term support editions.

petra-desktop-final-1.jpg


openSUSE is another possible choice. In the last years, it has waned a little in popularity, but it can still be a strong candidate. You might want to take a look at my latest review for additional impressions.

opensuse-13-1-installed-desktop.jpg


Fedora is an interesting distribution in that it ships with no proprietary software, so if you need codecs for music or video, you will have to install them separately. It is also considered relatively unstable, because it often introduces a lot of new and modern technology. Plus, the support cycle is quite short. However, it can be a good choice.

fedora-20-desktop-cool.jpg


How do I start?
Let's say that this article has actually convinced you to try Linux. Before you do any hard ground work, you must read some more. I most warmly recommend that you invest a little more time reading several guides that I have put together recently, which explain in fanatic detail all that you need to know to run Linux at home, safely, successfully.

How do I install Windows?
This is the first question you should ask. You should NOT use Linux, unless you are fully confident in your ability to install Windows. This may sound harsh and cruel, but believe me, it is for your own good.

To wit, you should read my Windows 7 installation guide, and then the same thing for Windows 8. Not only do both these articles have a wealth of knowledge on the subject matter, they also touch on all the extra steps needed for using Linux at home.

windows-8-installing-2.jpg


How do I install Linux?
Now, after you have mastered the step above, you are ready to attempt to install a Linux distribution of your own. You may want to start by testing in a virtual machine first. This way, you can learn from your mistakes toward the real thing.

ultimate-linux-guide-virtualbox.jpg


I have written a ton of articles on how to install a wide range of Linux distributions. You might want to start with the latest Ubuntu guide. Then, take a look at an older one. After that, go back some time in history and consult some of my other installation guides. Although they have been written many years ago, they are relevant and accurate.

ubuntu-install-slide-1.jpg


How do I use Windows and Linux together?
After you have successfully mastered both a separate, standalone Windows and Linux installation, you are ready to use the two at the same time. This is known as dual-boot, and sometimes also referred to as tandem, or side-by-side installations.

You should take a look at my dual-boot tutorial for Windows XP and Kubuntu, as well as the more recent one featuring Windows 7 and Ubuntu, and finally, the latest one featuring Windows 8 and Ubuntu 14.04. Now, the world of dual-booting opens up a whole new world of additional possibilities, as well as technical complications.

dual-boot-windows-8-ubuntu-new-layout.jpg


You will need to take into consideration data backup, system imaging, bootloader configuration, disk and partition management, and many other issues. All of these topics are covered in detail in the guides above.

How does Linux work?
So let us say that you decided to give this a try. Now, I am going to talk a little about how Linux works, from boot to desktop, the functionality, the accounts, as well as the notable difference from Windows, and that is Linux can run in a live session. This means that before you install a machine, you can boot into a fully functional environment that is visually almost 100% identical to what the system will look like after the installation.

ultimate-linux-guide-live-cd.jpg


In the live session, you can then test hardware compatibility, look & feel, check programs, and only then decide whether you wish to install this particular flavor of Linux. This is a huge advantage compared to Windows. Furthermore, this allows you to use Linux as recovery systems, because you can start it on non-bootable hosts and repair them.

Linux boot process
Here is a simplified explanation on what Linux does once you power on the machine. First, there's BIOS or UEFI, which initializes the hardware. It also activates the first bootable disk that you have configured in the BIOS or UEFI menu.

It goes into the Master Boot Record (MBR) of the first bootable disk, where a bootloader is installed. The bootloader entry tells the system where to look for the kernel image and the initial filesystem (initramfs or initrd) image. Where in the aforementioned context means which disk, which partition.

The kernel image is a compressed kernel, the actually heart of the operating system. Initrd is a compressed image containing drivers for hardware, needed to initialize most of the system resources. The kernel and initrd are loaded into memory and executed.

The system initialization process (sys_init) starts the first process called init. This special process is a kernel thread, with the process identifier PID=1. Init then goes to /etc/inittab and reads the configuration. This files tells the system in which runlevel to start.

Runlevels
Linux runlevel is a complete state of a system. It is somewhat equivalent to what you would see when hitting F8 during Windows boot to get to the Safe Mode. In the Safe Mode menu, you can boot to command prompt, command prompt with networking, and more.

There are seven Linux runlevels, marked numerically 0-6.

  • 0 is the system halt state.
  • 1 is the system rescue state - you boot here to fix system problems. It is also known as Single mode, and sometimes it is referred to as s or S. It is a runlevel with only one user, the special account we mentioned earlier called root, without desktop environment or network.
  • 2 is a console-only runlevel, with no networking.
  • 3 is a console-only runlevel, with full networking. This is the typical mode of use for most servers worldwide. The servers run in this mode, and users connect to them using remote shell programs, working on the command line.
  • 4 is normally undefined and unused.
  • 5 is the full desktop mode, like you can see in screenshots above.
  • 6 is the reboot state.
When init selects the default runlevel, it goes into /etc/rcX.d, a directory that contains symbolic links to the /etc/init.d/ directory. Symbolic links are like shortcuts. The letter X corresponds to the runlevel. So for runlevel 5, the directory is rc5.d.

Init then starts all services using service scripts marked SXX, where XX is a number, in ascending order from 0 to 99. It tries to resolve dependencies, and then it runs the programs listed in these scripts until the system is fully booted and functional. Conversely, during shutdown or reboot, it runs the kill scripts, marked with KXX in descending numerical order.

ultimate-linux-guide-booting.jpg


This is the classic invocation, and it not always correct. Some Linux distributions do not use all the seven levels, and some levels are simply identical to others. Some Linux distributions use different methods of starting services, including boot sequence mechanisms called systemd or upstart. But that's advanced stuff.

Desktop environments are also started and initialized, until the user is logged in the full desktop session. Do you remember the virtual consoles we mentioned earlier? Well, you might want to know the desktop session is shown on the seventh virtual console, which can be accessed with Ctrl + Alt + F7. Function keys F1 through F6 access command-line only sessions.

Users
Finally, we need to distinguish between two major user types. There's the system administrator user, called root, with the identified number 0 (ID=0). Then, there are regular users, with generic names.

It is a little confusing that the word root is used for three different things: the root of the filesystem tree, marked by slash (/), the root user, the system administrator user, and the root user home directory, found under /root.

You can identify these different types of users if you execute the Linux task manager. For example, from the command line, then you will see processes that belong to root, as well as other users.

ubuntu-ringtail-high-compiz.jpg


Root is a privileged users, and it is designed for system administration. Regular users do not have permissions to make system changes. This is similar to the limited account concept in Windows. However, in Linux, regular users can elevate their privileges through the sudo mechanism. This allows a temporary elevation of rights to perform a specific administrative task. In Debian-based distributions like Ubuntu and Mint and others, the default is to use sudo rather than authenticating as the root user. In RedHat-based distributions, the second method is more common. In both cases, you need relevant passwords.

sudo some-command

On the other hand, to switch to the root user:

su -

Common desktop activities
Now you are in a Linux desktop? So what do you do now?

Getting to know Linux desktops
Now, remember our earlier conundrum. There is no one desktop environment, so the learning process can be many-fold. It also presents me with a challenge of showing what to do, because each setup is ever so slightly different. But let's try a generic approach. Indeed, here's a desktop, it does not matter which or why:

petra-desktop-final-2.jpg


So what do we have here. In the left bottom corner, a menu, it invokes a menu very much like the Windows start menu. There's a taskbar full of icons, only this bar is called a panel, or rather, a bottom panel. In the right corner, a system area. Very much like Windows. Here's the system menu, open - this is 100% like Windows:

petra-mate-menu.jpg


Yet another, even more Windowsy example:

netrunner-menu-app-style.jpg


Another example with a classic menu positioned at the top:

opensuse-12-2-mate-mate.jpg
opensuse-12-2-mate-sonar.jpg


You have icons on the desktop. Click to launch them. Some desktop environments offer a double-click mantra, others, like KDE, use the single-click approach. But in a nutshell, once you get the initial fear, the installation, and the complexity of understand the Linux world, the usage becomes trivial.

There's this pair of nice articles on desktop management, Gnome versus KDE.

You can also look my Netrunner desktop environment showdown, too.

Common software
The truth is, most of the software you might want to use is available in the Linux repositories, especially if you are fan of free, open-source solutions. Of course, you will not find most Microsoft and Adobe products, but many others will be there. Or you may choose alternatives.

The important thing is, you do NOT NEED to wander around the Web, looking for software. You can just use your command-line or graphical package manager, and search for the software of your liking. Most package managers are rich application stores, and they will give you star rating, screenshots, reviews, and more.

xubuntu-ringtail-usc.jpg


You should also check my must-have lists, the new and the older one, and one for the less popular Linux desktop environments. Plus, I've compiled a similar guide for Windows, and it will give you a good, strong indication of how the two worlds compare. Then, I have also written many other comparison guides. On media players, on browsers, office software, and still more. The list is endless.

fedora-20-apps.jpg


Common games
The world of gaming is truly different between Windows and Linux, although with the creation of the SteamOS, the gap is narrowing. While you are exploring this particular aspect of the Linux world, you might want to take a look at my 100+ game reviews, all done specifically for Linux, on Linux.

fuduntu-high-end-steam.jpg


Furthermore, you should note that some Windows titles can be used on this new operating system using emulation and other tools, although with limited success and guarantee. The next guide ought to help you decide when and how.

Common tasks
What users will want to do now is something like Windows - install software and configure their system. Most distributions come with a lot of preinstalled stuff, so the housekeeping list might actually be shorter than you expect. Some distros pack codecs, games and extra programs, so no need to sweat there.

Still, you probably might want to install your printers, install Steam, try Skype, configure your Wireless, and still more. I am going to highlight two or three examples here, but then, you will want to follow my mega pimping guides for some of the leading distributions, as these howtos contain a lot of useful information.

Wireless setup example

Let's say you want to configure your Wireless. This seems like one of the first things you might wanna do. This is demonstrated with Kubuntu. Click on the Wireless radio icon, which would be the first one on the right after the digital clock and a little arrow. Then, select the desired connection. Provide your password. Choose to automatically connect. And then, press Connect. Works like any other operating system.

kubuntu-saucy-wireless-connect.jpg
kubuntu-saucy-wireless-connected.jpg


Desktop background change

In most Linux desktops, it will be very much right-click > desktop background. Some other desktop environments may offer a more complicated path. For example, it might be as convoluted as System menu > Preferences > Appearance, then the Background tab.

fedora-14-more-backgrounds.jpg


Graphical card drivers example

This is something that many you would want to know. Well, how about my Ubuntu guide on this topic, which details no less than five different methods to configure and install Nvidia drivers on an Ubuntu box.

xubuntu-ringtail-additional-drivers-installing.jpg


Other examples

Check for updates - just like Windows:

opensuse-13-1-updates-shield.jpg


Check user settings:

petra-user-icon.jpg


Manage a currently playing music track:

olivia-banshee-volume-ok.jpg


Pimping guides
Here's my essential list for Ubuntu. Likewise, the same tutorial for openSUSE. And then, there's one for Fedora, too, so you should take a closer look. All of these explain how to install and configure many useful pieces of software, including themes, fonts, look & feel tweaks, popular programs like Steam, Skype, VLC, LibreOffice, graphical drivers, codecs, and more.

fedora-20-easylife.jpg


Additional guides
Some more random reading, if you are interested:

Nvidia setup in openSUSE

Xubuntu pimping guide

Steam setup for Linux Mint and Kubuntu

Skype setup in Ubuntu Salamander

An older guide on Linux printing

Working with subtitles in Linux software

And there's more. Close to 1,000 articles on Dedoimedo.

Best Linux resources
Now that you have invested so much of your time, how about some more reading. Here's my short list of the finest resources for your Linux escapades, so you can become proficient and cool.

Distrowatch is your one-stop shop to finding Linux. This is the de-facto Linux distro portal, where you can find the listing of pretty much any important distro out there. You also get screenshots, links to reviews, and tons of other informations.

For Ubuntu users, Ask Ubuntu is a very good "how do I" resource. Hop yonder and start asking questions. It is the official Ubuntu support channel, in addition to Ubuntu forums, so you can find a lot of useful stuff that may help you get around.

Webup8 has a lot of interesting tutorial for many distribution, despite a small preference for Ubuntu flavors. Tutorial on Webup8 are detailed and useful, often accompanied with command-line instructions to get things working.

LinuxCommand.org will teach you how to use shell scripting.

HowtoForge offers ton of guides for servers.

And my own site, of course!

Serious questions to all readers
Now, I have a few serious questions for you, before we conclude this tutorial. First, would you like to see this article transform into a book, akin to my Apache guide or the Linux Kernel Crash Book, both of which proved to be fairly popular. If so, ping me.

Second, do you feel like anything is missing? Talk to me, and I may add an updates section with additional pointers, tips and tricks. We probably cannot cover everything, but there might be other, obvious things that I failed to include.

Updates & user questions
To be added if the popular demand proves demanding enough ...

Conclusion
There you go. I do like to brag a lot, still I believe this article truly merits praise. It gives the single most comprehensive view of Linux, top to bottom and then back up. Sure, this is only the tip of the iceberg, but you have the comparison to Windows in every single aspect, and you can see the major differences.

Try to follow the whole thing, don't skip any sections. Once you have read everything, you will have gained a decent understanding of the Linux operating system, the many subtle nuances between its varying editions and flavors, and finally, you will know how to setup pretty much any distro, perform multiple installations side by side, and administer your desktop with ease and elegance. It won't be easy, but it's a start. Take care.
 

Soulbound

Moderator
Verified
Staff Member
Well-known
Jan 14, 2015
1,761
Hello Linux user,
This guide is a copy paste from the original article here- The ultimate guide to Linux for Windows users

Tho the guide is extensive, there is some misinformation.
Linux mint is entirely based on Ubuntu for starters. Should also make note that Ubuntu was actually built based on Debian code, hence why both use APT, but Ubuntu developed the PPAs which you can actually use on Debian if you know what you are doing.

Just because they put Cinnamon and MATE, which are their inhouse DEs, doesn't mean the base is not Ubuntu. What they have extra are repos aside from Ubuntu official repos.

This guide also touches briefly some distros but then where is the Debian love?

A new user will not really read through all that.

Also, there are specifically 2 wiki pages that have extensive information for Linux user, even if you do not run them: Arch and Gentoo

Those are the two that will go step by step in CLI partitioning for example. Sure not everything in the wiki's are applicable for let's say Ubuntu/Debian/OpenSUSE/Fedora but it does have a wealth of information available.
 

TheJokerz

Level 7
Verified
Well-known
Jan 7, 2016
311
This is a great refresher! As I do not use Linux everyday! This thread has a ton of useful information. Thanks for this!
 
  • Like
Reactions: Dirk41

BoraMurdar

Community Manager
Thread author
Verified
Staff Member
Well-known
Aug 30, 2012
6,598

Handsome Recluse

Level 23
Verified
Top Poster
Well-known
Nov 17, 2016
1,242
Tho the guide is extensive, there is some misinformation.
Linux mint is entirely based on Ubuntu for starters. Should also make note that Ubuntu was actually built based on Debian code, hence why both use APT, but Ubuntu developed the PPAs which you can actually use on Debian if you know what you are doing.
I think they behave differently enough that they're practically different. The Linux world is heavily fragmented.
 

About us

  • MalwareTips is a community-driven platform providing the latest information and resources on malware and cyber threats. Our team of experienced professionals and passionate volunteers work to keep the internet safe and secure. We provide accurate, up-to-date information and strive to build a strong and supportive community dedicated to cybersecurity.

User Menu

Follow us

Follow us on Facebook or Twitter to know first about the latest cybersecurity incidents and malware threats.

Top