wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Linux_1-25

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

1. An administrator accidentally deleted the /boot/vmlinuz file and must resolve the issue before the server is rebooted. Which of the following

commands should the administrator use to identify the correct version of this file?

a)

A. rpm -qa | grep kernel; uname -a

b)

B. yum -y update; shutdown -r now

c)

C. cat /etc/centos-release; rpm -Uvh --nodeps

d)

D. telinit 1; restorecon -Rv /boot

2.

2. A cloud engineer needs to change the secure remote login port from 22 to 49000. Which of the following files should the engineer modify to

change the port number to the desired value?

a)

A. /etc/host.conf

b)

B. /etc/hostname

c)

C. /etc/services

d)

D. /etc/ssh/sshd_config

3.

3. A new file was added to a main Git repository. An administrator wants to synchronize a local copy with the contents of the main repository. Which

of the following commands should the administrator use for this task?

a)

A. git reflog

b)

B. git pull

c)

C. git status

d)

D. git push

4.

4. A Linux administrator needs to redirect all HTTP traffic temporarily to the new proxy server 192.0.2.25 on port 3128. Which of the following

commands will accomplish this task?

a)

A. iptables -t nat -D PREROUTING -p tcp --sport 80 -j DNAT - -to-destination 192.0.2.25:3128

b)

B. iptables -t nat -A PREROUTING -p top --dport 81 -j DNAT --to-destination 192.0.2.25:3129

c)

C. iptables -t nat -| PREROUTING -p top -sport 80 -j DNAT --to-destination 192.0.2.25:3129

d)

D. iptables -t nat -A PREROUTING -p tcp -dport 80 -j DNAT --to-destination 192.0.2.25:3128

5.

5. Developers have requested implementation of a persistent, static route on the application server. Packets sent over the interface eth0 to

10.0.213.5/32 should be routed via 10.0.5.1. Which of the following commands should the administrator run to achieve this goal?

a)

A. route -i etho -p add 10.0.213.5 10.0.5.1

b)

B. route modify ethO +ipv4.routes "10.0.213.5/32 10.0.5.1"

c)

C. echo "10.0.213.5 10.0.5.1 ethO" > /proc/net/route

d)

D. ip route add 10.0.213.5/32 via 10.0.5.1 dev eth0

6.

6. A user is asking the systems administrator for assistance with writing a script to verify whether a file exists. Given the following:

#1/bin/bash

filename=$1

<CONDITIONAL>

echo "File exists"

else

echo "File does not exist"

fi

a)

A. if [-f "$filename" ]; then

b)

B. if [-d "filename" ]; then

c)

C. if [-f "Sfilename" ] then

d)

D. if [ -f "$filename" ]; while

7.

7. Simulasyon Sorusu

DRAG DROP -

As a Systems Administrator, to reduce disk space, you were tasked to create a shell script that does the following:

Add relevant content to /tmp/script.sh, so that it finds and compresses related files in /var/log without recursion.

INSTRUCTIONS:

Drag and drop snippets to fill the blanks to build a script that performs the actual compression of rotated log files.

If at any time you would like to bring back the initial state of the simulation, please click the Reset All button.

#!/bin/bash

#name: script.sh

find /var/log -type f -maxdepth 1 | grep ................ > /tmp/tempfile .........

filename ..... $(cat................)

do

............ $filename

............

a)

Bosluklara sürüklenecek ifadeler sirayla

"$log.[1-6]$"

for

in

/tmp/tempfile

gzip

done

b)

B. bos

8.

8. A systems administrator is deploying three identical, cloud-based servers. The administrator is using the following code to complete the task:

resource “abc instance" "ec2_ instance” {

ami = data.abc_ami.vendor-Linux-2.id

associate pubilp iaddcres s = true

count = 3

instance_type = "instance_type”

vpc_ security group ids = [abc.security group.allow_ssh.

id]

key_name = abc_key pair.key pair.key_ name

tags = {

Name = "${var.nmamespace} $(count.index)"

}

}

Which of the following technologies is the administrator using?

a)

A. Ansible

b)

B. Puppet

c)

C. Chef

d)

D. Terraform

9.

9. Which of the following technologies can be used as a central repository of Linux users and groups?

