Linux

 

 

 

 

Directory Structure 

 

In most case, you wouldn't need to know which file/programs are located in where since most of the necessary files/program directories are set up in path and you would have access to them wherever you, but in some case you need to know exact locations for a certain file/programs to get access to it.

However it wouldn't be easy to locate those especially when you don't have the big picture of Linux directory structure and basic properties of each directories. In this page, I will give you the list of the most common directories you would find in any Linux and some big pictures of each directories.

 

Followings are those directories that you may find from any variations of Linux.

 

Root

Directory

Description

/

 

 

 

bin

User Binaries

 

sbin

System Binaries

 

etc

Configuration Files

 

dev

Device Files

 

proc

Process Information

 

var

Variable Files

 

tmp

Temprary Files

 

usr

User Programs

 

home

Home Directory

 

boot

Boot Loader Files

 

lib

System Libraries

 

opt

Optional Add-on Apps

 

mnt

Mount Directory

 

media

Removable Devices

 

srv

Service Data

 

 

/bin

 

This directory contains most of user binaries (executable files for most of Linux command). Following is the full list of files in this location from the linux on my PC (you may see a little different list from your Linux). You would notice several famous linux command as marked in blue.

 

bash                  fgconsole       nc                       sed

bunzip2               fgrep           nc.openbsd               setfacl

busybox               findmnt         netcat                   setfont

bzcat                 fuser           netstat                  setupcon

bzcmp                 fusermount      nisdomainname            sh

bzdiff                getfacl         ntfs-3g                  sh.distrib

bzegrep               grep            ntfs-3g.probe            sleep

bzexe                 gunzip          ntfs-3g.secaudit         ss

bzfgrep               gzexe           ntfs-3g.usermap          static-sh

bzgrep                gzip            ntfscat                  stty

bzip2                 hostname        ntfsck                   su

bzip2recover          init-checkconf  ntfscluster              sync

bzless                initctl2dot     ntfscmp                  tailf

bzmore                ip              ntfsdecrypt              tar

cat                   kbd_mode        ntfsdump_logfile         tempfile

chacl                 kill            ntfsfix                  touch

chgrp                 less            ntfsinfo                 true

chmod                 lessecho        ntfsls                   ulockmgr_server

chown                 lessfile        ntfsmftalloc             umount

chvt                  lesskey         ntfsmove                 uname

cp                    lesspipe        ntfstruncate             uncompress

cpio                  ln              ntfswipe                 unicode_start

dash                  loadkeys        open                     vdir

date                  login           openvt                   vmmouse_detect

dbus-cleanup-sockets  lowntfs-3g      pidof                    which

dbus-daemon           ls              ping                     whiptail

dbus-uuidgen          lsblk           ping6                    ypdomainname

dd                    lsmod           plymouth                 zcat

df                    mkdir           plymouth-upstart-bridge  zcmp

dir                   mknod           ps                       zdiff

dmesg                 mktemp          pwd                      zegrep

dnsdomainname         more            rbash                    zfgrep

domainname            mount           readlink                 zforce

dumpkeys              mountpoint      rm                       zgrep

echo                  mt              rmdir                    zless

ed                    mt-gnu          rnano                    zmore

egrep                 mv              running-in-container     znew

false                 nano            run-parts

 

 

/dev

 

This directory contains device (device drivers) for the terminal devices (hardware) installed on the PC. Some of the common devices are marked in blue.

 

alarm            loop0               ram15     tty1   tty37  tty7       ttyS4

ashmem           loop1               ram2      tty10  tty38  tty8       ttyS5

autofs           loop2               ram3      tty11  tty39  tty9       ttyS6

binder           loop3               ram4      tty12  tty4   ttyprintk  ttyS7

block            loop4               ram5      tty13  tty40  ttyS0      ttyS8

bsg              loop5               ram6      tty14  tty41  ttyS1      ttyS9

btrfs-control    loop6               ram7      tty15  tty42  ttyS10     uinput

bus              loop7               ram8      tty16  tty43  ttyS11     urandom

cdrom            loop-control        ram9      tty17  tty44  ttyS12     usb

cdrw             mapper              random    tty18  tty45  ttyS13     v4l

char             mcelog              rfkill    tty19  tty46  ttyS14     vcs

console          mei                 rtc       tty2   tty47  ttyS15     vcs1

core             mem                 rtc0      tty20  tty48  ttyS16     vcs2

cpu              net                 sda       tty21  tty49  ttyS17     vcs3

cpu_dma_latency  network_latency     sda1      tty22  tty5   ttyS18     vcs4

disk             network_throughput  sda2      tty23  tty50  ttyS19     vcs5

dri              null                sda3      tty24  tty51  ttyS2      vcs6

dvd              oldmem              sda5      tty25  tty52  ttyS20     vcs63

dvdrw            port                sda6      tty26  tty53  ttyS21     vcsa

ecryptfs         ppp                 sg0       tty27  tty54  ttyS22     vcsa1

fb0              psaux               sg1       tty28  tty55  ttyS23     vcsa2

fd               ptmx                shm       tty29  tty56  ttyS24     vcsa3

full             pts                 snapshot  tty3   tty57  ttyS25     vcsa4

fuse             ram0                snd       tty30  tty58  ttyS26     vcsa5

hidraw0          ram1                sr0       tty31  tty59  ttyS27     vcsa6

hpet             ram10               stderr    tty32  tty6   ttyS28     vcsa63

input            ram11               stdin     tty33  tty60  ttyS29     vga_arbiter

kmsg             ram12               stdout    tty34  tty61  ttyS3      vhost-net

kvm              ram13               tty       tty35  tty62  ttyS30     video0

log              ram14               tty0      tty36  tty63  ttyS31     zero

 

 

/sbin

 

The property of this directory is similar to /bin which contains a lot of binary (executable) files. Most of these files work as linux command. However, most of executables stored in this folder is for system adiministrator whereas the /bin directory is for common users. Some of the executables (commands) you would use pretty often are marked in blue.

 

acpi_available   fstrim             mkfs              resize2fs

agetty           getcap             mkfs.bfs          resolvconf

alsa             getpcaps           mkfs.cramfs       restart

alsactl          getty              mkfs.ext2         rmmod

apm_available    halt               mkfs.ext3         route

apparmor_parser  hdparm             mkfs.ext4         rtacct

badblocks        hwclock            mkfs.ext4dev      rtmon

blkid            ifconfig           mkfs.minix        runlevel

blockdev         ifdown             mkfs.msdos        setcap

bootlogd         ifquery            mkfs.ntfs         setvtrgb

brltty           ifup               mkfs.vfat         sfdisk

brltty-setup     init               mkhomedir_helper  shadowconfig

capsh            initctl            mkntfs            shutdown

cfdisk           insmod             mkswap            slattach

crda             installkernel      mntctl            start

cryptsetup       ip                 modinfo           startpar

ctrlaltdel       ip6tables          modprobe          start-stop-daemon

debugfs          ip6tables-restore  mountall          status

depmod           ip6tables-save     mount.fuse        stop

dhclient         ipmaddr            mount.lowntfs-3g  sulogin

dhclient3        iptables           mount.ntfs        swaplabel

dhclient-script  iptables-restore   mount.ntfs-3g     swapoff

dmsetup          iptables-save      nameif            swapon

dosfsck          iptunnel           nfnl_osf          switch_root

dosfslabel       isosize            ntfsclone         sysctl

dumpe2fs         iw                 ntfscp            tc

e2fsck           iwconfig           ntfslabel         telinit

e2image          iwevent            ntfsresize        tune2fs

e2label          iwgetid            ntfsundelete      udevadm

e2undo           iwlist             on_ac_power       udevd

fdisk            iwpriv             pam_tally         umount.udisks

findfs           iwspy              pam_tally2        unix_chkpwd

fsck             kbdrate            parted            unix_update

fsck.cramfs      killall5           partprobe         upstart-socket-bridge

fsck.ext2        ldconfig           pccardctl         upstart-udev-bridge

fsck.ext3        ldconfig.real      pivot_root        ureadahead

fsck.ext4        logsave            plipconfig        vstp

fsck.ext4dev     losetup            plymouthd         wipefs

fsck.minix       lsmod              poweroff          wpa_action

fsck.msdos       lspcmcia           rarp              wpa_cli

