*nix file systems for newbies
Results 1 to 4 of 4

Thread: *nix file systems for newbies

  1. #1
    Senior Member tampabay420's Avatar
    Join Date
    Aug 2002

    *nix file systems for newbies

    *nix File Systems
    (a newbie’s guide)

    This is a guide for newbies on how to get around a *nix-based file system.

    Let’s start with how the file system works (in laymen terms). A file is line of bytes (or an array of bytes if you will). It starts at one point and doesn’t brake until the end of the file. See the diagram below.

    A file can be written starting at any point in the file (not just the beginning). The file system does not distinguish records/structure in the file, it’s up to the program to know what to do with the data. A good example would be a database record, or like how ASCII Character #13 means new line in text files. A File name can be up to 255 characters long (in most current file systems that I’m familiar with). The file also stores a “Pointer” to it’s position on the hard drive- along with permissions and ownership.

    Directories or Folders are also files. They store a list of files and other folders contained there in. Each line of the file represents a file in the directory, containing the files name and it’s location. There is no limit to the amount of folders that can be stored with in folders within folders. The first folder in this tree of data is called the “root” directory, or sometimes known as “/”. See the diagram below.
    |   |
    |   |---/bin
    When you (or a program) want to access a file, you must specify it’s Path (example: “/user/bin/passwd.conf”). This path must include 0 or more folders, separated by slashes.

    If the path begins with “/” that means it’s going to start in the “root” directory. If the path does not begin with a “/” then it starts looking in the current directory.

    A process (or program) can set the root and current directories, this is done using the “chdir” and “chroot” system calls. Although only programs running under elevated privileges can set the root dir.
    Now, for some commands:

    1.) “ls” - list directory contents
    2.) “cd” – change current directory


    “cd /” This would bring you to the root directory.
    “ls” Lists all the files in the current folder.

    When using “ls” I like to add the “-F” switch. This will display all folders with “/” to let you know they are folders. This makes things a little less confusing. “ls –F”

    Another great command is “man”. This stands for MANual, the manual is a set of “manual” files, which are essentially helps files, there should be a “manual” page for each application on your machine. For example; if I wanted to know a little more about the “ls” command, I would type “man ls”- displaying the “man” page for the ls binary.

    Now that we know how to view and locate files on the system, where should we look? Here I will try to list some key directories and the files they contain (for the most part). [“/”] I don’t like to keep files here, but that’s just me [“/bin”] Stands for Binary, this is where most of the system binaries are kept, programs like ‘ls’ ‘man’… [“/etc”] this is where many programs store their configuration data. [“/lib”] OS and Programming Libraries. [“/tmp”] Stands for Temporary, files that are usually discarded… These are certainly not all the directories on your machine, I recommend that you take a look for your self sometime.

    And, that’s it. You should be able to run around a *nix file-system like a pro If you don’t have *nix on your machine, you can always obtain a shell account, this is a great way to test/learn *nix… This guide is by no means intended to be a full/complete reference of any sort. If you’d like to know more, hit up your favorite search engine!
    yeah, I\'m gonna need that by friday...

  2. #2
    AO übergeek phishphreek's Avatar
    Join Date
    Jan 2002
    Nice little tutorial for noobies. I don't want to rain on your parade but...

    We should also tell them what is generally stored in the basic directories...
    I was gonna type it all out... but then I'd be reinventing the wheel...

    In the Linux file structure files are grouped according to purpose. Ex: commands, data files, documentation. Parts of a Unix directory tree are listed below. All directories are grouped under the root entry "/". That part of the directory tree is left out of the below diagram. See the FSSTND standard (Filesystem standard).

    root - The home directory for the root user
    home - Contains the user's home directories along with directories for services
    bin - Commands needed during bootup that might be needed by normal users
    sbin - Like bin but commands are not intended for normal users. Commands run by LINUX.
    proc - This filesystem is not on a disk. It is a virtual filesystem that exists in the kernels imagination which is memory.
    1 - A directory with info about process number 1. Each process has a directory below proc.
    usr - Contains all commands, libraries, man pages, games and static files for normal operation.
    bin - Almost all user commands. some commands are in /bin or /usr/local/bin.
    sbin - System admin commands not needed on the root filesystem. e.g., most server programs.
    include - Header files for the C programming language. Should be below /user/lib for consistency.
    lib - Unchanging data files for programs and subsystems
    local - The place for locally installed software and other files.
    man - Manual pages
    info - Info documents
    doc - Documentation
    X11R6 - The X windows system files. There is a directory similar to usr below this directory.
    X386 - Like X11R6 but for X11 release 5
    boot - Files used by the bootstrap loader, LILO. Kernel images are often kept here.
    lib - Shared libraries needed by the programs on the root filesystem
    modules - Loadable kernel modules, especially those needed to boot the system after disasters.
    dev - Device files
    etc - Configuration files specific to the machine.
    skel - When a home directory is created it is initialized with files from this directory
    sysconfig - Files that configure the linux system for devices.
    var - Contains files that change for mail, news, printers log files, man pages, temp files
    lib - Files that change while the system is running normally
    local - Variable data for programs installed in /usr/local.
    lock - Lock files. Used by a program to indicate it is using a particular device or file
    log - Log files from programs such as login and syslog which logs all logins and logouts.
    run - Files that contain information about the system that is valid until the system is next booted
    spool - Directories for mail, printer spools, news and other spooled work.
    tmp - Temporary files that are large or need to exist for longer than they should in /tmp.
    catman - A cache for man pages that are formatted on demand
    mnt - Mount points for temporary mounts by the system administrator.
    tmp - Temporary files. Programs running after bootup should use /var/tmp.

    Actually... they have a nice little command reference guide here too....
    Quitmzilla is a firefox extension that gives you stats on how long you have quit smoking, how much money you\'ve saved, how much you haven\'t smoked and recent milestones. Very helpful for people who quit smoking and used to smoke at their computers... Helps out with the urges.

  3. #3
    Senior Member tampabay420's Avatar
    Join Date
    Aug 2002
    I completely forgot about i/o files...

    There are special files that contain information about i/o devices... such as the CD drive et cetera...

    yeah, I\'m gonna need that by friday...

  4. #4
    Join Date
    Feb 2003
    thank you all for your help in this topic,
    i wana to ask about somthing else,
    how can i set an appache server under linux
    thanx endeed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts