Skip to content

Instantly share code, notes, and snippets.

@HarshKapadia2
Last active November 6, 2020 10:54
Show Gist options
  • Save HarshKapadia2/18150e1e57eab1f0e500f18feea890aa to your computer and use it in GitHub Desktop.
Save HarshKapadia2/18150e1e57eab1f0e500f18feea890aa to your computer and use it in GitHub Desktop.
The Unix/Linux file system.

File system

The FHS (Filesystem Hierarchy Standard) is followed.

Directories in the root (#)

image

bin (binaries, ie, progs/applications)

  • most basic progs reside here
  • ls, cat, etc reside here

sbin (system binaries)

  • used by the system admin

boot

  • bootloaders reside here
  • don't touch unless absolutely sure

cdrom

  • legacy mounting point

dev (devices)

  • home for devices and their driver files
  • keyboard, webcam, hard disk, etc reside here
  • sda is a hard disk and the partitions can be sda1, sda2, etc... (as everything in linux is a file)

etc

  • storage for all system-wide configurations like apt

lib, lib32, lib64, libx32 (libraries)

  • store for applications to keep their files
  • these files are reqd by the binaries in bin, sbin and other places

media, mnt

  • for external mounted devices like USBs, floppies, etc
  • use mnt for manual mounting & leave media for the OS to manage

opt (optional)

  • manually installed software reside here
  • user can install their software here

proc (processes)

  • contains sudo files (like dev) that have info on sys processes & resources
  • mapped as per PID (process ID)

root

  • root user's home folder
  • not like the typical user's home folder & it does not reside in the home dir
  • files can be stored here, but they need root permissions to be accessed

run

  • different distros use it differently
  • tempfs (temporary file system)
  • it runs in RAM (so everything in this folder is gone when the system is rebooted or shut down...)

snap

  • snap package store
  • mainly used by ubuntu

srv (service)

  • service data store
  • if you run a server (eg: FTP server), then the files to be accessed by the external user are to be stored here

sys (system)

  • to interact with kernel
  • created every time the system boots up

tmp (temporary)

  • temp file store
  • ususlly empty every time system boots

usr (unix system resource)

  • user application space
  • application to be used by user are installed here as opposed to bin or sbin
  • applications here are considered to be non-essential for basic system op

var (variable)

  • files & dirs expected to grow in size
  • eg: log, crash, spool (temp printer queue), etc

home

  • each user has their own folder
  • store for personal files & docs
  • each user can access only their own home folder unless they have admin permissions
  • has hidden folders like .cache (files that are used too often like thumbnails, etc), .config, .local

src: https://www.youtube.com/watch?v=HbgzrKJvDRw

AT&T Archives: The UNIX Operating System

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment