Filesystem Hierarchy Standard Flashcards

1
Q

/

A
"root",
"root directory",
"primary hierarchy", 
shares a name with the root user only by coincidence,
the all-encompassing base directory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

/bin

A

“binary”,
contains only binaries that are essential and should be available during booting and rescuing,
not intended to be edited by users

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

/sbin

A

“system binary”,
contains only essential binaries for use by the root user or for use in single-user mode,
not intended to be edited by users

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

/boot

A

“boot”,
contains only essential static files needed by the bootloader,
does NOT contain the kernel!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

/mnt

A

“mount”,
the conventional place to mount stuff,
# mount /dev/sdc2 /mnt/movies-partition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

/usr

A

“Unix System Resources”,
sometimes “user” (I think this is controversial),
files placed by distribution that are used in the scope of the distribution,
also contains ‘/usr/local’ directory for files of a smaller scope,
is not intended to be configured by the user,
FHS defines this directory as ‘read-only’, but contradicts by requiring /usr/local/{,s}bin which must be read/write

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

/usr/bin

A

essential distribution-scope binaries,

http://lists.busybox.net/pipermail/busybox/2010-December/074114.html

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

/usr/sbin

A

essential distribution-scope system binaries for use by root user or in single-user mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

/usr/lib

A

libraries required by the distribution and distribution-scope systems

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

/usr/include

A

include files for the C compiler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

/usr/share

extra credit: what important linuxy thing stores it’s important files in a subdirectory here?

A

read-only architecture-independent data files like:
documentation,
native language support,
word lists

files here are not intended for user customization,

extra credit: /usr/share/man is where man pages are stored!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

/usr/local

A

files relevant only to the local system such as applications customized to the specific use-case of your system

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

/lib

A

“library”,

shared library files required during boot or rescue mode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

/lib64

A

shared library files required during boot or rescue mode relevant to systems with 64-bit architecture

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

/tmp

A

“temporary”,
intended to store files that do not need to persist,
in most systems stuff in here will be gone next boot,
tmpfiles.d

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

/var

A

“variable”,
“various”,
“variable data”,
the standard subdirectory of the root directory for writing during operation,

this directory is defined as being specific to the local system as if it was in /usr/local BUT /usr needs to have the potential to be read-only by default (according to FHS) and /var needs to be read/write so that you can write to /var/log and /var/cache,

contains ‘variable data’ and logs from applications running on the system,
http://www.linfo.org/var.html

17
Q
You created a neat custom script that you are going to use to download youtube videos. What directory should you put it in?
/bin
/sbin
/usr/bin
/usr/sbin
/usr/local/bin
/usr/local/sbin
A

/usr/local/bin is a directory set aside for you to place binaries and scripts for use on the local machine

/bin and /sbin are at lower root directory, and as such have a wider scope. The files there are available earlier in the boot order, and so they should be reserved only for essential binaries that are needed during boot and rescue. both /bin and /sbin, and most directories at the root level are not intended to be edited by the user, so you should not place custom stuff here. stuff at this level is intended to be modified only by fancy Linux developers and the applications they develop.

/usr/bin and /usr/sbin are at the distribution’s level of the hierarchy. everything here is intended to apply to everyone using this distribution. the /usr directory is not intended to be edited by the user, so you should not place custom applications here. This stuff is supposed to be engineered by the people that create the Linux distribution you are running, and the applications they develop and configure

18
Q

/opt

A

“Optional”,
this is vendor stuff like from Oracle,
these static files are not intended to be edited by the user

19
Q

Your custom pokemon-themed distribution features a heavily modified version of the Vim editor that is used by default. It includes many extra features optimized for editing and viewing e-mails, creating tables and charts, and even tracks the weather and stocks. Where, of these options, should you place the binary for this application?:

/bin
/sbin
/usr/bin
/usr/sbin
/usr/local/bin
/usr/local/sbin
A

/usr/bin is the best spot for this one. As the creator of this distribution, you have decided that this custom editor is the default. Placing the binary here will ensure that it is treated as such.

/bin is only for essential binaries. while you want your version of Vim to be used by everyone that uses your distribution, it is not an essential binary for booting or rescuing your system. You will probably use a more minimalist editor for these situations.

/usr/local/bin is not the right place, either, as this directory is intended only for things that are relevant just for your local system. It may be your custom creation, but you intend for everyone using the distro to use this and not just users on your actual PC.

the ‘sbin’ options are all not the correct option because sbin is for root user and single-user mode only

20
Q

You need to adjust the configuration file for a malware scanner that is installed on your system. Using the ‘which’ command, you discovered the binary for the application is located in /usr/sbin.

