- What is the Purpose of bin Directory
- Purpose of Binary Directories in Linux
- How to View the Binary Files in Linux?
- Conclusion
- Purpose of Bin Directory [closed]
- 2 Answers 2
- Introduction
- Linux File Hierarchy Structure
- Difference between /bin and /usr/bin
- What about /usr/local/bin ?
- what do these directory is used for in linux? etc/ bin/ and lib/ [closed]
What is the Purpose of bin Directory
In Linux, the “bin” (binaries) is the directory composed of executable files. These files store the encoded machine code in binaries executed in the system. The binary language is not understandable for the users but systems can understand it. There are various “bin” directories available in Linux such as ”/bin”, “/sbin”, “/usr/bin”, “/usr/sbin”, “/usr/local/bin” and “/usr/local/sbin”.
This post will enlighten the purpose of all the bin directories in Linux distributions.
Purpose of Binary Directories in Linux
As mentioned earlier, bin directories have various types based on location. The purpose of each binary directory is described in the below section.
“/bin”: The “/bin” directory contains the executable binary files that are part of the core operating system like commands such as “cp”, “mv”, and “apt”, etc.
“/sbin”: The “sbin” directory contains executable binary files for booting, repairing, restoring, and recovering the Linux system.
“/usr/bin”: the “/usr/bin” directory contains executable binary files that are required for the logged-in users same as the “/bn”
“/usr/sbin”: The “/usr/sbin” directory stores the binary files related to the administrative commands that are only executed by the sudo (root) users.
“/usr/local/bin”: The “/usr/local” directory holds third-party applications/software installation files. The executable binaries for these applications are stored in the “/usr/local/bin” directory.
“/usr/local/sbin”: The “/usr/local/sbin” directory holds the binary files of installed programs for system administration.
How to View the Binary Files in Linux?
To view any binary files in Linux, the user can use the “xxd” command. By default, it displays the file output in hexadecimal format, to convert the result into binary, use the “b” flag and specify the binary file name.
The following command will display the output of the “ls” binary file:
The binary output for the “ls” binary file is listed.
Note: To analyze the binary files in Linux read our latest article here.
Conclusion
The “bin” directory contains the executable binary files of various types which depend upon the location where the “bin” directory exists. These include ”/bin”, “/sbin”, “/usr/bin”, “/usr/sbin”, “/usr/local/bin” and “/usr/local/sbin” which can be viewed using the “xxd” command. The purpose of all these directories is explained in the guide.
Purpose of Bin Directory [closed]
Requests for learning materials (tutorials, how-tos etc.) are off topic. The only exception is questions about where to find official documentation (e.g. POSIX specifications). See the Help Center and our Community Meta for more information.
Could anyone please describe what the purpose of the Bin Directory in Linux is?
I have already had a browse online, but couldn’t find a brief, yet comprehensive, answer.
Try searching Google with the phrase «what is the linux bin directory for». The first hit seems to be pretty clear to me.
First hit is this question. Let’s remember that Google results change with time and by the user, and this is a site for answering questions.
2 Answers 2
Bin is an abbreviation of Binaries. It’s just a directory where a user of an operating system can expect to find applications.
The different directories on a Linux system can be daunting or confusing if you aren’t used to them. There’s a good overview on wikipedia that explains what each standard directory is for.
It contains essential binary files (unlike /usr/bin directory) also for booting. It usually contains the shells like bash and commonly used commands like cp , mv , rm , cat , ls .
Unlike /sbin , the bin directory contains several useful commands that are of use to both the system administrator as well as non-privileged users.
In modern Linux, anyway, the distinction between /bin and /usr/bin is fairly obsolete, though it may hold in some other Unixes. (The original purpose of /bin — to hold enough of a system to boot successfully until you could mount /usr — is now served by initrd/initramfs; many distributions now put all system applications in /usr/bin and make /bin a symlink there.)
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
man hier | grep -E '/bin$|^.(/bin)' -A2
snake@Snake:~$ man hier | grep -E '/bin$|^.(/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.
what do these directory is used for in linux? etc/ bin/ and lib/ [closed]
You can read all about the details by looking up the filesystem hierarchy standard, but in a nutshell:
- /etc : Configuration information
- /lib : Libraries
- /bin : Program binaries that are important to the functioning of the system. (Non-essential binaries are generally found in /usr/bin ; these are generally installed with the operating system distribution. Programs installed after OS installation are generally stored in /usr/local/bin .)
- etc -> To keep configuration files
- lib -> To keep libraries that can be used by installed software or other softwares in your system.
- bin -> Binary files
hi @shadyabhi, do you happen to know /var/log/messages this folder too? what is it used for? im trying to find it in my system, it cant be found
/var/log/messages That will be a file & it may exist or it may not depending on how syslogging is configured on your system. I can’t say anything about why it isn’t present without getting your configuration file for your syslogging program.
@ruggedbuteducated /var/log/ is a directory generally used for storing logs. All programs generally write to /dev/log file socket which is picked up by syslog program such as syslog-ng or rsyslog etc etc. Then this syslog program reads from that file socket and depending on which program is sending logs, write to a appropriate file under /var/log/ generally. Generally, messages is present and programs write to it most. You can check what are your recent files in /var/log by using ls -ltr /var/log . It could be everything.log or messages.log etc etc.
bin — Contains binary files to configure the operating system.(In the binary format)_________ etc — contains machine specific configuration files in editable format. _________ lib -> contains shared binary files which are shared by bin and sbin.