A Tour of Important Directories

Every Linux system uses the same standard layout, called the Filesystem Hierarchy Standard. Once you know it, you can find your way around any Linux machine.

ls /

In the terminal

student@vulntech:~$ ls /
bin   dev  home  media  opt   root  sbin  sys  usr
boot  etc  lib   mnt    proc  run   srv   tmp  var
DirectoryWhat's inside
/bin, /usr/binThe programs you run as commands: ls, date, ...
/sbin, /usr/sbinSystem programs, mostly for the administrator
/etcSystem-wide settings, as plain text files
/homeUsers' home directories
/rootThe home directory of the administrator, root
/varData that changes: /var/log has the log files
/tmpTemporary files; often wiped when the computer restarts
/usrInstalled software, libraries and documentation
/devDevices (disks, terminals) shown as files
/procA window into the running system: processes, memory, CPU
/mnt, /mediaWhere USB drives and other disks get attached

/etc: the settings

Settings on Linux are plain text files, and most live in /etc. For example, the machine's name is in /etc/hostname, and the list of users is in /etc/passwd:

ls /etc/hostname /etc/passwd /etc/os-release

In the terminal

student@vulntech:~$ ls /etc/hostname /etc/passwd /etc/os-release
/etc/hostname  /etc/os-release  /etc/passwd

Where are the commands?

Commands are just program files. which shows where one lives:

which ls tree

In the terminal

student@vulntech:~$ which ls tree
/bin/ls
/usr/bin/tree

Everything is a file

Linux shows almost everything as a file, even hardware and running programs. Your terminal itself is a file in /dev:

tty

In the terminal

student@vulntech:~$ tty
/dev/ttyS0

Tip: For security work, /etc (configuration), /home (user files), /var/log (what happened) and /tmp (anyone can write there) are the first places to look on a machine.

Remember: Programs in /bin and /usr/bin, settings in /etc, users in /home, logs in /var/log, scratch files in /tmp.

HOME LEARN COMMUNITY DASHBOARD
Practice terminal Starting…