Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am very new to Linux (Ubuntu 13.10) and having difficulty understanding the file system, particularly with regards to installing applications. In Windows, when I installed an application, it put the contents of the application in a folder in Program Files, by default. I knew exactly where to look if I wanted to browse all my applications, for example to see if I had already installed something. However, I have found that with Linux, there is much less consistency.

For example, when I installed the Komodo code editor, by default it created a folder in /home. Then, when I installed the TexLive Latex editor, by default it created a folder in /usr/local. From searching around, I have found that most applications are supposed to be installed in /bin or /usr/bin. Why are there so many different default places to install applications? Why not the consistency found in Windows?

On a slightly different note, if I were to move my Komodo folder from /home to /bin, for example, will doing a simple cut and paste be acceptable, or will there be references to the original folder in /home that will now be invalid? I have already added the Komodo bin folder to $PATH, so I already know about that one, but are there any other such references?

share|improve this question
    
As with any system, consistency is a result of peope/programs following some existent rule. Install python on a windows system and it will end up in C:` and not in C:\Program Files` (or some other installation language dependent directory) –  Timo Mar 2 at 13:50

3 Answers 3

up vote 2 down vote accepted

It does actually tend to be consistent. The standard is the FHS specification and while it is admittedly not always followed it mostly is:

  • /bin : Essential user command binaries (for use by all users)
  • /boot : Static files of the boot loader
  • /dev : Device files
  • /etc : Host-specific system configuration
  • /home : User home directories (optional)
  • /lib : Essential shared libraries and kernel modules
  • /media : Mount point for removeable media
  • /mnt : Mount point for a temporarily mounted filesystem
  • /opt : Add-on application software packages
  • /root : Home directory for the root user (optional)
  • /sbin : System binaries
  • /srv : Data for services provided by this system
  • /tmp : Temporary files

Then, you also have

  • /usr/local : The /usr/local hierarchy is for use by the system administrator when installing software locally. It needs to be safe from being overwritten when the system software is updated. It may be used for programs and data that are shareable amongst a group of hosts, but not found in /usr.

The approach is just different is all. While Windows stores files by source (all files installed by a program are placed in the same folder), *nix systems install by type. So, the manual page will be in /usr/man or /usr/local/man, the executables (.exe in Windows) in /usr/bin or /usr/local/bin, the libraries (.dll in WIndows) in /usr/lib or /usr/local/lib etc.

The good thing is that you don't care, that's all controlled by the package manager (dpkg in Debian based systems like Ubuntu). So, to see where a particular package has installed its files, you can use this command (using the package xterm as an example) :

$ dpkg-query -L xterm 
/usr
/usr/share
/usr/share/menu
/usr/share/menu/xterm
/usr/share/doc-base
/usr/share/doc-base/xterm-faq
/usr/share/doc-base/xterm-ctlseqs
/usr/share/icons
/usr/share/icons/hicolor
/usr/share/icons/hicolor/scalable
/usr/share/icons/hicolor/scalable/apps
/usr/share/icons/hicolor/scalable/apps/xterm-color.svg
/usr/share/icons/hicolor/48x48
/usr/share/icons/hicolor/48x48/apps
/usr/share/icons/hicolor/48x48/apps/xterm-color.png
/usr/share/applications
/usr/share/applications/debian-xterm.desktop
/usr/share/applications/debian-uxterm.desktop
/usr/share/pixmaps
/usr/share/pixmaps/filled-xterm_32x32.xpm
/usr/share/pixmaps/mini.xterm_32x32.xpm
/usr/share/pixmaps/xterm-color_32x32.xpm
/usr/share/pixmaps/xterm_32x32.xpm
/usr/share/pixmaps/filled-xterm_48x48.xpm
/usr/share/pixmaps/mini.xterm_48x48.xpm
/usr/share/pixmaps/xterm-color_48x48.xpm
/usr/share/pixmaps/xterm_48x48.xpm
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/xterm.1.gz
/usr/share/man/man1/uxterm.1.gz
/usr/share/man/man1/resize.1.gz
/usr/share/man/man1/lxterm.1.gz
/usr/share/man/man1/koi8rxterm.1.gz
/usr/share/doc
/usr/share/doc/xterm
/usr/share/doc/xterm/xterm.terminfo.gz
/usr/share/doc/xterm/xterm.termcap.gz
/usr/share/doc/xterm/README.i18n.gz
/usr/share/doc/xterm/ctlseqs.ms.gz
/usr/share/doc/xterm/ctlseqs.txt.gz
/usr/share/doc/xterm/xterm.faq.gz
/usr/share/doc/xterm/changelog.Debian.gz
/usr/share/doc/xterm/NEWS.Debian.gz
/usr/share/doc/xterm/copyright
/usr/share/doc/xterm/README.Debian
/usr/share/doc/xterm/xterm.faq.html
/usr/share/doc/xterm/xterm.log.html
/usr/bin
/usr/bin/resize
/usr/bin/xterm
/usr/bin/uxterm
/usr/bin/lxterm
/usr/bin/koi8rxterm
/etc
/etc/X11
/etc/X11/app-defaults
/etc/X11/app-defaults/XTerm-color
/etc/X11/app-defaults/XTerm
/etc/X11/app-defaults/UXTerm-color
/etc/X11/app-defaults/UXTerm
/etc/X11/app-defaults/KOI8RXTerm-color
/etc/X11/app-defaults/KOI8RXTerm

So, while it is easy enough to see where everything is installed you rarely need to do so. To remove a package, just use apt:

sudo apt-get remove xterm

You can safely let the system worry about where everything is installed, unlike under Windows, you don't need to have a specific deinstaller to remove each program, the whole thing is managed centrally by the package manager and is actually much more transparent to the user.

share|improve this answer

The Unix file system has evolved over time, nothing is set in stone, but their are conventions.

It is worth familiarising yourself with it, but doesn't have to be memorised in detail. Wikipedia article

I wouldn't fiddle with your Komodo install, leave it be, as time goes on, you'll become more familiar with the layout.

share|improve this answer

Linux follows different rules from Windows.

Linux favors the use of a package manager to manage installed software. The way to know whether a program is installed is not by looking for its files, but by searching the list of installed packages. Different distributions use different package manager; under Ubuntu, the GUI is the Software Center, and there are several command line tools that can show whether a package is installed and information about that package, the main ones being:

dpkg -l name-of-package
dpkg -s name-of-package
apt-cache policy name-of-package
aptitude show name-of-package

If a program is installed through the package manager, you don't really care where it's installed: you shouldn't be modifying the files anyway. If you need to investigate something, you can list the files belonging to the package (under Ubuntu, with dpkg -L name-of-package). Software installed by the package manager lives in the directories under / (/bin for executable programs, /lib for code libraries, /sbin for programs useful only to the system administrator) or under /usr (which has these same subdirectories plus a few more). The distinction between / and /usr is historical — back in the days when hard disks were small and /usr could be shared between machines while / was needed to boot.

Programs installed manually by the system administrator, without the package manager, live under /usr/local. These are “local” software installations, as opposed to installations made by the operating system. Windows has a similar distinction — programs under c:\Windows vs programs under c:\Program Files — but it's less noticeable under Windows because very few programs are bundled with the operating system and there is no standard package manager, so pretty much everything ends up in c:\Program Files.

Programs installed by a user end up in that user's home directory.

Linux (like other unix systems) uses this organization where files are grouped by function rather by origin because the function determines how other programs will look for those files. For example, all executables are in a few directories (/bin, /usr/bin, /usr/local/bin, ~/lib) so there is no need to modify the PATH when you install a new program.

What is somewhat inconsistent is the use of /opt. It's for software which is organized the Windows way, with one directory per package. Ubuntu doesn't use it, but a few programs come this way, for example Google Chrome.

In summary:

Location               Managed by
/, /usr                package manager
/usr/local             administrator
/opt                   administrator
~ (home directory)     user

On Ubuntu, if a program isn't provided by the distribution, the easiest way to install it is through a PPA if there is one — which there is for Komodo (see also How do I install Komodo Edit?).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.