02 - Linux Directory and File System Flashcards

1
Q

What the three varieties of file systems in Linux?

A
  1. Disk-based
  2. Network-based
  3. Memory-based
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is disk-based file system?

A

Disk-based file systems are typically created on physical media such as hard drive or a USB flash drive.

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

What is network-based file system?

A

Network-based file systems are essentially disk-based file systems that are shared over the network for remote access.

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

What is memory-based file systems?

A

Memory-based file systems are virtual; they are created automatically at system startup and destroyed when the system goes down.

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

What is /etc?

A

The /etc directory holds system configuration files. Some common sub directories are systemd, sysconfig, lvm, and skel, which comprise configuration files for systemd, most system services, logical volume manager (lvm) and per-use shell startup template files, respectively.

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

What is /root?

A

The /root is the default home directory location for the root user.

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

What is /mnt?

A

The /mnt is used to mount a file system temporarily.

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

What is /boot?

A

The /boot file system contains the linux kernel, boot support files, and boot configuration files.

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

What is /home?

A

The /home directory is designed to store user home directories and other user contents. Each user is assigned a home directory to save personal files, and the user can block access to other users.

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

What is /opt?

A

The /opt (optional) directory can be used to hold additional software that may need to be installed on the system. A subdirectory is created for each installed software.

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

What is /usr?

A

The /usr (Unix System Resources) directory contains most of the system files. Some of the subdirectories are: /usr/bin, /usr/sbin, /usr/lib, /usr/lib64, /usr/include, /usr/local, /usr/share, /usr/src.

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

What is /usr/bin and /usr/sbin?

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

What is /usr/lib and /usr/lib64?

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

What is usr/include?

A

This directory contains header files for C language.

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

What is usr/local?

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

What is usr/share?

A

This is the directory for manul pages, documentation, sample template, configuration files, etc., that may be shared with other linux platforms.

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

What is /var?

A

The /var (variable) directory contains data that frequently changes while the system is operational. Files in this directory contain log, status, spool, lock, and other dynamic data. Some /var/log, /var/opt, /var/spool, /var/tmp

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

What is usr/src?

A

This directory is used to store source code.

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

What is /var/log?

A
19
Q

What is /var/opt?

A
20
Q

What is /var/spool?

A
21
Q

What is /var/tmp?

A
22
Q

What is /tmp?

A

This directory is a repository for temporary files. Many program crate temporary files here during runtime or installation. These files survive system reboots and are automatically removed if they are not accessed or modified for a period of 10 days.

23
Q

What is /dev?

A

The Devices (device file system) file system is accessible via the /dev directory and is used to store device nodes for physical hardware and virtual devices. The linux kernel communicates with these devices through corresponding device nodes located here. These devices automatically created and deleted by the udevd service (a linux service for dynamic device management) as necessary.

24
Q

What are character device files?

A

Character device files are the devices that are accessed serially with streams of bits transferred during kernel and device communication. Examples of such devices are console, serial printer, mice, keyboards, terminal, etc.

25
Q

What are block device files?

A

Block device files are the devices that are accessed in parallel fashion with data exchanged in blocks (parallel) during kernel and device communication. Data on block devices is accessed randomly. Examples of such devices are hard disk drives, optional drives, parallel printers, etc.

26
Q

What is /proc?

A

The Procfs (process file system) file system is accessible via the /proc directory, and it is used to maintain information about the current state of the running kernel. This includes the details for current hardware configuration an status information on CPU, memory, disks, partitioning, file systems, networking, running processes, and so on. This information is stored in a hierarchy of subdirectories that contain thousands of zero-length pseudo files. These files point to relevant data maintained by the kernel in the memory. This virtual directory structure simply provides an easy interface to interact with kernel-maintained information. The Procfs file system is dynamically managed by the system.

The contents in /procs are created in memory at system boot time, update during runtime, and destroyed at system shutdown.

27
Q

What is /run?

A

The Runtime file system is a virtual file system. This virtual file system is a repository of data for processes on the system. One of its subdirectories, /run/media, is also used to automatically mount external file systems such as those that are on optical and flash USB.

28
Q

What is /sys?

A

The system file system. Information about hardware devices, drivers, and some kernel features is stored and maintained in the /sys file system. This information is used by the kernel to load necessary support for the devices, create device nodes in /dev, and configure the devices. This file system is auto-maintained as well.

29
Q

What is tree command?

A