a)

A. LADP

b)

B. MFA

c)

C. SSO

d)

D. PAM

10.

10. A systems administrator is troubleshooting connectivity issues and trying to find out why a Linux server is not able to reach other servers on the

same subnet it is connected to. When listing link parameters, the following is presented:

# ip link list dev etho

2: etho: <NO-CARRIER, BROADCAST, MULTICAST, UP> mtu 1500, qdisc

fq_codel state DOWN mode DEFAULT group default qlen 1000

link/ether ac:00:11:22:33:cd brd ff:ff:ff:ff:ff:ff:ff

Based on the output above, which of following is the MOST probable cause of the issue?

a)

A. The address ac:00:11:22:33:cd is not a valid Ethernet address

b)

B. The Ethernet broadcast address should be ac:00:11:22:33:ff instead

c)

C. The network interface ethO is using an old kernel module.

d)

D. The network interface cable is not connected to a switch

11.

11. A Linux administratwoars asked to run a container with the httpd server inside. This container should be exposed at port 443 of a Linux host

machine while it internally listens on port 8443. Which of the following commands will accomplish this task?

a)

A. podman run -d -p 443:8443 httpd

b)

B. podman run -d -p 8443:443 httpd

c)

C. podman run -d -e 443:8443 httpd

d)

D. podman exec -p 8443:443 httpd

12.

12. A Linux administrator needs to analyze a failing application that is running inside a container. Which of the following commands allows the Linux

administrator to enter the running container and analyze the logs that are stored inside?

a)

A. docker run -ti app /bin/sh

b)

B. podman exec -ti app /bin/sh

c)

C. podman run -d app /bin/bash

d)

D. docker exec -d app /bin/bash

13.

13. A systems administrator needs to clone the partition /dev/sdc1 to /dev/sdd1. Which of the following commands will accomplish this task?

a)

A. tar -cvzf /dev/sdd1 /dev/sdc1

b)

B. rsync /dev/sdcl /dev/sdd1

c)

C. dd if=/dev/sdc1 of=/dev/sdd1

d)

D. scp /dev/sdc1 /dev/sdd1

14.

14. When trying to log in remotely to a server, a user receives the following message:

Password:

Last failed login: Wed Sep 15 17:23:45 CEST 2021 from 10.0.4.3 on ssh:notty

There were 3 failed login attempts since the last successful login.

Connection to localhost closed.

The server administrator is investigating the issue on the server and receives the following outputs:

Output 1:

user:x:1001:7374::/home/user:/bin/false

Output 2:

dzwx------ - 2 user 62 Sep 15 17:17 /home/user

Output 3:

Sep 12 14:14:05 server sshd[22958] ] Failed password for user from 10.0.2.8

Sep 15 17:24:03 server sshd[8460] : Accepted keyboard-interactive/pam for user from 10.0.6.5 port 50928 ssh2

Sep 15 17:24:03 server sshd[8460] : pam_unix(sshd:session): session opened for user testuser

Sep 15 17:24:03 server sshd[8460]: pam_unix(sshd:session) : session closed for user testuser

Which of the following is causing the issue?

a)

A. The wrong permissions are on the user’s home directory

b)

B. The account was locked out due to three failed logins.

c)

C. The user entered the wrong password.

d)

D. The user has the wrong shell assigned to the account

15.

15. A new Linux systems administratjourst generated a pair of SSH keys that should allow connection to the servers. Which of the following

commands can be used to copy a key file to remote servers? (Choose two.)

a)

A. wget

b)

B. ssh-keygen

C. ssh-keyscan

c)

D. ssh-copy-id

d)

E. ftpd

e)

F. scp

16.

16. A systems administrator needs to reconfigure a Linux server to allow persistent IPv4 packet forwarding. Which of the following commands is the

correct way to accomplish this task?

a)

A. echo 1 > /proc/sys/net/ipv4/ipv_forward

b)

B. sysctl -w net.ipv4.ip_forward=1

c)

C. firewall-cmd --enable ipv4_forwarding

d)

D. systemctl start ipv4_forwarding

17.

17. A Linux administrator would like to use systemd to schedule a job to run every two hours. The administrator creates timer and service definitions

