Linux Study Guide for CCTC Exam
Questions with Complete Solutions
3.2 Describe the file system ownership properties - ANSWER-- use su to use root
password for complete access
- files are automatically owned by the person that created them
- for specifying the owner you use -u
ls -l = this tell you information about the file
3.3 Describe the file system permissions - ANSWER-ls -l [fileName]
- read (r), write (w), execute (x)
file system timestamps - ANSWER-- Access: last time file was read
- Modify: last time file content was modified
- Change: last time meta data of the file was changed (i.e. permissions)
file system attributes - ANSWER-use +[attr] to set and -[attr] to clear:
a append only
c compressed
d not backed up to a dump
h blocksize storing
i immutable
j journaling
s blocks are zeroed
t no tail merging
u undeletion
v version
A no atime record
D changes writing to disk
E file using extent format
I indexed directory
S contents written synchronously
T top of directory hierarchy
X raw contents of compressed file
Z indicates a compressed dirty file
commands for searching file system - ANSWER-$find [path] -[options] [expression]
Use grep to add search for content:
find [path] -[options] | grep "somestring"
-B before the expression
-A after the expression
Awk is used to find/replace text or perform a specific action on the text
-F specify the field separator
, how to create regular expressions - ANSWER-. single character
? char matches at most 1 time
* char matches 0 or more times
+ char matches 1 or more times
{n} char matches n times
{n,m} matches between n and m
{agd} char included in the given
{^agd}char not included in given
[c-f] char is in the given range
() group chars to behave as one
| logical OR
& logical AND
^ matches beginning of line
$ matches the beginning of line
Linux boot process (up to kernel) - ANSWER-1. BIOS: searches for, loads and
executes boot loader program
2. MBR: 1st sector of bootable disk; includes: Bootstrap Code, Partition Table, Boot
Signature
3. GRUB: loads kernel image; has knowledge of the filesystem; can boot multiple OS
and kernels
4. Kernel: mounts the root file system; executes /sbin/init/; initrd is used by kernel as
a temp root filesystem until the real root file system is mounted
post kernel linux boot process - ANSWER-5. Init: identifies default initlevel; decides
Linux run runlevel
0- halt (shutdown)
1- single user
2- multiuser safemode
3- multiuser w/ networking
4- unused
5- multiuser w/ GUI
6- reboot
6: Runlevel: runlevel programs exexutes the programs from /etc/rc#.d/ where # = run
level
differences in boot processes across linux variants - ANSWER-SysV Init vs Systemd
SysV Init has PID = 1; starts at startup and runs till shutdown; if it can't start the
systems enters Kernel panic mode. SystemD also had PID=1 buts runs in
background and initiates parallel daemons so boot up is shorter.
UEFI vs MBR:
UEFI uses GPT so you can have unlimited paritions and is filesystem aware
what is a partition - ANSWER-logically divides a hard disk; standard is 4
Questions with Complete Solutions
3.2 Describe the file system ownership properties - ANSWER-- use su to use root
password for complete access
- files are automatically owned by the person that created them
- for specifying the owner you use -u
ls -l = this tell you information about the file
3.3 Describe the file system permissions - ANSWER-ls -l [fileName]
- read (r), write (w), execute (x)
file system timestamps - ANSWER-- Access: last time file was read
- Modify: last time file content was modified
- Change: last time meta data of the file was changed (i.e. permissions)
file system attributes - ANSWER-use +[attr] to set and -[attr] to clear:
a append only
c compressed
d not backed up to a dump
h blocksize storing
i immutable
j journaling
s blocks are zeroed
t no tail merging
u undeletion
v version
A no atime record
D changes writing to disk
E file using extent format
I indexed directory
S contents written synchronously
T top of directory hierarchy
X raw contents of compressed file
Z indicates a compressed dirty file
commands for searching file system - ANSWER-$find [path] -[options] [expression]
Use grep to add search for content:
find [path] -[options] | grep "somestring"
-B before the expression
-A after the expression
Awk is used to find/replace text or perform a specific action on the text
-F specify the field separator
, how to create regular expressions - ANSWER-. single character
? char matches at most 1 time
* char matches 0 or more times
+ char matches 1 or more times
{n} char matches n times
{n,m} matches between n and m
{agd} char included in the given
{^agd}char not included in given
[c-f] char is in the given range
() group chars to behave as one
| logical OR
& logical AND
^ matches beginning of line
$ matches the beginning of line
Linux boot process (up to kernel) - ANSWER-1. BIOS: searches for, loads and
executes boot loader program
2. MBR: 1st sector of bootable disk; includes: Bootstrap Code, Partition Table, Boot
Signature
3. GRUB: loads kernel image; has knowledge of the filesystem; can boot multiple OS
and kernels
4. Kernel: mounts the root file system; executes /sbin/init/; initrd is used by kernel as
a temp root filesystem until the real root file system is mounted
post kernel linux boot process - ANSWER-5. Init: identifies default initlevel; decides
Linux run runlevel
0- halt (shutdown)
1- single user
2- multiuser safemode
3- multiuser w/ networking
4- unused
5- multiuser w/ GUI
6- reboot
6: Runlevel: runlevel programs exexutes the programs from /etc/rc#.d/ where # = run
level
differences in boot processes across linux variants - ANSWER-SysV Init vs Systemd
SysV Init has PID = 1; starts at startup and runs till shutdown; if it can't start the
systems enters Kernel panic mode. SystemD also had PID=1 buts runs in
background and initiates parallel daemons so boot up is shorter.
UEFI vs MBR:
UEFI uses GPT so you can have unlimited paritions and is filesystem aware
what is a partition - ANSWER-logically divides a hard disk; standard is 4