WorksheetsRed Hat System Administrator 1
Total questions: 41
Worksheet time: 21mins
Which of the following commands will display the total size of the current directory in a human-readable format?
ls -lh
df -h
du -sh
stat .
Which of the following commands can be used to change a user's password
usermod -p
passwd
chgrp
pwconv
Which of the following is an example of sequentially running commands in Bash, where the second command only runs if the first succeeds?
whoami ; ls -la
whoami && ls -la
whoami || ls-la
whoami & ls -la
Which of the following examples shows a second command executing only if the first command fails in Bash?
cat aNewFile && touch aNewFile
cat aNewFile ; touch aNewFile
cat aNewFile || touch aNewFile
cat aNewFile & touch aNewFile
Which of the following symbols is used in Bash to continue a command onto a new line?
;
&&
|
\
In Bash, which key combination performs a reverse search through your command history?
Control + R
Control + H
Control + S
Control + P
In Bash, which of the following commands will display the system’s fully qualified domain name (FQDN)?
hostname --fqdn
dnsdomainname
hostnamectl status
cat /etc/hosts
Which of the following commands can be used to find the location of the passwd binary?
type -a passwd
locate passwd
apropos passwd
whereis passwd
Which of the following commands can be used to view the configuration (man) page for the crontab binary?
man 1 crontab
man 5 crontab
crontab -l
info crontab
In Red Hat Enterprise Linux, which of the following is the preferred tool for registering your system?
subscription-manager
redhat-register
yum register
rhc
What is the name of the AI service included in Red Hat Enterprise Linux?
Lightspeed
AI Engine
RedAI
SmartOps
Which of the following commands can be used to install the AI Command-Line Assistant on RHEL?
yum install command-assistant
dnf install command-line-assistant
rpm -i command-line-assistant
ai-install assistant
Which of the following commands demonstrates piping the output of a command into the AI Command-Line Assistant?
whoami | ai-assist "What does this mean?"
whoami | chat-bot "What does this mean?"
whoami | c chat "What does this mean?"
whoami | assistant-cli "What does this mean?"
Which of the following commands demonstrates attaching a file to the AI Command-Line Assistant and asking a question?
ai-assist -a /var/log/boot.log "Why did the last boot take so long?"
c chat -a /var/log/boot.log "Why did the last boot take so long?"
assistant-cli -a /var/log/boot.log "Why did the last boot take so long?"
chat-bot -a /var/log/boot.log "Why did the last boot take so long?"
Which command can be used to remove a directory and all it's contents?
rmdir ThisDir
rm -r ThirDir
rm ThirDir
unlink ThisDir
Which command will delete a directory and prompt the user before removing it's contents?
rm -r ThisDir
rm -f ThisDir
rm -ri ThisDir
rmdir -i ThisDir
Which of the following commands will create multiple directories while ensuring that the parent directory exists?
mkdir Directory/Study1 Directory/Study2 Directory/Study3
mkdir -p Directory/Study1 Directory/Study2 Directory/Study3
install -d Directory/Study1 Directory/Study2 Directory/Study3
mkdir -r Directory/Study1 Directory/Study2 Directory/Study3
Which of the following commands can be used to recursively list the contents of directories?
ls -LR
ls -lR
ls -d
ls -S
Which description best describes a hard link in Linux filesystems?
A pointer to another file that breaks if the original file is deleted
A separate file that contains a copy of the original file’s contents
A special file that can reference files across different filesystems
An alternate directory entry that refers to the same inode as the original file
Which of the following commands can be used to create a hard link?
ln myStudyNotes.txt myStudyLink
ln -s myStudyNotes.txt myStudyLink
cp myStudyNotes.txt myStudyLink
linkfile myStudyNotes.txt myStudyLink
Which statement best describes a symbolic (soft) link in Linux?
A file that points to another file by name and can span filesystems
An alternate directory entry that refers to the same inode as the original file
A copy of the original file that updates automatically when the original changes
A file that cannot be deleted unless the original file is deleted first
Which of the following commands can be used to visit a symbolic link directory and resolve the directory name to its real path?
cd -p myLink
cd -L myLink
cd myLink
cd -P myLink
Which of the following commands can be used to list all files in a directory that do not start with y?
ls [^y]*
ls !y*
ls [!y]*
ls -v y*
Which of the following commands can be used to efficiently create the directories test1, test2, and test3?
mkdir test[1-3]
mkdir -v test{1..3}
mkdir test?123
mkdir test1 test2 test3
Which of the following commands can be used to list a file called Study when you don’t know its file extension?
ls Study.*
ls Study.???
ls Study?
find . -name "Study"
Which of the following commands can be used to navigate to your previous working directory?
cd ~
cd ?
cd -
cd /
Which of the following commands can be used to find files larger than 10 MB?
find / -size +10M
find / -size 10M
find / -size -10M
find / >10M
Which of the following commands can be used to discard error messages produced by a command?
find / -size +10M > /dev/null
find / -size +10M &> /dev/null
find / -size +10M 2> /dev/null
find / -size +10M | /dev/null
Which of the following commands can be used to separate successful output and error output into two different files?
ls -la &> Successful Unsuccessful
ls -la | Successful 2| Unsuccessful
ls -la > Successful | 2> Unsuccessful
ls -la > Successful 2> Unsuccessful
Which of the following commands will redirect both successful output and error messages into a single file?
find / -size +10M &> Results
find / -size +10M > Results
find / -size +10M 2> Results
find / -size +10M | Results
Which two of the following commands can be used to count the number of files in a directory?
ls -l
ls | wc -l
wc -l *
find . -type f | wc -l
What does the shell redirection operator 2>&1 accomplish when used in a command?
Redirects standard output (stdout) to standard error (stderr)
Redirects standard error (stderr) to the same destination as standard output (stdout)
Redirects both standard output and standard error to a file named 1
Redirects file descriptor 2 to file descriptor 1 only if an error occurs
A system administrator runs a command and wants to see the output on the terminal in real time, while also saving the same output to a file for later review.
Which command should be used to achieve this?
command | tee output.txt
command > output.txt
command 2>&1 > output.txt
command >> output.txt
What is the correct format of an entry in the /etc/passwd file on a modern Red Hat–based system?
username:UID:x:GID:comment:home_directory:login_shell
username:x:GID:UID:comment:home_directory:login_shell
username:password:UID:GID:comment:home_directory:login_shell
username:x:UID:GID:comment:home_directory:login_shell
A system administrator needs to switch to the root user to perform system maintenance. The administrator wants to ensure that root’s full login environment is loaded, including the correct home directory, environment variables, and PATH.
Which command should be used?
su
sudo -s
sudo su
su -l
A system administrator needs to create a system group called TestSystemGroup on a Red Hat Linux system. Which command should be used?
groupadd TestSystemGroup
groupadd -g TestSystemGroup
groupadd -r TestSystemGroup
groupadd -G TestSystemGroup
A system administrator is managing a Red Hat Linux server. The group DevTeam already has some members. The administrator needs to add user1 and user2 to DevTeam without removing any existing group members, using a single command.
Which of the following commands will achieve this?
groupmod -G user1,user2 DevTeam
groupmod -aU user1,user2 DevTeam
usermod -a -G DevTeam user1,user2
groupadd -g DevTeam user1 user2
A system administrator wants to temporarily change his primary group to DevTeam so that any files he creates in the current session belong to that group. Which command allows him to do this?
usermod -g DevTeam
groupmod -g DevTeam
sg DevTeam
newgrp DevTeam
A system administrator needs to update a user’s password policy on a Red Hat Linux system using the chage command. The new policy requires:
Minimum password age: 0 days
Maximum password age: 120 days
Warning period before password expiration: 14 days
Account Inactivity period after password expires: 30 days
Which command correctly implements this policy for a user named jdoe?
chage -m 0 -M 120 -w 14 -i 30 jdoe
passwd -n 0 -x 120 -w 14 -i 30 jdoe
usermod -m 0 -M 120 -W 14 -I 30 jdoe
chage -m 0 -M 120 -W 14 -I 30 jdoe
A user is leaving the company, and your manager wants you to lock their account effective on 30 JAN 1999. Which usermod command correctly sets this lockout date for the user jdoe?
usermod -L -e 1999-01-30 jdoe
usermod -L -E 30-01-1999 jdoe
usermod -e 1999-01-30 jdoe
usermod -e 30JAN1999 jdoe
A user account mailSrv01 has been created for a mail server. You want to prevent this account from logging in interactively while keeping it available for system processes. Which usermod command achieves this?
usermod -L mailSrv01
usermod -s /sbin/nologin mailSrv01
usermod -e 1970-01-01 mailSrv01
usermod -p "*" mailSrv01
