Linux or ubuntu Directory structure

Sponsored Link
In the Linux operating system, all filesystems are contained within one directory hierarchy. The root directory is the top level directory, and all its subdirectories make up the directory hierarchy. This differs to other operating systems such as MS-Windows which applies a separate hierarchy for each device and partition.

  • /bin -- binary applications (most of your executable files)
  • /boot -- files required to boot (such as the kernel, etc)
  • /dev -- your devices (everything from drives to displays)
  • /etc -- just about every configuration file for your system
  • /etc/profile.d -- contains scripts that are run by /etc/profile upon login.
  • /etc/rc.d -- contains a number of shell scripts that are run on bootup at different run levels. There is also typically an rc.inet1 script to set up networking (in Slackwar), an rc.modules script to load modular device drivers, and an rc.local script that can be edited to run commands desired by the administrator, along the lines of autoexec.bat in DOS.
  • /etc/rc.d/init.d -- contains most of the initialization scripts themselves on an rpm-based system.
  • /etc/rc.d/rc*.d -- where "*" is a number corresponding to the default run level. Contains files for services to be started and stopped at that run level. On rpm-based systems, these files are symbolic links to the initialization scripts themselves, which are in /etc/rc.d/init.d.
  • /etc/skel -- directory containing several example or skeleton initialization shells. Often contains subdirectories and files used to populate a new user's home directory.
  • /etc/X11 -- configuration files for the X Window system
  • /home -- locally stored user files and folders
  • /lib -- system libraries (similar to Program Files)
  • /lost+found -- lost and found for lost files
  • /media -- mounted (or loaded) devices such as cdroms, digital cameras, etc.
  • /mnt -- mounted file systems
  • /opt -- location for “optionally” installed programs
  • /proc -- dynamic directory including information about and listing of processes
  • /root -- “home” folder for the root user
  • /sbin -- system-only binaries (see /bin)
  • /sys -- contains information about the system
  • /tmp -- temporary files
  • /usr -- applications mainly for regular users
  • /var -- mainly logs, databases, etc.
  • /usr/local/bin -- the place to put your own programs. They will not be overwritten with upgrades.
  • /usr/share/doc -- documentation.

Sponsored Link

    You may also like...

    14 Responses

    1. Batbayar says:

      Are these all partitions? I mean, is very main directory a partition? I’m new to ubuntu. In fact, I have installed it on my conputer’s second hard disk just two days ago.

    2. admin says:

      these are not partitions all these are directories in side a partition

    3. Nescafi says:

      For example in Windows your usb flash drive will be mounted as “E:\”.
      In Linux it will be mounted as e.g. “/media/USBVOLUME/”.
      But it doesn’t matter too much in normal use, you just click on the drive icon.

      Any other partitions (such as a windows partition) or file systems are found in the /media or /mnt directory and can be browsed as Linux natively handle many partition formats.

    4. Mike says:

      I am having a bit of trouble. I just switched to Ubuntu yesteday from Windows. Have zero experience with Linux. I like the OS but something is bugging and hopefully you can help.

      I am installing programs from the Synaptic Package Manager (such as ushare and fiaif). When I look in Applications, none of them are there. I m trying to locate them in the folders in FILESYSTEM/BIN and I can’t find any of them. I did LOCATE in the Terminal, but it couldn’t find them either. What am I doing wrong and where could all the prorams I installed be?

    5. Gabara says:

      Mike, you can probably see all folders containing your installed programs by switching the ‘show hidden files’ to ON. Windows users are often frustrated when they can not easily find the installed program folders.

    6. kiruthiga says:

      the linux obuntu file structure can be differentiated from distributor id differentiated

    7. Richard says:

      Hi there, I am also new to linux/ubuntu
      I understand there are various permissions for the files/folders.

      To give context to my query, I want to copy a folder into /usr/lib but it won’t let me as owner is root and I have no permission.
      Is it prudent to change the owner of the folder to the user (being me) or change the permission of the folder for other users to read and write apart from executing ie.

      chmod o+rwx /usr/lib

      Not quite sure where root user permissions and mine should differ as I am an admin user

      Many thanks

    8. Bulat says:

      >Not quite sure where root user permissions and >mine should differ as I am an admin user
      It’s done for security purposes. By default you are working as a common user even if you are admin. It protects you from malware etc. breaking into your system while browsing internet or reading e-mail and so on.

      In order to be able to use your admin rights you have to switch to a superuser mode (‘su’ command), or just run a program in a superuser mode (‘sudo’ and ‘gksudo’ commands).

      (Those commands will ask for your password in order to use a superuser mode.)

      So you can copy your files by running a ‘cp’ program from terminal:
      sudo cp /source/directory /destination/directory

      Or by running Nautilus (Ubuntu built in file-browser):
      gksudo nautilus

      P.S. Giving to system directories weaker permissions (o+rwx etc) will make your system vulnerable (or even open to everyone) and error prone. So don’t do that. 🙂

    9. EliBei says:

      Hi Bulat,

      Thank you, your advice ended my several hours spent browsing the net in order to get songbird playing web flash content. I have been using Ubuntu for couple of weeks now, and man every little tweak you need to make takes a lot of research. I like this operating system, but it needs a lot before it becomes user friendly.

    10. (cd /home/user/source/; find -type d -print0) | xargs -0 mkdir -p

    11. john says:

      Hello I am trying to install Ubuntu 10, i have partitioned my hard drive, and even included some swap. However It gets so far then says ‘there is no root directory’
      It tells me to fix it but i dont know how.
      I have tried Youtube, and some of the videos help a bit, but the ubuntu I am installing is off a cd, and doesnt seem to have a partition editor

      Can you help please ?/

    12. Peter says:

      If you already have two partitions just run the ubuntu cd as live system choose install and then you will have a GUI setup. Choose one partition as to be root and let it be formatted, leave the second one intact and mark it as swap. Try to use ext fs. It is really simple. Otherwise you can install partition editor even on live system (it’ll be stored in RAM) by typing: sudo apt-get install gparted

    13. Saeed says:

      few directories are same as we use in i right.

    14. Raul says:

      Just upgraded to Saucy… Big mistake. Getting some errors and problems running multi user. I often have family use a desktop with their user account so my work does not have to stop. This time the alternate user (started in a terminal with su – altusr) cannot use flash for youtube. Hangs the browser for a while and generates errors.

      Back to on topic… When did they move /var/run to the root directory? Has nobody at cannonical read the hfs? Ubuntu seems to drift further and further from POSIX conventions and standards with every release. Back to Slack? Try SuSE again (been a long time)? RH similar but different issues. Debian… thats further back than most but maybe. Arch (haven’t tried that one yet) it may be worth a look. Mint (dunno may be too close to Ubuntu and its standards deviations)?

    Leave a Reply

    Your email address will not be published. Required fields are marked *