1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2004
    Rep Power

    File structure cheat sheet / reference card

    Is there somehting like a cheat sheet or reference card for the linux file/directory structure that I could buy or download that would help me locate things under linux file system? I don't want a book, just a quick glance reference. I'm not bad with linux, but everytime I use it I have to partially re-learn everything since I really only do anything in it once or twice a year.
  2. #2
  3. blah
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Rep Power
    Try this??

    Funnily enough, this was the first result I got when googling 'linux file system'
  4. #3
  5. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Woodland Hills, Los Angeles County, California, USA
    Rep Power
    The above link doesn't quite explain some stuff correctly. Here's an alternative explanation I banged out:

    Essential for System Startup
    /boot - Contains linux kernel and System.map files
    /bin - Contains some small binaries useful by all. ls, cp, mv et all are here.
    /sbin - Similar to /bin, but contains binaries needed by system administrators. ifconfig, passwd, fdisk, mount etc. are here
    /lib - Shared libraries for all the binaries in /bin and /sbin. This is a dumb idea methinks. Traditionally in *nix systems, programs in /bin and /sbin should be standalone with no need for shared libs. It used to be that way in Linux as well until fairly recently when they went for the /lib dir.
    /etc - Contains all the configuration files. Binaries in /bin and /sbin read the files here when the system boots up.

    These five directories are essential for boot up.

    Home directories
    /home - This is the directory under which normal users are given their home directory (/home/UserA, /home/UserB etc.)
    /root - This is the directory specifically for the root user.

    Other Directories
    /tmp - Special directory that is generally writeable by anyone. Most system daemons place a small file here to keep track of their state. This directory may be flushed on reboot.
    /var - Used to keep frequently changed data. For instance, all mail is generally stored here, as are various log files and even www files for a webserver (depending on OS flavor of course)
    /lost+found - If you reboot your system without shutting down cleanly, fsck will attempt to fix corrupted files and put them here.
    /opt - Very rarely used these days. Used to be for third party programs, now usually replaced by /usr/local in most cases.

    The /usr dir hierarchy
    This gets its own section:
    /usr/bin - Sort of like /bin, but it contains larger programs that won't fit in the /bin directory. Programs here can be used by all, but are not so frequently used. Programs here could include gcc, emacs, OpenOffice and so on.
    /usr/sbin - Sort of like /sbin, but contains larger programs that won't fit in the /sbin directory. Programs here are used by administrators, such as adduser.
    /usr/lib - You're getting the idea, aren't you.
    /usr/src - Contains the source code that is needed to build the kernel. Only installed if you install the kernel source.

    Now for the /usr/local directory. Notice that it has a similar hierarchy as /usr and / (/usr/local/bin, /usr/local/sbin, /usr/local/etc, /usr/local/src etc.)

    The difference between /usr and /usr/local is that /usr has programs that are installed by the OS install disks and /usr/local has stuff that is installed separately by the admin. So, if you upgrade your OS, stuff in /bin, /sbin, /etc and /usr tree may be overwritten by the upgrade, but stuff in the /usr/local tree will NOT be touched. Hence, if you install your own version of apache with special compile options, you'd want to install it under /usr/local tree, so that when you upgrade your OS, it doesn't get overwritten by the system version of apache. All your custom third party programs that are compiled from source should be placed under /usr/local/src.

    There you have it.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2012
    Haifa, Israel
    Rep Power
    Thanks Scorpions4ever for your informative post.

    Here are a few more up-to-date Linux cheat sheets I have come across. They have varying levels of detail -- pick the one that suits you. Download, print out, and stick on your cubicle wall for easy reference.

    1) A nicely formatted, pretty one, for basic commands:

    2) A popular (the author claims "over 3.5 million hits in nearly 5 years") pair of Linux cheat sheets:
    --Basic: http://www.pixelbeat.org/cmdline.html
    --Advanced: http://www.pixelbeat.org/docs/linux_commands.html

    3) SSH Cheat Sheet:

    4) Bash (default shell on most Linux distributions) cheat sheet:

    Hope this is helpful.

IMN logo majestic logo threadwatch logo seochat tools logo