The scanner is preventing you from accessing the internet, and you don’t have any documentation installed. What directory, of these options, do you look in to try and find a configuration file?:

/bin
/usr/bin
/home
/usr/local/bin
/etc
/usr/sbin
/usr/etc
A

/etc is the directory for user configuration files. since the binary you are running is in /usr/sbin, the configuration files for this version of the application you are running should be stored in /usr/etc, according to the FHS.

Sometimes applications scan for configuration files in an order, like how the user’s $PATH works. You can expect this order to follow the hierarchy from the FHS with the addition of a layer for the individual user in that user’s home directory.

The contents of the /home directory are not defined in the FHS, except that it is for the users to have a space and it is up to ‘the administrator’ how to structure it. Schemes that include ~/.config directory or other directories in the user’s home directory are not defined in the FHS but are used very commonly. This directory’s scope is more local than the /usr/local directory in that it applies only to an individual user.

The /home directory is considered optional and applications are advised against relying even on its existence:

“/home is a fairly standard concept, but it is clearly a site-specific filesystem. [9] The setup will differ from host to host. Therefore, no program should rely on this location. [10]” -https://www.pathname.com/fhs/pub/fhs-2.3.html#HOMEUSERHOMEDIRECTORIES

However, /home can obviously be reliably found in every distribution, and its use, AFAIK, is always the same, with /home/ for each user, and “Documents, Downloads, Pictures” and all that always included in the directory.

21
Q

An application you are troubleshooting has seg faulted, and you use systemd utilities to capture the coredump. You missed the path for the coredump in the output.

Where should you start looking for the coredump?

/sys
/usr/local
/var/lib
/media
/var/cache
A

/var/lib is the right answer here. The application coredump is state information, as it is not a log or spooled data and it is edited by an application

22
Q

/var/lib

A

“variable state information”,
state information is a type of data that is:
1- edited by an application as that application is running
2- is not a log
3- is not spooled data
4- contains information about the state of an application

Examples:
1-  savefiles
2- network scans
3- application coredumps
4- leaderboard
23
Q

/media

A
this one is like /mount; it is optional and conventionally used to serve mounted storage devices. this directory just seems to be more semantically pleasing to use than /mount for certain purposes. many desktop environments automatically mount certain devices here like audio discs and media players. this directory is defined in the FHS with many other optional directories that are all officially detailed:
/media/floppy
/media/cdrom
/media/cdrecorder
/media/zip
/media/usb
24
Q

1) What is a volatile filesystem?

2) What are the names of the volatile filesystems defined in the FHS?

A

A volatile filesystem exists in volatile memory i.e. RAM,
data stored here is not expected to persist in between sessions,
I’m actually not sure if they are strictly defined in the FHS as they are mentioned only in the Linux section (the only section) of the Operating System Specific Annex, but these are them:
/proc
/sys
/dev

25
Q

/proc

A

“process”,
“process and system information”,
the kernel has this cool pseudo-filesystem ‘procfs’ that is provided as an interface to the kernels’s internal data structures related to processes,
every process running has a directory in /proc by its pid,
kernel data relevant to the process is stored in that process’ directory in /proc,
many important linux commands reference the /proc directory such as ‘ps’,
man 5 proc,
https://unix.stackexchange.com/questions/4884/what-is-the-difference-between-procfs-and-sysfs

26
Q

/sys

A

“sysfs”,
the directory for sysfs, a pseudo filesystem designed to expose kernel data,
like /proc but with kobjects,
man 5 sysfs,
https://unix.stackexchange.com/questions/4884/what-is-the-difference-between-procfs-and-sysfs

27
Q

You are enjoying a graphical video game on your enterprise multi-user unix server, and want to use graphics in the game for memes because you are such a big fan. The image files that the game uses are inaccessible to you, as they are streamed from servers you don’t control and are arranged by the application as it is running on your local system. You know this because you are a big fan. But also you don’t know how to take screen shots.

You know that in Unix everything is a file… which means those graphics must be a file right? Where would you look for the graphics on the system?

A

/proc and /sys will definitely store the graphics. if the application can access a graphic, it must be stored in that application’s allocated memory at some point.

i think the graphic would be accessible in /proc/whatever-the-pid-is/fd/[0,1,2,3…]

28
Q

/dev

A

“devices”,
“udev”,
a volatile filesystem created by udev to represent the devices that udev discovers. Udev probes your hardware and sets up the interface to it via directories, device events, permissions,
not user editable,
this is where you mount stuff FROM, like:
# mount /dev/sdc2 /mnt/movies-partition