Abhishiktapanja
Linux for the Everyday Man
16 min readSep 26, 2019

--

LINUX OPERATING SYSTEM

Linux has been around since the mid-1990s created by Linus Torvalds and has since reached a user-base that spans the globe. Linux is actually everywhere. It’s found in phones, thermostats, cars, refrigerators, Roku devices, and televisions. It also runs most of the Internet, all of the world’s top 500 supercomputers, and the world’s stock exchanges.

I. WHAT IS LINUX?

Linux is the best-known and most-used open source operating system. As an operating system, Linux is software that sits underneath all of the other software on a computer, receiving requests from those programs and relaying these requests to the computer’s hardware.

Linux was designed to be similar to UNIX, but has evolved to run on a wide variety of hardware from phones to supercomputers.Depending on which user survey you look at, between one- and two-thirds of the webpages on the Internet are generated by servers running Linux.

The code used to create Linux is free and available to the public to view, edit, and — for users with the appropriate skills — to contribute to. Android, is powered by the Linux operating system.

The Linux operating system comprises several different pieces:

  1. Bootloader — The software that manages the boot process of your computer (i.e., GRUB or GRand Unified Bootloader).
  2. Kernel — The kernel is the core of the system and manages the CPU, memory, and peripheral devices. The kernel is the lowest level of the OS.
  3. Init system — It is the init system that manages the boot process, once the initial booting is handed over from the bootloader.
  4. Daemons — These are background services (printing, sound, scheduling, etc.) that either start up during boot or after you log into the desktop.
  5. Graphical server — This is the subsystem that displays the graphics on your monitor. It is commonly referred to as the X server or just X.
  6. Desktop environment — This is the piece that the users actually interact with. There are many desktop environments to choose from (GNOME, Cinnamon, Mate, Pantheon, Enlightenment, KDE, Xfce, etc.). Each desktop environment includes built-in applications (such as file managers, configuration tools, web browsers, and games).
  7. Applications — Desktop environments do not offer the full array of apps. Most modern Linux distributions include App Store-like tools that centralize and simplify application installation. For example, Ubuntu Linux has the Ubuntu Software Center which allows you to quickly search among the thousands of apps and install them from one centralized location.

II. ADVANTAGES OF LINUX:

  • Linux systems are extremely stable
  • Linux is Free
  • No threat of viruses
  • Linux comes with most of the required software pre-installed
  • Update all your software with minimum fuss
  • Linux never gets slow
  • Linux does not need fragmentation
  • Linux can even run on oldest hardware
  • Adding more software is a matter of a few clicks
  • Most Windows-only apps have their either their native version or alternatives for Linux
  • With Linux you get the highest degree of possible customization

III. DISTRIBUTORS OF LINUX:

Debian Based Linux Distributions

The deb package type was created in 1993 for the Debian Linux distribution. Debian is one of the oldest Linux distributions and it’s a very popular choice on which new distributions are based. Popular distributions that use .deb packages include:

  • Debian
  • Ubuntu
  • Linux Mint
  • SteamOS

RPM Based Linux Distributions

RedHat created the rpm package format for use in its distribution. Popular RPM based distributions include:

RedHat Enterprise Linux (RHEL)

  • CentOSZ
  • Fedora
  • OpenSuse
  • Mageia

IV. WHICH DISTRIBUTION IS FOR YOU?

  • If your computer skills are fairly basic, you’ll want to stick with a newbie-friendly distribution such as Linux Mint, Ubuntu, Elementary OS or Deepin.
  • If your skill set extends into the above-average range, you could go with a distribution like Debian or Fedora.
  • If, however, you’ve pretty much mastered the craft of computer and system administration, use a distribution like Gentoo.
  • If you really want a challenge, you can build your very own Linux distribution, with the help of Linux From Scratch.

V. COMPARISON OF FILE SYSTEMS IN WINDOWS AND LINUX

  • Directory Structure: You won’t find any Windows, Program Files, or Users folders if you start browsing around the file system on your Linux computer

For example, on Windows, an application might store all its files in C:\Program Files\Application. On Linux, its files would be split between multiple locations — its binaries in /usr/bin, its libraries in /usr/lib, and its configuration files in /etc/.

  • Case Sensitivity: On Windows, you can’t have a file named file and another file named FILE in the same folder. The Windows file system isn’t case sensitive, so it treats these names as the same file.

On Linux, the file system is case sensitive. This means that you could have files named file, File, and FILE in the same folder. Each file would have different contents — Linux treats capitalized letters and lower-case letters as different characters.

  • Backslashes vs. Forward Slashes: Windows uses backslashes, just as DOS did. For example, the path to a user’s directory on Windows is:C:\Users\Name

On Linux, the path to a user’s home directory is:/home/name

  • No Drive Letters — It’s All Under / : On Linux, everything is under / — the root directory. There are no files above the root directory, as there are files outside of C: on Windows. When you connect a device to your computer, it will become available under /media/. The contents of the directory display the contents of the mounted partition.
  • Everything is a File: Just as every mounted file system is a directory under / (the root directory), everything on Linux is a file. For example, your first hard drive is represented by /dev/sda, your CD drive is available at /dev/cdrom, while your mouse is represented by /dev/mouse.
  • You Can Delete or Modify Open Files: On Linux and other UNIX-like operating systems, applications don’t lock exclusive access to files as often as they do on Windows. For example, let’s say you’re watching a video file in VLC on Windows. The credits are playing and you’re done watching it, so you try to delete it. You’ll see an error message- — you need to stop watching the file in VLC before you can delete it, rename it, or do anything else to it.

On Linux, you could generally delete or modify the video file as it was playing. You won’t see error messages saying the file is in use.

VI. THE ROOT DIRECTORY

/root is a standard first-tier directory in the root directory (as are /bin, /boot, /dev, /etc, /home, /mnt, /sbin and /usr). The root directory is the top level directory on any Unix-like operating system, i.e., the directory that contains all other directories and their subdirectories. It is designated by a forward slash ( / ). As is the case with all other first tier directories in the root directory, /root’s name always begins with a forward slash.

Folders inside the Root Directory:

  • /bin- Essential command binaries
  • /boot- Static files of the boot loader
  • /dev- Device files
  • /etc- Host-specific system configuration
  • /lib- Essential shared libraries and kernel modules
  • /media- Mount point for removable media
  • /mnt- Mount point for mounting a filesystem temporarily
  • /opt- Add-on application software packages
  • /sbin- Essential system binaries
  • /srv- Data for services provided by this system
  • /tmp- Temporary files
  • /usr- Secondary hierarchy
  • /var- Variable data

VII. DUAL BOOTING VS VIRTUAL BOX

When you should go for dual booting?

  • Go for dual booting an OS when you want to make it a core part of your PC. You must be willing to use the secondary OS for a longer period as it’s hard to get rid of an OS in a dual boot setup.
  • If the file system is the same for both the operating systems, then all your data will be available to both OS, which is both good and bad. For example, you can run apps installed in one OS in the other one as well, no need to reinstall. On the other side, it’s difficult to separately manage data of each OS as the data is mashed together. Virus in one OS can also affect the other one.
  • If you want to run resource-hungry programs in the secondary OS, then go for dual booting. Apart from disk space, each OS will have full access to the PC resources, including RAM, GPU and CPU power, etc. For example, you might be a Linux user, but your work requirement is to use Photoshop that isn’t available on Linux. In that case, you can dual boot Windows to run Photoshop and have enough resources to actually run this heavy program.

Why go for virtualization?

  • Most people use virtual machine for mere experiments and usually the OS life is also limited. I am not saying you can’t use an OS for the long term in a virtual environment, but it just works better for quick use and experimenting. For example, if you want to install preview build of Windows 10 for testing purpose, then a virtual machine is perfect for this. It’s easier to install, and to get rid of the OS when you are done.
  • As both the host OS and virtual machine OS can work simultaneously, it’s good when you need to work in both the OSes at the same time. Apart from working with separate apps in each OS, you can also move data between operating systems as the same clipboard is shared by both host OS and the virtual machine.
  • You can easily install and use dozens of OSes if you like. Like if you love fiddling with different Linux distros? The virtual machine is the way to go.
  • If you are not looking to run any heavy 3D graphics based programs, then virtualization is usually a better option.

