This is the second post in Linux Series and in this post we will discuss about some basics of Linux like File System and some other topics like shell and command-line.
In case of installation of Linux, for learning purposes it is advised to use VMeare or Virtual Box (what I will be using) and then download one of the distributions of linux like Ubuntu (distro I will be using) or Debian from the Internet and install it.
Now to the basics. First about Linux File System.
Linux File System
A File System is a system of managing files like images, text files etc and folders (directories) in an operating system. Linux uses UNIX Filesystem Hierarchy Standard (FHS) for arrarnging directories and files into the filesystem.
Linux filesystem is different form most of the OS like Windows. It does not uses partition system like C: and D: drives in Windows. At the very top of the filesystem is /
which is the root directory like a root of a tree but upside down. The /
or root contains all the important subdirectories like /root
and /bin
etc. following are some most important subdirectories in Linux filesystem.
- /root - Home directory of the superuser or Admisintrator
- /bin - Contains all the binaries or executibles, programs that you can run example: ls, cat, pwd etc
- /dev - Contains device files
- /home - User's home directory
- /lib - Contains all libraries of code used by programs
- /mnt - Where other filesystems are attached like USBs or Hard Drives etc
- /tmp - Contains temporary files
- /boot - Contains files required for the system to start
Navigating the Linux FileSystem
Unlike Windows or MacOS where Graphical User Interface or GUI is used to navigate the filesystem, Linux uses shell also known as command-line or terminal to navigate the filesystem. In terminal, commands are used to perform actions like finding current directory or moving or deleting files etc.
When you open a terminal or shell or command-line, you will find somthing already written in the terminal like following.
root@User:~$
This is called a prompt. You write the commands in front of the dollar sign and hit enter and it will perform the action of the command. The ~
or Tilde sign means you are in the home directory.
After opening a terminal you have to know in what directory you are in and to find that pwd
command is used.
root@User:~$ pwd
/root
you are in the /root directory if you logged in as the superuser.
I have already written about command-line and some basic commands to know to work with Linux, So I will not write them again and if you want to, you can read it Here.
Some commands that are not discussed in the above mentioned post that are also necessary to know are following.
Creating a file
Command: touch
root@User:/$ cd tmp
root@User:/tmp$ touch new_file.txt
root@User:/tmp$ ls
new_file.txt
Looking for help
Command: man
Typing man with the command as the argument will show the Manual Pages for the command.
root@User:/$ man clear
clear(1) General Commands Manual clear(1)
NAME
clear - clear the terminal screen
SYNOPSIS
clear [-Ttype] [-V] [-x]
DESCRIPTION
clear clears your screen if this is possible, including
its scrollback buffer (if the extended “E3” capability
is defined). clear looks in the environment for the
terminal type given by the environment variable TERM,
and then in the terminfo database to determine how to
clear the screen.
...
...
...
and Many more I will discuss in the next post.