Introduction
Linux is a Unix-like, open source and community-developed operating system for computers💻, mobile devices📱, servers🖥 and embedded devices. Whether you know it or not, Linux is everywhere from your smartwatch⌚ to self-driving cars🚗.
Linux was known for being less intuitive and only for people who do tech-stuff but time has changed ⌛. Linux has something for everyone.
It has GIMP as a Photoshop alternative
, Gedit as a Notepad alternative
, VLC media player as a Windows media player alternative
and many such software alternatives.
If you have been a Windows user💻 and have switched to Linux to look super nerdy🤓 or to crack linux jokes(yeah some people do), you might find it hard even to do basic things like copying, moving and deleting files or switching between directories.
Let's say you're exploring Linux for the first time, and you happened to be in the top level root directory
(/). Now if you typed ls
, you may come across a lot of the stuff which you think you know about. But it's highly likely that you interpreted it wrong.
For example, /bin
might sound analogous to the Recycle Bin
in Windows but that's not the case. Both are way different.
Although most of the modern Linux distributions come with the GUI, the real power of Linux is in it's CLI👨💻 and not GUI.
Linux File Hierarchy Structure
Linux file hierarchy structure describes the directory structure and it's contents in Unix and Unix-like Operating systems. It is maintained by Linux Foundation.
You can learn more about it here.
Difference between /bin and /usr/bin
For checking the difference between /bin
and /usr/bin
, type in the command :
man hier | grep -E '/bin$|^.{7}(/bin)' -A2
It would give output :
snake@Snake:~$ man hier | grep -E '/bin$|^.{7}(/bin)' -A2
/bin This directory contains executable programs which are needed in single user mode and to bring the sys‐
tem up or repair it.
--
/usr/X11R6/bin
Binaries which belong to the X-Window system; often, there is a symbolic link from the more traditional
/usr/bin/X11 to here.
--
/usr/bin
This is the primary directory for executable programs. Most programs executed by normal users which
are not needed for booting or for repairing the system and which are not installed locally should be
--
/usr/local/bin
Binaries for programs local to the site.
The output says it all.
So, that's all for the blog. I hope you understood it.
.
.
.
.
Well, not really. There's a good historical reason for this split.
Back in time, when Ken Thompson and Dennis Ritchie were developing UNIX on a PDP-11, they used a pair of RX05 disks of 1.5 MB each.
As the Operating system grew bigger in size, first RX05 disk got filled up. So, a second RX05 disk was used and the mount was created by the name /usr
. All the directories like /bin, /sbin, /tmp were replicated under it.
So, First RX05 disk contained the binaries which would help in its bootup(like single-user mode).
And the Second RX05 disk contained a lot less and least used binaries during that time until multi-user mode came into existence.
As the time passed the storage capacity on a disk drive increased exponentially and in this modern world, even the throwaway disk will have at least multi-gigabyte capacity. So, for a person born in this era, it's hard to imagine why the split would be made.
What about /usr/local/bin ?
/usr/local/bin
contains binaries of the third-party apps we install. Any local executable that didn't come with the Linux install may get it's place here.
Same is the case with /sbin
which contains the binaries for root users.