In this chapter we shall study about below topics:
1.1 Linux File system structure
1.2 Linux terminal introduction
1.3 Linux commands shortcut symbols
1.4 About Linux commands
1.1 Linux File system structure
The below image shows the structure of Linux file system. We shall go through one by one about these directories in brief.
In Linux, everything is a file. Whether it is a video, audio, external devices etc. It will consider everything as a file. A directory in Linux is a file, which groups together other files.
/ – This is the root of the file system. Every file in Linux should start from root and can continue to has its own directory. Please don’t confuse it with the “root” user.
/bin/ – This stands for binary. Here most of the programs required for system start-up are installed here. Some of them include, shell, commands like “ls, ps, kill, echo”. The programs installed here can be executed by root user and also normal user.
/opt/ – This is optional directory. Here some of the programs that are not part of the standard installation will be stored here.
/boot/ – This directory will have all the files required for booting up the system. This might contain master boot records, sector/system map files.
/root/– This is the root user in Linux. He has control over all the system. Don’t confuse it with “root of the file system”
/dev/ – This directory will have special devices files that are present in the computer. “/dev/cdrom/” will represent the cd rom. “/dev/usb” will have usb devices.
/sbin/ – This is a system binary files. The files in this directory cannot be run by normal user, but only be run by admin.
/etc/ – This directory holds all kind of configuration files for the system. It is recommended that you need to take backup of this directory regularly, if any program messes up this directory then we can go back to the previous configuration easily. All the settings will be in the text configurable format.
/home/ – This directory will be created for every user of the system. This directory will be available only to that user and to the “root” user. You can have your personal files here, they will not be shared with any other user, except the root user.
/tmp/ – Temporary directory. This directory will be usually cleared when the system is rebooted.
/lib/ – This directory will have the shared library images. These images will be required to boot up the system. These libraries can be used by user applications also.
/usr/ – Stands for “Universal Resources” not “user”. The files available in this folder will be available to all the users.
/media/ – This directory will contain the plug-in devices like usb, cdrom. Any thing that is mounted to media will be shown on the desktop.
/var/ – Variable data directory. This is where most of the system logging files and directories are stored.
/mnt/ – This is a generic mount point. System admin can mount a file system temporarily and remove when not needed.
1.2 Linux terminal introduction
Linux allows a user to interact with the system kernel with the help of shell. With the help of commands, we interact with the kernel.
A typical Linux command will have the following syntax:
command -options
For example:
ls –al
[ls command is used to list all the files and directories present]
To get to know about any command in detail, use “man <command_name>”.
Example:
man ls
“man” stands for manual pages. These pages will be updated when you update with the latest kernel.
1.3 The “username@hostname~]$”
Whenever you enter into the terminal as a normal, you are greeted with the above line, at beginning of every line.
For me it will show as below:
Let us learn more about the above line:
Detail about <username> field:
The first field represents username from which you have logged in. From the above image it is “ajay”.
“@” field:
It represents a simple “@” or at.
“hostname” field:
This field is the name of the computer you are working on. My system name is “localhost”.
“~” field:
In this context “~” represents the home directory of the user. In general, this field will show the present directory.
My home directory
When I change the directory, “~” field shows the present directory.
“$” filed:
This field shows the authorization level. If it is “$” then you are normal user. If there is “#” then you are the root user.
Below image shows the root user.
“root” filed represents that the user is a super admin. He has the access to all the files and modify those files without restrictions.
“#” shows the authorization level, as a root account.
1.4 Linux commands shortcut symbols
While working in command prompt, these shortcuts mentioned below will come handy.
ctrl + a = Go the start of the command
ctrl + e =Go to the end of the command
ctrl + r = search command history backwards
ctrl + l = Clear screen
ctrl + c = stop execution of a command
ctrl + z = suspend execution of a command
!! = run the last command
!* = run previous command except for last word
1.5 About Linux commands
As we studied in the previous section, a command can be used along with the parameters. Those parameters or options change how a command should execute.
Below we shall look into a simple example.
We shall use “ls” command.
ls command is used to list the files in a directory.
When “ls” is used without any parameters below is the output.
Using “ls –a”, it will show the hidden files also.
Using “ls –al” will show hidden files also with the author, last modified date and other related information.
Rae
I discovered your site from Google and I have to say
it was an excellent find. Many thanks!