and restarts the server to load these new configurations. After the restart, the administrator checks the log file and notices that the job is only

running daily. Which of the following is MOST likely causing the issue?

a)

A. The checkdiskspace.service is not running

b)

B. The checkdiskspace.service needs to be enabled

c)

C. The OnCalendar schedule is incorrect in the timer definition.

d)

D. The system-daemon services need to be reloaded.

18.

18. An administrator deployed a Linux server that is running a web application on port 6379/tcp.

SELinux is in enforcing mode based on organization policies.

The port is open on the firewall.

Users who are trying to connect to a local instance of the web application receive Error 13, Permission denied.

The administrator ran some commands that resulted in the following output:

# semanage port -1 | egrep '(^http_port_t | 6379) '

http port_t tcp 80, 81, 443, 488, 8008, 8009, 8443, 9000

# curl http://localhost/App.php

Cannot connect to App Server.

Which of the following commands should be used to resolve the issue?

a)

A. semanage port -d -t http_port_t -p tcp 6379

b)

B. semanage port -a -t http_port_t -p tcp 6379

c)

C. semanage port -a http_port_t -p top 6379

d)

D. semanage port -I -t http_port_tcp 6379

19.

19. A systems administrator created a web server for the company and is required to add a tag for the API so end users can connect. Which of the

following would the administrator do to complete this requirement?

a)

A. hostnamectl status -no-ask-password

b)

B. hostnamectl set-hostname "(perl -le "print" "A" x 86)"

c)

C. hostnamectl set-hostname Comptia-WebNode -H root@192.168.2.14

d)

D. hostnamectl set-hostname Comptia-WebNode -transient

20.

20. A systems administrator wants to back up the directory /data and all its contents to /backup/data on a remote server named remote. Which of the

following commands will achieve the desired effect?

a)

A. scp -p /data remote:/backup/data

b)

B. ssh -i /remote:/backup/ /data

c)

C. rsync -a /data remote:/backup/

d)

D. cp -r /data /remote/backup/

21.

21. An administrator needs to make some changes in the laC declaration templates. Which of the following commands would maintain version

control?

a)

A. git clone https://github.com/comptia/linux+-.git

git push origin

b)

B. git clone https://qithub.com/comptia/linux+-.git

git fetch New-Branch

c)

C. git clone https://github.com/comptia/linux+-.git

git status

d)

D. git clone https://github.com/comptia/linuxt+-.git

git checkout -b <new-branch>

22.

22. An administrator attempts to rename a file on a server but receives the following error.

mv: cannot move 'files/readme.txt' to 'files/readme.txt.orig': Operation not permitted.

The administrator then runs a few commands and obtains the following output:

$ ls -ld files/

drwxrwxrwt.1 users users 20 cap tt files/

15:15

$ ls -a files/

drwxrwxrwt.1 users users 20 ies -

drwxr-xr-x.1 users users 32 oars

Sep 12

-rw-rw-r--.1 users users 4 10:34 readme.txt

Which of the following commands should the administrator run NEXT to allow the file to be renamed by any user?

a)

A. chgrp reet files

b)

B. chacl -R 644 files

c)

C. chown users files

d)

D. chmod -t files

23.

23. Which of the following commands will display the operating system?

a)

A. uname -n

b)

B. uname -s

c)

C. uname -o

d)

D. uname -m

24.

24. A systems engineer is adding a new 1GB XFS filesystem that should be temporarily mounted under /ops/app. Which of the following is the correct

list of commands to achieve this goal?

a)

A. pvcreate -L1G /dev/app

mkfis.xfs /dev/app

mount /dev/app /opt/app

b)

B. parted /dev/sdb --script mkpart primary xfs 1GB

mkfs.xfs /dev/sdb

mount /dev/sdb /opt/app

c)

C. lvs --create 1G --name app

mkfis.xfs /dev/app

mount /dev/app /opt/app

d)

D. lvcreate -L 1G -n app app vq

mkfis.xfs /dev/app vg/app

mount /dev/app vg/app /opt/app

25.

25. A Linux administrator recently downloaded a software package that is currently in a compressed file. Which of the following commands will

extract the files?

a)

A. unzip -v

b)

B. bzip2 -z

c)

C. gzip

d)

D. funzip