TR1 Flashcards

1
Q

Could you highlight the major differences between RHEL 6 and RHEL 7?

A

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

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

Could you explain the difference between the “grep” and “find” commands?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How can you locate files created within the last ten days in the current working directory and copy them to the “/tmp” directory?

A

find . -type f -ctime -10 -exec cp {} /tmp \;

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

What command identifies files modified in the last 20 minutes under the “/var/log/” directory?

A

find /var/log -type f -mmin -20

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

How can you extract all messages related to “kernel” from system logs and save them in /tmp/kernel-logs

A

grep kernel /var/log/messages&raquo_space; /tmp/kernel-logs

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

What is the command to change ownership and basic permissions on files and directories?

A

change ownership: chown
change basic permissions: chmod

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

How do you extract all lines containing the words “ssh” or “root” from a text?

A

egrep “ssh|root” <filename></filename>

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

How can you monitor real-time updates in the /var/log/secure file?

A

tail -f /var/log/secure

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

What is the command to grep all lines containing ““root,”” show 2 lines after each, and 2 lines before,
from the ““/etc/passwd”” file?”

A

grep root /etc/passwd -C2
grep root /etc/passwd -A2 -B2

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

How can you find all lines in the “/etc/passwd” file that do not contain the string “root”?

A

grep -v root /etc/passwd

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

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””?”

A

ps ef | grep -v root&raquo_space; process_file
ps aux | grep -v root&raquo_space; process_file

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

You intend to compress and archive the ““/data”” file system. Which command can you use to archive
and compress ““/data”” in a single step?”

A

tar -cvzf data.tar.gz /data

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

In a filesystem that’s 100% full, how would you identify the files consuming the space?

A

find / -type f -exec du -h {} + | sort -rh | head

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

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?

A

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

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

What are the numeric values assigned by the system for read, write, and execute permissions?

A

read: 4, write: 2, execute: 1

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

What is the purpose of the umask? What are the default umask values for the ““root”” user and a regular
user?”

A

umask defines the default permissions assigned to newly created files and directories.
root has a default umask of 0022.
users have a default umask of 0002.
The first bit is for special permissions.
a utility which defines the default permissions being assigned to a file or directory during creation
root = 0022
regular user = 0002

17
Q

While using the vi editor, if you wish to change “Rohit” to “sharma,” how would you do that?

A

:%s/Rohit/sharma/g (command mode)

18
Q

Can you differentiate between a Primary group and Supplementary/Secondary group?

A

Primary group: Assigned at user creation in /etc/passwd
Secondary group: assigned using usermod -aG <group_name> <user> (a for append, G for secondary group, g for primary group)
primary group is assigned to a user when the user is created
secondary group is added with usermod -aG <group> <username></username></group></user></group_name>