Tree command lists a hierarchy of directories and files.

-a = includes hidden files in the output
-d = excludes files from the output
-h = displays file sizes in human-friendly format
-f = prints the full path for each file
-p = includes file permissions in the output

30
Q

What does command prompt # and $ signifies?

A

is for the root user and $ is for the normal user.

31
Q

What are options and arguments in a command?

A

Optional are optional. You can specify zero or more options with a command. An option modifies the behavior of the command. An option may start with - (short format) or – (long format).

Arguments, in contrast, may be optional or mandatory depending on the command and its usage. An argument supplies a target on which to perform the command action.

32
Q

Listing files and directories

A

-a = include hidden files and directories in the output. (hidden files start with .)
-l = Displays a long listing with detailed file information including the file type, permissions, link count, owner, group, size, date and time of the last modification, and name of the file.
-ld = Display long listing of the specified directory but hides its content.
-lh = Displays long listing with files sizes shown in human-friendly format
-ltr = List all files sorted by date and time with the older file first
-R = Lists contents of the specified directory and all its subdirectories

33
Q

What is pwd?

A

The pwd (print working directory or present working directory) command displays a user’s current location in the directory tree.

34
Q

How do you identify terminal device file?

A

Linux allocates unique pseudo (or virtual) numbered device files to represent terminal sessions opened by users on the system. It uses these files to communicate with individual sessions. By default, these files are stored in the /dev/pts ( pseudo terminal session) directory. These files are created by the system and they are removed on its closure. The destroyed files are recreated and reused for new terminal sessions.

tty - teletype

35
Q

Inspecting system’s uptime and processor load

A

uptime

  1. current system time
  2. up duration
  3. no. of logged users
  4. CPU load averages for past 1, 5, and 15 mins
36
Q

Clear screen

A

clear

37
Q

Determining command path

A

RHEL provides a set of tools that can be used to identify path of the command that will be executed when you run it without you specifying the full path.

These tools are the which, whereis, and type commands.

38
Q

System information

A

The uname command identifies elementary information about the system including its hostname.

uname
uname -a

Displays:
1. Kernel name (-s)
2. hostname of the system (-n)
3. Kernel release (-r)
4. Date and time of the kernel built (-v)
5. Machine hardware name (-m)
6. Processor type (-p)
7. Hardware platform (-i)
8. Operating system name (-o)

39
Q

Viewing CPU specs

A

A CPU has many architectural pieces that can be looked using the lscpu command. These pieces include the CPU architecture, its opering modes, vendor family, model, speed, cache memory, and whether it supports virtualization.

40
Q

man help

A

:f = displays line number and bytes being viewed
q = quits the man pages
/pattern = searches forward for the specified pattern
?pattern = searches backward for the specified pattern
n / N = Find the next / previous occurrence
h - Gives help on navigational keys

man passwd
man 5 passwd

41
Q

Headings in the manual

A

NAME = Name of the command or file with a short description
SYNOPSIS = Syntax summary
DESCRIPTION = An overview of the command or file
OPTIONS = options available for use
EXAMPLES = some examples to explain the usage
FILE = a list of related files
SEE ALSO = reference to other manual pages or topics
BUGS = any reported bugs or issues
AUTHOR = contributor information

42
Q

Manual sections

A

The default behavior of the man command is to search through section 1 and each successive section until it finds a match.

When you run man passwd, the man command scans through the manual pages and the first occurrence it finds is of the passwd command that’s stored in section 1. If you want to consult the manual pages of the passwd configuration file, you would have to specify the section number with the command (man 5 pages) to instruct it to scan that one particular section only.

43
Q

Searching by keyword

A

Linux allows you to perform a keyword search on manual pages using the man command. But, before that you have to run mandb command.

catdir = /var/cache/overrides

  1. man -k xfs
  2. apropos xfs
44
Q

Exposing short description

A

The ‘whatis’ command searches for a short description of the specified command or file in the manual database.

  1. whatis yum.conf
  2. whatis passwd
  3. man -f yum.conf
  4. man -f passwd
45
Q

info and pinfo commands

A

The info and pinfo commands display command documentation in a document-like format in great detail. Documentation is divided into sections called nodes. The header across the top of the screen shows the name of the file being displayed, names of the current, next, and previous nodes, and name of the prior to the current node.

46
Q

Documentation in the /usr/share/doc directory

A

The /usr/share/doc directory stores general documentation for installed packages under subdirectories that match their names