UN100 - Linux part 2
Which character combination makes up the shebang used in Linux to define the shell used for a shell script?
#!
What command should you use to perform a command substitution to assign the output of a command to a variable in your shell script?
$()
What environment variable contains the username of the user who started the shell?
$USER
What command should you use to perform a mathematical operation in your shell script?
$[]
Frank wants to run his large number-crunching application in background mode on his console session. What command does he need to use to do that?
&
What tar command-line option is commonly used to extract and decompress files from a tarball file?
-zxvf
What file name extension does the CentOS Linux distribution use for packages?
.rpm
Where should you place a new configuration file to add a third-party repository to a Red-Hat package management system?
/etc/yum.repos.d
Henry needs to store the output from his script into a log file that he can read later. What character or characters should he use to do that?
>
By default, if you specify no command-line options, what does the pc command display?
All processes run by the current shell
When will the cron table entry 10 5 * * * myscript run the specified shell script?
At 5:10 a.m. every day
How do you determine the default job running in a console session?
By a plus sign next to the job number in the jobs output
Which of the following statements best describes packet filtering?
Identifying network packets via their control information, and determining what to do based upon ACL rules
Peter Quill, a Linux system administrator, has been testing a new firewalld configuration. The test was successful. What should Mr. Quill do next?
Issue the firewall-cmd --runtime-to-permanent command using super user privileges.
Which of the following are true concerning both DenyHosts and Fail2ban?
It modifies the /etc/hosts.deny file, It is an intrusion detection system (IDS)
Which of the following are benefits of a stateful firewall over a stateless firewall?
It operates faster for established connections, It determines if packets are fragmented.
What user categories can be assigned permissions in Linux?
Others, Owner, Group
What SELinux mode tracks policy violations but doesn't enforce them?
Permissive
When Melanie runs a shell script, she notices that it takes up all of the memory on her Linux system and she needs to stop it. How can she do that?
Press Ctrl+C while the script is running.
How can you temporarily pause a shell script from running in foreground mode in the console session?
Press the Ctrl+Z combination
Shelly thinks that one of the applications on her Linux system is taking up too much physical memory and may have a problem. What column of data from the top output display should she focus on?
RES
What top command displays cumulative CPU time instead of relative CPU time?
S
Sam needs to allow standard users to run an application with root privileges. What special permissions bit should she apply to the application file?
SUID
Nick needs to run a report at midnight every day on his Linux system. How should he do that?
Schedule the job using cron.
Which of the following are true concerning firewalls on Linux?
They inspect network packet control information, They employ configuration files for persistency, They use ACLs for allowing packets
Which of the following are the types of option styles available for the ps command?
Unix, BSD, GNU
How do you identify the legacy Unix style options for the ps command?
Use a single dash in front of the option.
What permissions can be applied to a file or directory?
Write, Read, Execute
What command allows you to run a shell script at a specific time?
at
Fred was assigned the task of creating a new group on the company Linux server and now needs to assign permissions for that group to files and directories. What Linux commands should he use to change the group assigned to the files and directories?
chgrp, chown
Sherri is trying to compile an application from source code. Before she can create the application executable file, what script should she run to create the make script?
configure
Jane needs to check on what jobs are scheduled to run automatically for her user account. What command should she use to list the cron table entries for her user account?
crontab
What programs do you use to install packages from a Red Hat-based repository?
dnf, yum
Sally needs to install a new package on her Ubuntu Linux system. The package was distributed as a .deb file. What program should she use?
dpkg
Christina is creating a bash shell script and wants to make the script return a value of 2 if it fails. What statement should she add to do that?
exit
Barbara has an application running in background mode in her console session and needs to bring it to foreground mode. What command should she use to do that?
fg
What is the most popular compiler used for open-source Linux applications?
gcc
Sally needs to view the ACL permissions assigned to a file on her Linux server. What command should she use?
getfacl
Cameron is writing a bash shell script and needs to test if a file exists and that it's a file. What line of code should he write to do that?
if [-f file ]
Virginia Potts is administering a Linux system with a firewall. She has already set up an IPset and named it BlockThem. A new attack has begun to occur from the 72.32.138.96 address. Along with super user privileges, what command should Ms. Potts issue to add this IPv4 address to the IPset?
ipset add BlockThem 72.32.138.96
Frankie used the ps command to find the process ID of an application that he needs to stop. What command-line tool should he use to stop the application based on its process ID?
kill
Ted is tasked with documenting the SELinux security context assigned to a group of files in a directory. What command should he use?
ls -Z
Fred received an application in source code format. What script should he run to create the executable application program?
make
Jessica has an application that crunches lots of numbers and uses a lot of system resources. She wants to run the application with a lower priority so it doesn't interfere with other applications on the system. What tool should she use to start the application program?
nice
What command do you use to disconnect a shell script from the current console so that it can continue to run after the console exits?
nohup
You need to stop an application from running on your Linux system. You know the name of the application file, but not the process ID assigned to it. What tool can you use to stop the application?
pkill
Jimmy noticed his Linux system was running slow. He ran the top command and found out that a data-intensive application was consuming most of the CPU time. He doesn't want to kill the application but wants to give it a lower priority so it doesn't take up too much CPU time. What tool should he use to change the priority of the running application?
renice
What are the equivalent symbolic mode permissions for the octal mode value of 644?
rw-r--r--
Sophia is a Linux system administrator of a system using the iptables service. She wants to add a rule to block only incoming ping packets and not send a rejection message to the source. What command should she employ?
sudo iptables -A INPUT -p icmp -j DROP
Which of the following is an example of UFW simple syntax for blocking all incoming and outgoing OpenSSH connections without providing a blocking message?
sudo ufw deny 22/tcp
Which of the following commands will allow you to view the various rules in a UFW firewall with their associated numbers?
sudo ufw status numbered
You are required to log into your Linux system as a standard user but needs to run an application with administrator privileges. What commands can you use to do that?
sudo, su
What user groups are commonly used to assign privileges for group members to run applications as the administrator?
sudo, wheel
Harry has finished writing his application source code but needs to package it for distribution. What tool should he use so that it can be extracted in any Linux distribution?
tar
Charles noticed that his Linux system is running slow and needs to find out what application is causing. What tool should he use to show the current CPU utilization of all the processes running on his system?
top
Jasmine has created a new bash shell script and wants to run it from the command line. What chmod permission should she assign to the file to run it as a shell script?
u+x
Zuri is writing a bash shell script and needs to assign a number to a variable. How should he do that?
var1=10
Which of the following programs should you use to download tarballs from an application's website?
wget, cURL
The firewalld service uses _____, which is a predefined rule set.
zones
What character or combination of characters do you use to redirect the output of one command to another command?
|