Ultimately, if you use the GUI, you learn to use that interface, but you are missing on how the OS actually works. Believe me, when you start getting an understanding on how the system works and what it does, when you start to get where to look when something fails or what to change in order to fix it, that's when you experience a great feeling of empowerment. On top of that, the GUI is great for certain activities, but it is very limiting when it comes to others.
Obviously, I am sure you have read very similar statements before, and none have convinced you to actually learn to use the command line. Guess what? I am not going to try to. All I want to do is explain some of the basics. If after reading this you feel you are the kind who might enjoy understanding how the computer does what it does, then you might actually want to jump into the cold waters after me. Otherwise, I hope this was not too boring!
First off, I want to provide some background about the shell as it stands in Linux today. I also want to share some interesting commands I use regularly, which might help you as well. Let's start with some basic concepts:
WHAT IS BASH?
BASH is a command interpreter that is widely extended in the Linux world. It is the GNU reinterpretation of the Bourne Shell (an important early UNIX shell created by Stephen Bourne). In fact, Bash is an acronym, a pun on the name Bourne Shell and the term "born again", thus Born Again SHell.
THE LINUX FOLDER STRUCTURE
If you run this simple command,
ls /
you should get your basic folder structure under the root directory, looking something like this (displayed as a list here for formatting reasons):
bin
boot
cdrom
dev
etc
home
initrd.img
initrd.img.old
lib
lost+found
media
mnt
opt
proc
root
sbin
selinux
srv
sys
tmp
usr
var
vmlinuz
vmlinuz.old
Let's see what some of those folders are used for in Linux. Understanding the basic folder structure will help you in seeing the big picture!
BOOT folder
Contains the Kernel, some drivers that may be required at boot time, and the boot loader. In the current version of Ubuntu, that turns out to be GRUB2. For example, if you wanted to take a look at the GRUB2 script that controls the boot of your system, you can do so by running the following command (note that this file is not meant to be manually edited):
less /boot/grub/grub.cfg
DEV folder
Contains a list of all the devices (actually, device nodes) recognised by the kernel. For example, your hard drive is mounted under one of these nodes, most probably SDA1. For a list of all device nodes, you can run the following command:
ls /dev
ETC folder
Contains system wide variables, such as passwords, information about file systems, and even your repository sources. You may have actually edited those sources manually already, but if you have not, you could do so by running the following command:
sudo gedit /etc/apt/sources.list
You could obviously run it with any other visual text editor, or even with nano or vi, whatever your preference.
HOME folder
Here's where ordinary users folders are stored, and for the most part, it will be the only location you have rights to modify in a properly configured Linux system. This is actually one of the features showing the strength of Linux security. As opposed to Windows, where any user can go ahead and save or modify files under C:\windows\system32, for example, nobody can do such changes in Linux out of the box.
MEDIA folder
Here's where modern Linux systems mount removable drives. USB external drives, CD and DVD devices... They all are listed under this folder.
OPT folder
Optional software is stored in here. As an example, I have Adobe AIR and TweetDeck stored under this folder.
USR folder
Contains general applications used by standard users. It usually is a very large folder, as it contains hundreds of applications. Some interesting folders under the USR one include the BIN folder, which contains the applications themselves and the LIB folder, which holds documentation for those applications.
USR/SHARE folder
This folder deserves a bit more attention due to the useful information it contains. It basically holds shared data used by applications under
/usr/bin
. For example, you can find your system icon themes under /usr/share/icons/themes
.VAR folder
The information that is likely to change is stored under this folder. For example, we can find logs, which are stored under the
log
folder. In order to take a quick glance at the latest changes in your system log, you can try the following command:less /var/log/syslog
You can also check boot logs to check if you had issues when starting up your machine:
less /var/log/boot
TO BE CONTINUED...
Let's stop here, as there is a lot of information already for you to digest!. I very much encourage you to investigate your system folder structure. Understanding its logic will get you closer to understanding your system, which is already quite a step forward.
In the next installment of these series, I will cover some commands that I often use. I hope you find them just as useful!
0 comments:
Post a Comment