fsck.nfs         MAKEDEV            raw               wpa_supplicant

fsck.vfat        mii-tool           reboot            xtables-multi

fsfreeze         mkdosfs            regdbdump

fstab-decode     mke2fs             reload

 

 

/proc

 

This directory contains the information on the processes which are currently running on the system. These are a kind of psuedo file which is not stored as a hard copy and they would keep chaning depending on what kind of application/commands are running.

 

1      1411  1644  1924   24579  27    7          crypto         modules

1006   1414  1653  1931   24580  270   74         devices        mounts

1034   1422  1692  1936   24581  28    75         diskstats      mtrr

1040   1488  1732  1965   24582  3     76         dma            net

1052   1498  1737  2      24583  30    801        dri            pagetypeinfo

1055   1562  1739  20     24585  31    836        driver         partitions

1058   1564  1749  2006   24586  32    863        execdomains    sched_debug

1081   1569  1751  2067   24587  35    865        fb             schedstat

1083   1575  1753  21     24588  3513  887        filesystems    scsi

1085   1579  1761  22     24596  3524  889        fs             self

1090   1582  1772  224    24597  3525  891        interrupts     slabinfo

1104   1584  1774  226    24625  355   909        iomem          softirqs

1105   1587  1791  228    24626  357   910        ioports        stat

1107   1589  1804  229    24629  36    911        irq            swaps

1248   1590  1814  23     24630  3652  942        kallsyms       sys

1251   1591  1832  230    24631  3656  949        kcore          sysrq-trigger

1266   1593  1834  231    24925  37    982        key-users      sysvipc

1287   1605  1837  23813  24930  38    983        kmsg           timer_list

1362   1609  1838  24046  24935  39    acpi       kpagecount     timer_stats

13765  1613  1865  24093  24938  40    asound     kpageflags     tty

13900  1614  1871  24107  25     41    buddyinfo  latency_stats  uptime

13911  1621  1874  24127  25117  418   bus        loadavg        version

13912  1623  1875  24128  25140  463   cgroups    locks          version_signature

1398   1634  1895  24575  25193  50    cmdline    mdstat         vmallocinfo

1401   1639  1908  24577  26     55    consoles   meminfo        vmstat

1402   1643  1922  24578  269    6     cpuinfo    misc           zoneinfo

 

 

/var

 

This directory contains most of temp files for various programs and the size of the files tend to changes (grows in most cases) as you use the system more, e.g, system log files (/var/log), packages and database files (/var/lib), emails(/var/mail), print queues (/var/spool) etc.

 

backups  cache  crash  games  lib  local  lock  log  mail  opt  run  spool  tmp

 

 

/etc

 

This directory contains the configuration files required by all the programs installed on the system. Some of files you would refer to (or modify) most often are marked in blue.

 

acpi                    gshadow-             pm

adduser.conf            gtk-2.0              pnm2ppa.conf

adjtime                 gtk-3.0              polkit-1

alternatives            hdparm.conf          popularity-contest.conf

anacrontab              host.conf            ppp

apg.conf                hostname             printcap

apm                     hosts                profile

apparmor                hosts.allow          profile.d

apparmor.d              hosts.deny           protocols

apport                  hp                   pulse

apt                     ifplugd              python

at.deny                 init                 python2.7

at-spi2                 init.d               rc0.d

avahi                   initramfs-tools      rc1.d

bash.bashrc             inputrc              rc2.d

bash_completion         insserv              rc3.d

bash_completion.d       insserv.conf         rc4.d

bindresvport.blacklist  insserv.conf.d       rc5.d

blkid.conf              iproute2             rc6.d

blkid.tab               issue                rc.local

bluetooth               issue.net            rcS.d

bonobo-activation       kbd                  resolvconf

brlapi.key              kernel               resolv.conf

brltty                  kernel-img.conf      rmt

brltty.conf             kerneloops.conf      rpc

ca-certificates         ldap                 rsyslog.conf

ca-certificates.conf    ld.so.cache          rsyslog.d

calendar                ld.so.conf           samba

chatscripts             ld.so.conf.d         sane.d

checkbox.d              legal                securetty

colord.conf             libnl-3              security

compizconfig            libpaper.d           sensors3.conf

ConsoleKit              libreoffice          sensors.d

