Fundamentals and working of Linux.
Table of contents
Linux File-system Structure: IMP
*
Everything in Linux either is a file or can be represented as a file. So, understanding the file system would mean understanding the whole system. So, here is a simplified meaning of all file systems.
bin (binaries) folder or usr (in linux) folder contains all the commands that we use in the command line, ex- ls,
mkdir
, etc.dev folder has all the devices that are connected to the system.
lsblk
and checking the storage system with most storage assigned to it. Now, to select the dev folder type cd /dev
, then type ls to list out all the files in /dev folder. Now, search for the storage file, you will find it among the list.home folder has everything that a user needs to read and write data like Desktop, downloads, documents, etc.
etc folder contains configuration details like any changes made to default settings.
lib folder contains compiled code (for example, c code) and all the applications in the system can access ar have their code stored in library.
media folder contains all the data to access from a mounted device such as a flash drive. When a flash drive is mounted on to the system, we can access it from the media folder.
opt folder contains optional files, which are all the software packages that you might have installed from the net. but they are not needed to run the system.
proc folder is where the files for processes are stored.
root folder is like the home folder for root users, as root users have a higher level/ administrator control they have their own root folder.
run folder had daemons in it. daemons are services that always need to be run in the background they can be a software or a service that provides functionality to other services that needs to always be on. The processes that need to start/run at the start or boot of the system go into the run folder.
sbin or system binaries contain executables that can be accessed by root only. commands like shut down, reboot which directly manipulate the system files come under this folder. It is like
user/bin
folder but accessible on parent folder.srv folder contains all the data that your system serves to other processes.
sys folder is same as
/proc
or/dev
, but for the kernel.temp folder is for temporary files. If you have a process that temporarily creates some files and clears them right after they go into this folder.
usr folder has all the files, bin, lib and share folder (for data that is shared) for all the users on the system.
var folder is for data that is prone to change, like log files which are constantly updated. so, all the things that are not static and change over time like web files go into this folder.
Linux Commands:
IMP
*Learning common commands will come in very handy, so be sure to memorize theses or practice them enough.
whoami
, returns you the username of the ser you’ve signed-in through.id
, it will give you your user ID along with gid (group id) and the groups linked to your ID.hostname
, it will return the name of the host.uname -v
, gives you the kernel version (But, on Ubuntu it gives you the release of ubuntu.)uname -r
, gives you the release version.pwd
, it tells you about which directory your shell is currently in.ifconfig
, tells you the IP address along with subnet mask and all the other details.ip a
, gives the exact same information as ifconfig.echo $PATH
, it lists out the path of all the bin folders that the shell will search for, when you run a command.💡[DO NOT TRY] export PATH=’’, this clears the path of all the bin files that it accesses in order to search the meaning for the command. So, the shell almost breaks and can’t take any more commands like ls, cd, etc. But it can still execute the command if you specify the path.ex -
/usr/bin/ls
will still give us the list of home folder.sudo
, lets us run the commands as root.💡Try any runsudo cat /etc/shadow
, here we are accessing the shadow files which have all the hashed passwords. You can observe that at the end of this list, you can find the password of the user account and the root account all-hashed out.
Subscribe to my newsletter
Read articles from Sahith Kudupudi directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Sahith Kudupudi
Sahith Kudupudi
Hello! I'm Sahith Kudupudi a B.Tech Student. I also am a dedicated blogger and coding enthusiast. I would like to make the journey of pursuing cybersecurity a bit easier for Beginners and I also enjoy making cool projects in CSS. Welcome to my corner of the internet!