Skip to content

Instantly share code, notes, and snippets.

@axelav
Last active September 30, 2015 18:58
Show Gist options
  • Select an option

  • Save axelav/1846652 to your computer and use it in GitHub Desktop.

Select an option

Save axelav/1846652 to your computer and use it in GitHub Desktop.
Quick summary of Linux directory hierarchy

Linux directory heirarchy


/bin binaries, basic Linux commands are here

/boot boot code, leave it be

/dev all devices/hardware, all treated as a stream

/etc config files & resources, only root user can modify

/home user account info & personal files

/lib shared library files essential for binaries

/lost+found stray files that can be recovered after a crash

/media mount points for removable media

/mnt mount points

/opt optional & larger application packages

/proc virtual files for various system processes

/root root user's home directory

/sbin essential system binaries reserved for the root user

/selinux security-enhanced Linux

/srv site-specific data

/sys virtual filesystem, similar to /proc

/tmp temporary files

/usr user applications, subdirectories for user-installed commands, kernel source, documentation, config files, man pages, etc.

/usr/share config files and graphics for numerous user applications

/usr/src source code for some system stuff, including the Linux kernel

/usr/include headers for c/c++ and some other development essentials

/usr/lib library files for the whole system. you may find lib, lib32 and lib64 for different architectures

/usr/local programs installed by the user manually

/usr/bin non-system essential programs and commands

/var variable files such as logs, cache, email

@larzconwell
Copy link
Copy Markdown

/dev should instead say "all devices/hardware, all treated as a stream" if you do sudo cat /dev/sda you will get a stream. That's my opinion anyways!

@axelav
Copy link
Copy Markdown
Author

axelav commented Feb 23, 2012

ok, would you mind explaining that a little further? I've done a little research, but I'm not sure I completely understand this directory yet.

@larzconwell
Copy link
Copy Markdown

well when you read a normal file such as a .txt it should always end. I consider any file that is constantly getting read from or written to a stream, like a kernel log file in /var that "file" is always getting written to whenever a kernel action happens. so in /dev these block devices are always gathering information from the hardware(although incomprehensible to humans), try this command sudo cat /dev/sda you should see a constant stream of information coming from your hard drive(That is assuming /dev/sda exists).

@axelav
Copy link
Copy Markdown
Author

axelav commented Feb 24, 2012

ok, got it. thanks for the clear explanation. that's something that numerous other references failed to do. I've updated the gist.

@larzconwell
Copy link
Copy Markdown

Your welcome! Yeah I've seen a bunch similar to this and almost all of them are different in someway.

@larzconwell
Copy link
Copy Markdown

You might also want to split /usr up into a couple different ones because the dir is so big and complex.

/usr/share
Contains config files and graphics for numerous user applications

/usr/src
Contains source code for some system stuff. Including the Linux kernel.

/usr/include
Contains headers for c/c++ and some other development essentials

/usr/lib*
Contains library files for the whole system basically you may find lib, lib32 and lib64. each for different architectures.

/usr/local
Usually contains programs installed by the user manually.

/usr/bin
Contains non system essential programs and commands.

Oh also I like your list, It's really well formatted!

@axelav
Copy link
Copy Markdown
Author

axelav commented Mar 14, 2012

cool, I added in your /usr/ info. very helpful!

@larzconwell
Copy link
Copy Markdown

Awesome!

@axelav
Copy link
Copy Markdown
Author

axelav commented Aug 28, 2013

man hier in the cli gives you a lot of this info as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment