CompTIA Linux+ XK0-004 actual Exam with complete accurate questions and answers with rationales ( 2025-2026 latest release )

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/160

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

161 Terms

1
New cards

While using the BASH, which of the following commands will switch the default display in such a way that new applications will appear on the remote machine 192.168.1.50?

A. display 192.168.1.50

B. export DISPLAY=192.168.1.50

C. export TARGET=192.168.1.50

D. switch 192.168.1.50

B. export DISPLAY=192.168.1.50

2
New cards

Which of the following commands will display a user's current environment variables? (Select TWO)

A. env

B. info env

C. displayenv

D. man env

E. printenv

A. env & E. printenv

3
New cards

Which of the following is the default location of the Xorg configuration file?

A. /etc/X11/xorg.conf

B. /etc/X11/X.conf

C. /etc/X/xorg.conf

D. /etc/Xorg/X.conf

A. /etc/X11/xorg.conf

4
New cards

Which of the following commands will explicitly start a full X windows system session?

A. startx

B. xinit

C. X

D. startX

A. startx

5
New cards

After installing and enabling the latest accelerated video card driver, the system fails to start the X Window System on a reboot. Which of the following drivers is MOST likely to allow the system to start the GUI?

A. vesa

B. vega

C. xorg

D. krfb

A. vesa

6
New cards

Which of the following commands will cause gedit to use workstation1 for I/O?

A. DISPLAY=workstation1 gedit

B. CONNECT=workstation1 gedit

C. GRAPHICS=workstation1 gedit

D. CONSOLE=workstation1 gedit

A. DISPLAY=workstation1 gedit

7
New cards

Which of the following commands will show status information of the print queues?

A. lpstatus

B. showprint

C. lpqueue

D. lpstat

lpstat

8
New cards

Where is the default location of sendmail binary?

A. /usr/lib/sendmail

B. /etc/mail/sendmail

C. /var/spool/sendmail

D. /sbin/sendmail

A. /usr/lib/sendmail

9
New cards

Which of the following files holds information on the system's time zone?

A. /etc/timezone

B. /etc/localtime

C. /etc/time

D. /etc/localzone

B. /etc/localtime

10
New cards

Which of the following commands will show active network connections?

A. ipstat

B. ifstat

C. netstat

D. networkstat

C. netstat

11
New cards

A user has inserted a USB drive but it has not been automatically mounted. Which of the following commands will show the device name of the USB drive?

A. mount -t usb

B. fdisk -l

C. usb_scan

D. partprobe

B. fdisk -l

12
New cards

Which of the following will burn an ISO image to a writable SCSI CD-ROM drive located on SCSI address 0,1,0?

A. cdrecord -v -eject dev=0,1,0 data.iso

B. cdrecord -t scsi -eject -d=0,1,0 data.iso

C. cdrecord dev=0,1,0 -t=data.iso

D. cdrecord -V -dev 0,1,0 -eject data.iso

A. cdrecord -v -eject dev=0,1,0 data.iso

13
New cards

Which of the following /etc/fstab entries represents a Read-Write file system that can be mounted by any user?

A. /dev/hdc1 /data ext3 noauto,users 0 0

B. /dev/hdc1 /data auto defaults 0 0

C. /dev/hdc1 /data auto noauto,user 0 0

D. /dev/hdc1 /data ext3 defaults 0 0

A. /dev/hdc1/data ext3 noauto,users 0 0

14
New cards

A technician wants to upgrade an existing package to a new software package called software.rpm. Which of the following commands will accomplish this?

A. rpm -el ./software.rpm

B. rpm -Ve ./software.rpm

C. rpm -ieh ./software.rpm

D. rpm -Uvh ./software.rpm

D. rpm -Uvh ./software.rpm

15
New cards

Which of the following is the correct way to upgrade an existing software package using yum?

A. yum new package

B. yum get package

C. yum retrieve package

D. yum update package

D. yum update package

16
New cards

Which of the following key commands in vi allows a technician to append to the current line?

A. A

B. aa

C. p

D. a

A. A

17
New cards

Which of the following commands will replace the first instance of the string "linux" to "Linux" in the text file called history.txt and outputs the results to standard output?

A. sed r/linux/Linux/ history.txt

B. sed g/linux/Linux/ history.txt

C. sed s/linux/Linux/ history.txt

D. sed w/linux/Linux/ history.txt

C. sed s/linux/Linux/ history.txt

18
New cards

Which of the following symbols redirects standard output?

A. <

B. =

C. &

D. >

D. >

19
New cards

Which of the following commands will allow an administrator to change the priority of a running process?

A. bg

B. pstree

C. renice

D. fg

C. renice

20
New cards

Which of the following is the BEST way to direct the standard output of a program to both the screen and a file at the same time?

A. cat

B. tee

C. redirection (>)

D. echo

B. tee

21
New cards

If you want to change profiles for all users on the system.

/etc/profile and /etc/bashrc

22
New cards

When the user logins in, specific user.

.bash_profile

23
New cards

When the user starts a new shell, specific user.

.bashrc

24
New cards

How to unassign the variable COLOR?

unset COLOR

25
New cards

To see all the functions on your system?

set

26
New cards

Which file specifies the environment variables to be set.

/etc/security/pam_env.conf

27
New cards

If you want a new file to be created when a new user is created, where do you put it ?

/etc/skel

28
New cards

Which file that specifies the skeleton file, the shell and the default home when a new user is created?

/etc/default/useradd

29
New cards

Where is the printer queue stored ?

/var/spool/cups

30
New cards

How can you configure cups graphically?

http://localhost:631/

31
New cards

Two most important files for configuring cups?

/etc/cups/printers.conf & /etc/cups/cupsd.conf

32
New cards

how to add a printer?

lpadmin -p printername -E -v device -m name_of_ppd

33
New cards

show available devices for a printer?

lpinfo -v

34
New cards

make a default printer

lpadmin -d textprinter

35
New cards

To print something?

lpr -Ptextprinter file_to_print

36
New cards

Configuring a Text Only Printer

$ lpadmin -p textprinter -m textonly.ppd

37
New cards

what is happening in the queue ?

$ lpq -Ptextprinter

38
New cards

To remove the last printer job

lprm

39
New cards

To remove all the printer jobs

lprm -

40
New cards

log files for cups ?

/var/logs/cups/error_log & /var/logs/cups/access_log

41
New cards

How to disable and enable printers?

cupsdisable dummyprinter

cupsenable dummyprinter

42
New cards

command allows a user to administer his/her own group

membership list without the requirement of superuser privileges.

groupmems

43
New cards

How to find files that has SUI set.

$ find / -perm /4000

44
New cards

To scan the entire network using nmap

nmap 8.8.8.8/24

45
New cards

which file can you limit the number of processes for a user or group?

/etc/security/limits.conf

46
New cards

which show you when is the last time a user has logged into or never logged into the system.

lastlog

47
New cards

which old method to allow and deny hosts?

/etc/hosts.allow & /etc/hosts.deny

48
New cards

$ ls -lZ

this will show if the file is handled under selinux

49
New cards

How to search for SElinux related issues in the logs?

$ grep AVC | /var/log/audit/audit.log

50
New cards

Which command you can use to schedule a job at a later time, just once?

at 9:30 PM Tue

warning: commands will be executed using /bin/sh

at> echo "Well gosh golly, it's 9:30 PM on Tuesday."

at> ^D

51
New cards

Which file you can use to schedule cron jobs?

/etc/crontab

52
New cards

What is the format of the lines in /etc/crontab?

* user command

min hour day mon dow

53
New cards

files to allow users to user or not to use at or cron?

/etc/at.deny

/etc/at.allow

/etc/cron.deny

/etc/cron.allow

54
New cards

What can schedules job within a specific time frame?

/etc/anacrontab

55
New cards

what is the most trusted stratum number?

ntp uses stratum (highest trusted in stratum 1).

56
New cards

how to set date?

date -s 9:15

or

timedatectl set-time 9:15

57
New cards

how to synchronize hardware and system clock?

$ hwclock --hctosys

