TR1 Flashcards
Could you highlight the major differences between RHEL 6 and RHEL 7?
different kernel versions (6 vs 7).
rhel 6 is init based and rhel 7 is systemd based.
rhel 6 uses ext4 filesystem while rhel 7 uses xfs.
RHEL 6 - grub, kernel 2.6, iptables, default filesystem is ext4, run levels, init, maximum file size 16TB
RHEL 7 - grub2, kernel 3, firewalld, default filesystm is xfs, targets, system, maximum file size 500TB
Could you explain the difference between the “grep” and “find” commands?
grep command allows you to find a pattern or strings whereas find command allows you to look for files and directories
grep - finds patterns/strings from contents of a file
find - used to find file or directories within the system
How can you locate files created within the last ten days in the current working directory and copy them to the “/tmp” directory?
find . -type f -ctime -10 -exec cp {} /tmp \;
What command identifies files modified in the last 20 minutes under the “/var/log/” directory?
find /var/log -type f -mmin -20
How can you extract all messages related to “kernel” from system logs and save them in /tmp/kernel-logs
grep kernel /var/log/messages»_space; /tmp/kernel-logs
What is the command to change ownership and basic permissions on files and directories?
change ownership: chown
change basic permissions: chmod
How do you extract all lines containing the words “ssh” or “root” from a text?
egrep “ssh|root” <filename></filename>
How can you monitor real-time updates in the /var/log/secure file?
tail -f /var/log/secure
What is the command to grep all lines containing ““root,”” show 2 lines after each, and 2 lines before,
from the ““/etc/passwd”” file?”
grep root /etc/passwd -C2
grep root /etc/passwd -A2 -B2
How can you find all lines in the “/etc/passwd” file that do not contain the string “root”?
grep -v root /etc/passwd
A colleague wants a list of all non-root processes running on your system. How can you provide this
information in a file named ““process_file””?”
ps ef | grep -v root»_space; process_file
ps aux | grep -v root»_space; process_file
You intend to compress and archive the ““/data”” file system. Which command can you use to archive
and compress ““/data”” in a single step?”
tar -cvzf data.tar.gz /data
In a filesystem that’s 100% full, how would you identify the files consuming the space?
find / -type f -exec du -h {} + | sort -rh | head
If a user’s home directory is using 50 GB, they delete a 25 GB file, and ““df -h”” still reports 50 GB. What’s
causing this discrepancy?
The same filesystem is being used somewhere else. Could be a hard-link issue because if you delete a file that has a hard-link, the files data is still on the system until you also delete the hard-link.
df gives you disk utilization + cache
the deleted file may still be being used by a running process, cache hasn’t cleared up yet, the impact of deleting a file cannot be seen immediately with df -h
What are the numeric values assigned by the system for read, write, and execute permissions?
read: 4, write: 2, execute: 1