quiz 10-12 linux
Which file/directory has an inode of 2?
/
Where do most log files reside on a Linux computer?
/var/log
You have Apache2 web server running on your Linux machine. Where would you look for the Apache log files that would help you diagnose problems?
/var/log/apache2
Look at the following output generated by the 'ls -l' command. 361 drwxr-x--- 12 bob bob 4096 Apr 6 14:35 subdir How many directories likely exist inside of subdir?
10
What does GPT stand for?
GUID Partition Table
What does the -F option do for awk?
It lets us choose the column separator for our file
When using awk, what happens to the separator (the space between columns)?
It magically disappears. We have to add a space back in.
How does Linux manage log files so they do not get too large and unwieldy?
Log files are frequently rotated and archived.
find /etc -name "hosts" 2>/dev/null > files.txt
The /etc directory will be searched Files that contain the name hosts will be written to files.txt Errors are discarded
Consider /dev/sdc8
This is the eighth partition of the third hard drive
pipe (|)
Used to pass the output of the first command to the second command as input. Can also be used to represent " or "
Which of the following regular expressions will match all words that do not start with an a, b, or c.
^[^abc]
Consider the following file named csv.txt: jsmith,14,4.0 cwherry,15,3.2 hcampbell,16,3.5 Which command will show only the usernames sorted in alphabetical order?
awk -F"," '{print $1}' csv.txt | sort
Consider the file ipaddress.txt: 123.25.36.128; 210.31.156.230; 178.200.16.5; Which command will list all the IP addresses without the semicolon?
awk -F";" '{print $1}' ipaddress.txt
What will the following command display? echo "bananas oranges grapes peaches " | awk '{ print $1 }'
bananas
echo "bananas oranges grapes peaches " | awk '{ print $0 }'
bananas oranges grapes peaches
Which command lists available free space on a volume?
df
grep
displays matching lines to a search string (text)
You are looking for a directory named grades off your home directory. This directory would have been created within the last 12 hours. What command will best help you find it?
find ~ -name grades -type d
This command searches content inside files for lines containing text matching a certain pattern
grep
Which command formats a partition?
mount /dev/sda8 ext4
How do you make a mount persist?
put an entry in /etc/fstab
Which command will replace all instances of day with night?
sed s/day/night/g day.txt
Which of the following commands will access the metadata of an inode?
stat
Occasionally an systems administrator will want to watch for log entries as they occur. Which command will provide you with a "live" watch of a log file?
tail -f logfile.txt
Which of the following commands will display the last 20 lines of a file named log.txt
tail -n 20 log.txt
If an hard link is created and the origin or source file is deleted, the inode number will still exist.
true
When combining awk and/or sed commands using a pipe (|), we only include the filename on the first command because the output of the first command is the input of the second command. awk -F ';' '{ print $8 }' master_file_room_104.dhcp | awk -F '.' '{ print $4 }'
true
You can run out of inodes before you run out of disk space.
true