$ hwclock --systohc

58
New cards

which file that you can check for zone information?

/usr/share/zoneinfo

59
New cards

log files are typically stored where?

/var/log

60
New cards

what service will allow you to take care of when logs are deleted and stuff like that ?

/etc/logrotate.conf

61
New cards

where is the syslog confiigration file?

/etc/rsyslog.conf

62
New cards

Not every service logs to syslog.

local1-7 is used for that service.

Apache and Samba are among those servers.

Apache: Errorlog syslog:local1

63
New cards

new logging system for systemd systems.

journald and works hand in hand with rsyslog

journalctl

64
New cards

bring a network interface up or down

ifconfig enps035 down

65
New cards

assign an interface ip address or netmask

ifconfig enps035 192.168.1.100

ifconfig enps3045 netmask 255.255.0.0

66
New cards

most important file for network configuration

/etc/sysconfig/network-scripts

On Debian systems:

/etc/network/interfaces

67
New cards

show interfaces status

ip link show

or

ip addr show

68
New cards

static ip addressing or dhcp

BOOTPROTO = none or dhcp

69
New cards

Configuring Client Side DNS

/etc/resolv.conf

70
New cards

Received mail goes to

/var/spool/mail

71
New cards

Create E-mail Aliases

/etc/aliases

and exectue:

$ newaliases

so the changes take effect.

72
New cards

important file to configure email

/etc/postfix/master.cf

/etc/postfix/main.cf (queue directory where the messages will be stored).

73
New cards

what to do for email forwarding

set relayhost ip address in /etc/postfix/main.cf

74
New cards

configure ssh server

/etc/ssh/sshd_config

75
New cards

important options for ssh configuration

PermitRootLogin yes

PasswordAuthentication yes

X11Forwarding yes

UseDNS no

76
New cards

how to do SSH Tunneling

ssh -L 9000:ismvml61:443 aabdalma@ismnagios

AllowTcpForwarding yes

77
New cards

If you want to secure email messages and file transfers, you should use:

GnuPG

to generate keys:

gpg --gen-key

results will be in stored in: ~/.gnupg directory

gpg.pub

gpg --{sign|clearsign) originalfile

For an increased of security, we use -sign

--armor if you intend to the send the key over by email.

78
New cards

this checks for null. shell script

if [ -z $1 ]

79
New cards

variable that captures all the arguments as one entity?

$*

80
New cards

variable that captures all the arguments as one by one

$@

81
New cards

variable that captures all the number of arugments

$#

82
New cards

variable the capture the return value from a program

$?

83
New cards

send email to the root

[ -e $1 ] || mail -s "$1 does not exist" root < .

84
New cards

The ........ utility is an old utility for keyboard accessibility.

accessx

85
New cards

keyboard tool for GNOME

gok

86
New cards

keyboard tool for KDE

kmag

87
New cards

tool for speech in GNOME

Ocra

88
New cards

what tool covert desktop display to speech

Emacspeak

89
New cards

Tool to help the blind

brltty

90
New cards

to set french:

$ LANG=fr_FR.UTF-8

91
New cards

mysql commands to remember:

mysql_secure_installation

mysql -u root -p

$ create USER julia@'%' IDENTIFIED BY 'secret';

$ GRANT SELECT,INSERT,UPDATE, DELETE on videos.* TO julia@'%';

$ FLUSH PRIVILEGES;

92
New cards

how to initialize an X session

startx

93
New cards

which command to configure X?

$ Xorg -configure

94
New cards

Where do video drivers reside?

/usr/X11R6/lib/modules/drivers

or

/usr/lib/xorg/modules/drivers

95
New cards

command to set resolution

xrandr

96
New cards

too much information about X

xdpyinfo

97
New cards

information about current settings and positioning of an X window.

xwininfo

98
New cards

where the fonts at?

/usr/share/fonts

/usr/share/X11/fonts

99
New cards

fast and lightweight display manager.

lightdm

/usr/share/lightdm/lightdm.conf.d

100
New cards

index file for fonts in the current directory

mkfontscale

mkfontdir