console-setup           lightdm              services

cron.d                  locale.alias         sgml

cron.daily              localtime            shadow

cron.hourly             logcheck             shadow-

cron.monthly            login.defs           shells

crontab                 logrotate.conf       skel

cron.weekly             logrotate.d          smi.conf

cups                    lsb-base             snmp

cupshelpers             lsb-base-logging.sh  sound

dbus-1                  lsb-release          speech-dispatcher

debconf.conf            ltrace.conf          ssh

debian_version          magic                ssl

default                 magic.mime           sudoers

deluser.conf            mailcap              sudoers.d

depmod.d                mailcap.order        sysctl.conf

dhcp                    manpath.config       sysctl.d

dhcp3                   mime.types           systemd

dictionaries-common     mke2fs.conf          terminfo

doc-base                modprobe.d           thunderbird

dpkg                    modules              timezone

emacs                   motd                 ucf.conf

environment             mtab                 udev

firefox                 mtab.fuselock        ufw

fonts                   mtools.conf          updatedb.conf

foomatic                nanorc               update-manager

fstab                   netscsid.conf        update-motd.d

fstab.d                 network              update-notifier

fuse.conf               NetworkManager       UPower

gai.conf                networks             usb_modeswitch.conf

gconf                   newt                 usb_modeswitch.d

gdb                     nsswitch.conf        vim

ghostscript             obex-data-server     vtrgb

ginn                    opt                  wgetrc

gnome                   os-release           wireshark

gnome-app-install       pam.conf             wodim.conf

gnome-settings-daemon   pam.d                wpa_supplicant

gnome-vfs-2.0           papersize            X11

groff                   passwd               xdg

group                   passwd-              xml

group-                  pcmcia               xul-ext

grub.d                  perl                 zsh_command_not_found

gshadow                 pkcs11

 

 

/usr

 

This directory contains the binary (executable) for most of user applications and document, libaries. If you try to find any application/programs, first try witn /bin directory and if you don't find it here, try looking into /usr/bin.

 

bin  games  include  lib  local  sbin  share  src

 

 

/boot

 

This directory contains files related to boot loader e.g, Kernel initrd, vmlinux etc.

 

 

/lib

 

This folder contains those files (libraries) that supports the binaries under /bin and /sbin.

 

apparmor                              libnss_mdns4.so.2

brltty                                libnss_mdns6_minimal.so.2

cpp                                   libnss_mdns6.so.2

crda                                  libnss_mdns_minimal.so.2

firmware                              libnss_mdns.so.2

hdparm                                libply-boot-client.so.2

init                                  libply-boot-client.so.2.0.0

klibc-bhN-zLH5wUTKSCGch2ba2xqTtLE.so  libply.so.2

libbrlapi.so.0.5                      libply.so.2.0.0

libbrlapi.so.0.5.6                    libply-splash-core.so.2

libcryptsetup.so.4                    libply-splash-core.so.2.0.0

libcryptsetup.so.4.0.0                libply-splash-graphics.so.2

libdevmapper-event.so.1.02.1          libply-splash-graphics.so.2.0.0

libdevmapper.so.1.02.1                libproc-3.2.8.so

libfuse.so.2                          libsysfs.so.2

libfuse.so.2.8.6                      libsysfs.so.2.0.1

libip4tc.so.0                         libulockmgr.so.1

libip4tc.so.0.0.0                     libulockmgr.so.1.0.1

libip6tc.so.0                         libx86.so.1

libip6tc.so.0.0.0                     libxtables.so.7

libipq_pic.so.0                       libxtables.so.7.0.0

libipq_pic.so.0.0.0                   linux-sound-base

libipq.so.0                           lsb

libipq.so.0.0.0                       modules

libiptc.so.0                          plymouth

libiptc.so.0.0.0                      recovery-mode

libiw.so.30                           resolvconf

liblvm2app.so.2.2                     security

libnewt.so.0.52                       systemd

libnewt.so.0.52.11                    terminfo

libnl-3.so.200                        udev

libnl-3.so.200.3.0                    ufw

libnl-genl-3.so.200                   x86_64-linux-gnu

libnl-genl-3.so.200.3.0               xtables

libnss_mdns4_minimal.so.2