This is a summary of GNU/Linux filesystem. For a longer version of documentation you can refer to https://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/c23.html The root of GNU/Linux filesystem is / directory. In this directory there are many directories or folders with files for various purposes. /bin contains the most essential binaries of the system. /boot contains the kernel and boot loader configuration. GRUB(GRand Unified Bootloader) lies on MBR(master boot record) of the hard disk. /dev contains the list of all devices. /etc contains the configuration files for various programs running in the GNU/Linux operating system. /home is used as home directory for most of the users. For example, my home directory is /home/shiv on my computer. However, a system administrator can configure home directories to belong to elsewhere in the system as well. /media, /mnt, /cdrom are used to mount storage devices on them. Mounting is a process by which a block(storage) devices is mapped to a directory of the system much like C:, D: etc of Windows. /proc contains the proc filesystem which contains the information of all running processes. /opt is the directory where other software can be installed or get installed. Some third-party software choose to install themselves in /opt directory. /usr is a very important directory. /usr/bin is the folder where most binaries are installed. /usr/lib contains the libraries. On 32-bit systems it contains 32-bit libraries and on 64-bit systems it contains 64-bit libraries. Now most of systems are 64-bit so we will focus on 64-bit systems only. /usr/lib32 contains 32-bit libraries on 64-bit systems. /usr/share contains various stuff like documentation in /usr/share/doc. Usually /usr/share contains architecture-indpendent data. /usr/include contains include files of C and C++ programming languages. /usr/man contains manual pages of programs and various other stuff. /usr/local is empty to start with but is default prefix for any program which is installed from source code locally. /usr/info contains the info documents for programs. There are other directories in /usr of some interest which you can read in the link given above. /root is the home directory of root. root is superuser or default administrator of GNU/Linux or Unix systems. No restrictions apply on a root user. /sbin and /usr/sbin contain the programs to be executed by the superuser root. /var contains many subdirectories like /var/log contains log from many system programs. /var/run contains runtime information like sockets and pids from programs. /var/lib contains downloaded packages by package managers apt, yum etc and database files from databases like MySQL and PostgreSQL. /tmp contains temporary filesystem. It may be on disk or memory. If /tmp is formatted using tmpfs then it is in memory.
With this we come to an end of summary of most important filesystem. Now we will explore useful command in next blog onward.
GNU/Linux comes with different desktop environments. Most popular of those are KDE, GNOME 3, Mate(which is a fork of GNOME 2), Unity(only for Ubuntu), LXDE, Xfce etc. Depending on your desktop environment you will have a terminal program. For example, on KDE is it called Konsole, on Unity it is called Terminal, on LXDE it is called Lxteminal and so on. If you work on a machine without GUI then the terminal will be a black and white terminal which you will typically login on using ssh. For example, when I login on this server where this WordPress installation is running it looks somewhat like following:
GUI terminals usually support tabs so that you can run multiple processes which occupy terminal, for example, in one you can run an editor like vi or Emacs and in another you can run a Python web server. For knowing shortcuts of these different GUI terminals you should browse File, Edit, View and Settings in the menu. If you do not run a GUI at all then you have six terminals for pure console experience which can be activated using keystrokes Ctrl + Alt + F1 through Ctrl + Alt + F6.
Advantages of console
There are lots of commands in GNU/Linux which you will come to learn but it is a gradual process. There are lots of commands but only a handful of them are used repeatedly. You might ask why go through such a painful process of learning these commands when we have GUI available. The answer lies in two reasons. First, running GUI on a server is expensive as it eats up precious resources of a server. Second, it is very easy to automate or program for commands using bash scripts or any other programming language. Also, once you acquire proficiency with the command-line you will save a lot of time as it will be your second nature to execute these commands and you will rarely tough mouse which eats up lot of time.
GNU/Linux comes with very high quality documentation in form of man(short for manual) pages or info documents. We will see later how to use these documents to retrieve help for the particular command in questions. Note that quality of these documents may vary depending on the individual author who has written them.
With this we come to end of this post. From next post onward we will see various commands in action with most common options to make our life easy with GNU/Linux command line.
GNU/Linux is quite popular on server side but most of the desktop or personal computer users prefer Windows/Mac OS despite the superior quality and number of software offered by GNU/Linux’s various distributions. The main reason for this is fear of GNU/Linux command line. People still treat it as a tool for geeks while in reality it is very simple tool.
This series of tutorial will be aimed for people new to GNU/Linux command line and will use Ubuntu distribution as base operating system as it is most popular of all distributions. However, it has nothing to do with any particular distribution as the commands are same as long as their version is same across all GNU/Linux distributions.
After going through this series of posts you should feel pretty comfortable with GNU/Linux command line and enjoy the speed and programmatic advantage it has to offer as compared to GUI tools.
My name is Shiv Shankar Dayal and I am a programmer by profession. This blog is about programming and Mathematics. I worked in Indian IT industry for 15 years but now I am a full-time blogger. This blog will contain blog on various topics of programming and mathematics.
The goal will be to take a beginner from zero to expert level in both programming and mathematics. I will start mathematics from class 8 to mathematics olympiad. Before I joined my college mathematics used to be my favorite subject and then computers took over. In this age of data science and artificial intelligence it is of paramount important to have strong grasp on mathematics fundamentals. My mathematics blog which will have questions will contain no more than 5 questions in one blog.