Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Linux Directory Structure (File System Structure)

Have you wondered why certain programs are located under /bin, or /sbin, or /usr/bin, or /usr/sbin?

For example, less command is located under /usr/bin directory. Why not /bin, or /sbin, or /usr/sbin? What is the different between all these directories?

In this article, let us review the Linux filesystem structures and understand the meaning of individual high-level directories.


1. / – Root

  • Every single file and directory starts from the root directory.
  • Only root user has write privilege under this directory.
  • Please note that /root is root user’s home directory, which is not same as /.

 

2. /bin – User Binaries

  • Contains binary executables.
  • Common linux commands you need to use in single-user modes are located under this directory.
  • Commands used by all the users of the system are located here.
  • For example: ps, ls, ping, grep, cp.

 

3. /sbin – System Binaries

  • Just like /bin, /sbin also contains binary executables.
  • But, the linux commands located under this directory are used typically by system aministrator, for system maintenance purpose.
  • For example: iptables, reboot, fdisk, ifconfig, swapon

 

4. /etc – Configuration Files

  • Contains configuration files required by all programs.
  • This also contains startup and shutdown shell scripts used to start/stop individual programs.
  • For example: /etc/resolv.conf, /etc/logrotate.conf

 

5. /dev – Device Files

  • Contains device files.
  • These include terminal devices, usb, or any device attached to the system.
  • For example: /dev/tty1, /dev/usbmon0

 

6. /proc – Process Information

  • Contains information about system process.
  • This is a pseudo filesystem contains information about running process. For example: /proc/{pid} directory contains information about the process with that particular pid.
  • This is a virtual filesystem with text information about system resources. For example: /proc/uptime

 

7. /var – Variable Files

  • var stands for variable files.
  • Content of the files that are expected to grow can be found under this directory.
  • This includes — system log files (/var/log); packages and database files (/var/lib); emails (/var/mail); print queues (/var/spool); lock files (/var/lock); temp files needed across reboots (/var/tmp);

 

8. /tmp – Temporary Files

  • Directory that contains temporary files created by system and users.
  • Files under this directory are deleted when system is rebooted.

 

9. /usr – User Programs

  • Contains binaries, libraries, documentation, and source-code for second level programs.
  • /usr/bin contains binary files for user programs. If you can’t find a user binary under /bin, look under /usr/bin. For example: at, awk, cc, less, scp
  • /usr/sbin contains binary files for system administrators. If you can’t find a system binary under /sbin, look under /usr/sbin. For example: atd, cron, sshd, useradd, userdel
  • /usr/lib contains libraries for /usr/bin and /usr/sbin
  • /usr/local contains users programs that you install from source. For example, when you install apache from source, it goes under /usr/local/apache2

 

10. /home – Home Directories

  • Home directories for all users to store their personal files.
  • For example: /home/john, /home/nikita

 

11. /boot – Boot Loader Files

  • Contains boot loader related files.
  • Kernel initrd, vmlinux, grub files are located under /boot
  • For example: initrd.img-2.6.32-24-generic, vmlinuz-2.6.32-24-generic

 

12. /lib – System Libraries

  • Contains library files that supports the binaries located under /bin and /sbin
  • Library filenames are either ld* or lib*.so.*
  • For example: ld-2.11.1.so, libncurses.so.5.7

 

13. /opt – Optional add-on Applications

  • opt stands for optional.
  • Contains add-on applications from individual vendors.
  • add-on applications should be installed under either /opt/ or /opt/ sub-directory.

 

14. /mnt – Mount Directory

  • Temporary mount directory where sysadmins can mount filesystems.

 

15. /media – Removable Media Devices

  • Temporary mount directory for removable devices.
  • For examples, /media/cdrom for CD-ROM; /media/floppy for floppy drives; /media/cdrecorder for CD writer

 

16. /srv – Service Data

  • srv stands for service.
  • Contains server specific services related data.
  • For example, /srv/cvs contains CVS related data.

15 Most Interesting Linux Facts


Linux is one of the world’s most powerful and popular operating system. Linux operating system was developed by Linus Benedict Torvalds at the age of 21. At present there are more than 300 flavors of Linux available and one can choose between any of them depending on the kind of applications they want. 

Linux is a freeware and generally speaking its free from Virus and other malware infections.  In this post I will share few Linux facts which may or may not be known for many of us. 

 

15 Most Interesting Linux Facts
  1. Only 2% of the current Linux kernel written by Linus Torvalds.
  2. The Linux kernel version is written in the programming language C.
  3. The first commercial distribution GNU / Linux was Yggdrasil was launched Lice-CD format in 1992. Red Hat was one of the first distributions to settle within companies and data centers in 1999.
  4. A guy named William Della Croce Jr. registered the name Linux and demanded royalties for use of the mark. Later, he agreed to assign the trademark to the true owner, who is Torvalds.
  5. Countries such as Russia, Brazil and Venezuela have put their focus on Linux as a basis for interoperable management , cost efficient and technologically independent.
  6. U.S. Department of Defense, U.S. Navy Submarine Fleet, Federal Aviation Administration uses Linux in government offices. Indian state of Tamil Nadu uses Linux for education purpose.
  7. 90% of the world’s most powerful supercomputers using an operating system GNU / Linux, in fact, the top ten of supercomputers use Linux. In fact, the penetration of Linux in data centers is very high, 33.8% of the world runs on Linux servers compared to 7.3% does so in a Microsoft operating system.
  8. The name of the penguin, Tux , is not entirely clear. On the one hand, it is said that the origin of the name comes from the fact that penguins appear to be wearing a tuxedo, which in English is said max tuxedo tux and is abbreviated. In contrast, another source comes from the letters of the logo of Tux are Unix Torvalds.
  9. Torvalds wanted to call the kernel Freax (a combination of “free”, “freak”, and the letter X to indicate that it is a Unix-like), but his friend Ari Lemmke, who administered the FTP server where the kernel was hosted for download, the download directory called kernel of Linux Torvalds.
  10. Debian was one of the first GNU / Linux that was constituted and organized as a community of developers.
  11. Linux is present in highly critical applications such as Japan’s bullet trains, traffic control, San Francisco, the New York Stock Exchange, CERN, many air traffic control systems or control of nuclear reactors of submarines and ships many nuclear war.
  12. Linux programmers are often associated with living “isolated” in the world, however, over 75% of the code developed for the Linux kernel came from private sector developers. In fact, large technology companies like Intel, Google, IBM, AMD, Sun Microsystems, Dell, Asus, HP, Analog Devices, Oracle, Novell or Red Hat help developing applications, contributing to the core or pre-installing any GNU / Linux their machines. In fact, during the 2003 Super Bowl (which paralyzes the United States and remains glued to the TV for many Americans), IBM delivered a beautiful ad talking about Linux and open source options.
  13. The GNU project in 1991, had no drivers and kernel, that’s what led to Linus Torvalds to address the Linux kernel development. If GNU had had, perhaps, Torvalds had not been put to work on that.
  14. The Linux kernel is now the most widely ported operating system, running on a great variety of operating systems.
  15. World known companies such as Google, Cisco, Facebook, Twitter, Linked in etc use Linux as their main operating system.