Copy Link
Add to Bookmark
Report

How To: Linux Directory Structure

eZine's profile picture
Published in 
Full Circle Magazine
 · 2 Jan 2023

Written by ArsGeek

One of the most troubling starting points that new Linux users have to get over are where things are kept. The Linux directory structure may seem odd at first, especially to Windows users.

Here's a brief list of the major directories and what they're for.

/ (forward slash) folder
Pin it
/ (forward slash) folder

This is the root directory. The mothership. The home field. The one and only top directory for your whole computer. Everything, and I mean EVERYTHING starts here. When you type '/home' what you're really saying is "start at / and then go the the home directory."

/root folder
Pin it
/root folder

this is where the root user lives. The root user is the god of your system. Root can do anything, up to and including removing your entire filesystem. So be careful using root.

/bin folder
Pin it
/bin folder

Here's where your standard linux utilities (read programs) live -- things like "ls" and "vi" and "more". Generally this directory is included in your path. What this means is that if you type 'ls', /bin is one of the places your shell will look to see if 'ls' means anything.

/etc folder
Pin it
/etc folder

Here's where the administrative and system configuration stuff lives. For instance, if you have samba installed, and you want to modify the samba configuration files, you'd find them in /etc/samba.

/dev folder
Pin it
/dev folder

Here's where files that control peripherals live. Talking to a printer? Your computer is doing it from here. Same goes for disk drives, usb devices, and other such stuff.

/home folder
Pin it
/home folder

Here's where your data is stored. Config files specific to users, your Desktop folder (which makes your desktop what it is), and any data related to your user. Each user will have their own /home/username folder, with the exception of the root user.

/tmp folder
Pin it
/tmp folder

This is the temporary folder. Think of it as a scratch directory for your Linux system. Files that won't be needed by programs once their used once or twice are put here. Many Linux systems are set to automatically wipe the /tmp folder at certain intervals, so don't put things you want to keep here.

/usr folder
Pin it
/usr folder

Here's where you'll find extra utilities that don't fit under /bin or /etc. Things like games, printer utilities, and whatnot. /usr is divided into sections like /usr/bin for programs, /usr/share for shared data like sound files or icons, /usr/lib for libraries which cannot be directly run but are essential for running other programs. Your package manager takes care of the things in /usr for you.

There are a few other directories you may find as well.

/opt folder
Pin it
/opt folder

Here's where optional stuff is put. Trying out the latest Firefox beta? Install it to /opt where you can delete it without affecting other settings. Programs in here usually live inside a single folder which contains all of their data, libraries, etc.

/usr/local folder
Pin it
/usr/local folder

This is where most manually installed (ie. outside of your package manager) software goes. It has the same structure as /usr. It is a good idea to leave /usr to your package manager and put any custom scripts and things into /usr/local, since nothing important normally lives in /usr/local.

/media folder
Pin it
/media folder

Some distros use this folder to mount things like usb disks, cd or dvd drives and other filesystems.

Now you can consider yourself one step closer to a master Linux user. These directories, while at first a little confusing, will become second nature to you after a bit of use.

← previous
next →
loading
sending ...
New to Neperos ? Sign Up for free
download Neperos App from Google Play
install Neperos as PWA

Let's discover also

Recent Articles

Recent Comments

Neperos cookies
This website uses cookies to store your preferences and improve the service. Cookies authorization will allow me and / or my partners to process personal data such as browsing behaviour.

By pressing OK you agree to the Terms of Service and acknowledge the Privacy Policy

By pressing REJECT you will be able to continue to use Neperos (like read articles or write comments) but some important cookies will not be set. This may affect certain features and functions of the platform.
OK
REJECT