VIII. WHAT IS CLI?

  • CLI (command line interface) is a shell is a program that receives commands from the user and gives it to the OS to process, and it shows the output.
  • The Linux CLI is a text interface to your computer. Often referred to as the shell, terminal, console, prompt or various other names, it can give the appearance of being complex and confusing to use.
  • The ability to copy and paste commands from a website, combined with the power and flexibility the command line offers, means that using it may be essential when trying to follow instructions online — including many on this very website.

Basic CLI Commands:

1. pwd — When you first open the terminal, you are in the home directory of your user. To know which directory you are in, you can use the “pwd” command. It gives us the absolute path, which means the path that starts from the root. The root is the base of the Linux file system. It is denoted by a forward slash( / ). The user directory is usually something like “/home/username”.

2. ls — Use the “ls” command to know what files are in the directory you are in. You can see all the hidden files by using the command “ls -a”.

3. cd — Use the “cd” command to go to a directory. For example, if you are in the home folder, and you want to go to the downloads folder, then you can type in “cd Downloads”. Remember, this command is case sensitive, and you have to type in the name of the folder exactly as it is. But there is a problem with these commands. Imagine you have a folder named “Raspberry Pi”. In this case, when you type in “cd Raspberry Pi”, the shell will take the second argument of the command as a different one, so you will get an error saying that the directory does not exist. Here, you can use a backward slash. That is, you can use “cd Raspberry\ Pi” in this case. Spaces are denoted like this: If you just type “cd” and press enter, it takes you to the home directory. To go back from a folder to the folder before that, you can type “cd ..” . The two dots represent back.

4. mkdir & rmdir — Use the mkdir command when you need to create a folder or a directory. For example, if you want to make a directory called “DIY”, then you can type “mkdir DIY”. Remember, as told before, if you want to create a directory named “DIY Hacking”, then you can type “mkdir DIY\ Hacking”. Use rmdir to delete a directory. But rmdir can only be used to delete an empty directory. To delete a directory containing files, use rm.

5. rm — Use the rm command to delete files and directories. Use “rm -r” to delete just the directory. It deletes both the folder and the files it contains when using only the rm command.

6. touch — The touch command is used to create a file. It can be anything, from an empty txt file to an empty zip file. For example, “touch new.txt”.

7. man & — help — To know more about a command and how to use it, use the man command. It shows the manual pages of the command. For example, “man cd” shows the manual pages of the cd command. Typing in the command name and the argument helps it show which ways the command can be used (e.g., cd –help).

8. cp — Use the cp command to copy files through the command line. It takes two arguments: The first is the location of the file to be copied, the second is where to copy.

9. mv — Use the mv command to move files through the command line. We can also use the mv command to rename a file. For example, if we want to rename the file “text” to “new”, we can use “mv text new”. It takes the two arguments, just like the cp command.

10. locate — The locate command is used to locate a file in a Linux system, just like the search command in Windows. This command is useful when you don’t know where a file is saved or the actual name of the file. Using the -i argument with the command helps to ignore the case (it doesn’t matter if it is uppercase or lowercase). So, if you want a file that has the word “hello”, it gives the list of all the files in your Linux system containing the word “hello” when you type in “locate -i hello”. If you remember two words, you can separate them using an asterisk (*). For example, to locate a file containing the words “hello” and “this”, you can use the command “locate -i *hello*this”.

Intermediate Commands:

1. echo — The “echo” command helps us move some data, usually text into a file. For example, if you want to create a new text file or add to an already made text file, you just need to type in, “echo hello, my name is alok >> new.txt”. You do not need to separate the spaces by using the backward slash here, because we put in two triangular brackets when we finish what we need to write.

2. cat — Use the cat command to display the contents of a file. It is usually used to easily view programs.

3. nano, vi, jed — nano and vi are already installed text editors in the Linux command line. The nano command is a good text editor that denotes keywords with color and can recognize most languages. And vi is simpler than nano. You can create a new file or modify a file using this editor. For example, if you need to make a new file named “check.txt”, you can create it by using the command “nano check.txt”. You can save your files after editing by using the sequence Ctrl+X, then Y (or N for no). In my experience, using nano for HTML editing doesn’t seem as good, because of its color, so I recommend jed text editor. We will come to installing packages soon.

4. sudo — A widely used command in the Linux command line, sudo stands for “SuperUser Do”. So, if you want any command to be done with administrative or root privileges, you can use the sudo command. For example, if you want to edit a file like viz. alsa-base.conf, which needs root permissions, you can use the command — sudo nano alsa-base.conf. You can enter the root command line using the command “sudo bash”, then type in your user password. You can also use the command “su” to do this, but you need to set a root password before that. For that, you can use the command “sudo passwd”(not misspelled, it is passwd). Then type in the new root password.

5. df — Use the df command to see the available disk space in each of the partitions in your system. You can just type in df in the command line and you can see each mounted partition and their used/available space in % and in KBs. If you want it shown in megabytes, you can use the command “df -m”.

6. du — Use du to know the disk usage of a file in your system. If you want to know the disk usage for a particular folder or file in Linux, you can type in the command df and the name of the folder or file. For example, if you want to know the disk space used by the documents folder in Linux, you can use the command “du Documents”. You can also use the command “ls -lah” to view the file sizes of all the files in a folder.

7. tar — Use tar to work with tarballs (or files compressed in a tarball archive) in the Linux command line. It has a long list of uses. It can be used to compress and uncompress different types of tar archives like .tar, .tar.gz, .tar.bz2,etc. It works on the basis of the arguments given to it. For example, “tar -cvf” for creating a .tar archive, -xvf to untar a tar archive, -tvf to list the contents of the archive, etc. Since it is a wide topic, here are some examples of tar commands.

8. zip, unzip — Use zip to compress files into a zip archive, and unzip to extract files from a zip archive.

9. uname — Use uname to show the information about the system your Linux distro is running. Using the command “uname -a” prints most of the information about the system. This prints the kernel release date, version, processor type, etc.

10. apt-get — Use apt to work with packages in the Linux command line. Use apt-get to install packages. This requires root privileges, so use the sudo command with it. For example, if you want to install the text editor jed (as I mentioned earlier), we can type in the command “sudo apt-get install jed”. Similarly, any packages can be installed like this. It is good to update your repository each time you try to install a new package. You can do that by typing “sudo apt-get update”. You can upgrade the system by typing “sudo apt-get upgrade”. We can also upgrade the distro by typing “sudo apt-get dist-upgrade”. The command “apt-cache search” is used to search for a package. If you want to search for one, you can type in “apt-cache search jed”(this doesn’t require root).

11. chmod — Use chmod to make a file executable and to change the permissions granted to it in Linux. Imagine you have a python code named numbers.py in your computer. You’ll need to run “python numbers.py” every time you need to run it. Instead of that, when you make it executable, you’ll just need to run “numbers.py” in the terminal to run the file. To make a file executable, you can use the command “chmod +x numbers.py” in this case. You can use “chmod 755 numbers.py” to give it root permissions or “sudo chmod +x numbers.py” for root executable. Here is some more information about the chmod command.

12. hostname — Use hostname to know your name in your host or network. Basically, it displays your hostname and IP address. Just typing “hostname” gives the output. Typing in “hostname -I” gives you your IP address in your network.

13. ping — Use ping to check your connection to a server. Wikipedia says, “Ping is a computer network administration software utility used to test the reachability of a host on an Internet Protocol (IP) network”. Simply, when you type in, for example, “ping google.com”, it checks if it can connect to the server and come back. It measures this round-trip time and gives you the details about it. The use of this command for simple users like us is to check your internet connection. If it pings the Google server (in this case), you can confirm that your internet connection is active!

Extra Tips and Tricks for Using Linux Command Line

  • You can use the clear command to clear the terminal if it gets filled up with too many commands.
  • TAB can be used to fill up in terminal. For example, You just need to type “cd Doc” and then TAB and the terminal fills the rest up and makes it “cd Documents”.
  • Ctrl+C can be used to stop any command in terminal safely. If it doesn’t stop with that, then Ctrl+Z can be used to force stop it.
  • You can exit from the terminal by using the exit command.
  • You can power off or reboot the computer by using the command sudo halt and sudo reboot.

--

--