linux banner

Linux Multiple Choice Questions (MCQs) and Answers

Master Linux with Practice MCQs. Explore our curated collection of Multiple Choice Questions. Ideal for placement and interview preparation, our questions range from basic to advanced, ensuring comprehensive coverage of Linux concepts. Begin your placement preparation journey now!

Q121

Q121 What does the mkfs command do in Linux?

A

Mounts a file system

B

Formats a disk

C

Checks disk usage

D

Creates a file system

Q122

Q122 Which command is used to create and manage disk partitions?

A

fdisk

B

mkfs

C

du

D

mount

Q123

Q123 How do you display detailed information about all block devices?

A

lsblk -f

B

lsblk -a

C

lsblk -l

D

lsblk -d

Q124

Q124 How do you mount a file system located at /dev/sda1 to the /mnt directory?

A

mount /dev/sda1 /mnt

B

mount /mnt /dev/sda1

C

mount -t /dev/sda1 /mnt

D

mount -a /dev/sda1 /mnt

Q125

Q125 A user reports that a partition is not available after a reboot.
Which file should be checked to ensure it mounts automatically?

A

/etc/fstab

B

/etc/mtab

C

/etc/passwd

D

/etc/rc.local

Q126

Q126 A file system is showing as read-only.
Which command can be used to remount it as read-write?

A

mount -o remount,ro /mount/point

B

mount -o remount,rw /mount/point

C

umount /mount/point

D

fsck /mount/point

Q127

Q127 Which command is used to change the permissions of a file in Linux?

A

chmod

B

chown

C

chgrp

D

passwd

Q128

Q128 What is the purpose of the sudo command?

A

To switch users

B

To execute a command with root privileges

C

To change file permissions

D

To monitor system logs

Q129

Q129 Which file stores user passwords in a hashed format for added security?

A

/etc/passwd

B

/etc/shadow

C

/etc/group

D

/etc/secure

Q130

Q130 What does setting the sticky bit on a directory do?

A

Allows users to read files

B

Allows users to execute files

C

Restricts file deletion to owners

D

Grants root privileges

Q131

Q131 How do you change the owner of a file named document.txt to a user named alice?

A

chown alice document.txt

B

chmod alice document.txt

C

chgrp alice document.txt

D

usermod alice document.txt

Q132

Q132 How do you grant execute permissions to the owner and group for a file named script.sh?

A

chmod u+x script.sh

B

chmod ug+x script.sh

C

chmod o+x script.sh

D

chmod g+x script.sh

Q133

Q133 A user is unable to modify a file despite having write permissions.
What could be the reason?

A

The file is read-only

B

The user is not the owner

C

The file has the immutable attribute set

D

The file is in use

Q134

Q134 A user is unable to delete a file in a directory with the sticky bit set.
What could be the reason?

A

The user does not have write permissions on the directory

B

The user is not the owner of the file

C

The file is read-only

D

The file is being used by another process

Q135

Q135 A file's permissions are set to rwxr-xr--.
What could be a potential security risk with these settings?

A

Unauthorized modification by others

B

Unauthorized execution by the group

C

Unauthorized reading by others

D

Unauthorized deletion by others

Q136

Q136 Which command is commonly used for creating backups in Linux?

A

cp

B

mv

C

tar

D

chmod

Q137

Q137 What is the purpose of the rsync command?

A

To synchronize files and directories between two locations

B

To compress files

C

To move files

D

To delete files

Q138

Q138 Which option with the tar command is used to create a new archive file?

A

-x

B

-c

C

-t

D

-v

Q139

Q139 What is the role of the dd command in backup and recovery?

A

To display disk usage

B

To copy and convert files at the byte level

C

To list directory contents

D

To manage disk partitions

Q140

Q140 How do you create a compressed archive of the /home/user directory using tar?

A

tar -cvf home.tar.gz /home/user

B

tar -xvf home.tar.gz /home/user

C

tar -czvf home.tar.gz /home/user

D

tar -tzvf home.tar.gz /home/user

Q141

Q141 How do you synchronize the /home/user directory with the /backup/user directory using rsync?

A

rsync -av /home/user /backup/user

B

rsync -z /home/user /backup/user

C

rsync -c /home/user /backup/user

D

rsync -t /home/user /backup/user

Q142

Q142 A user reports that a backup created with tar is not extracting correctly.
What could be the issue?

A

The archive file is corrupted

B

The file permissions are incorrect

C

The compression method is unsupported

D

The tar command is outdated

Q143

Q143 A user wants to automate daily backups of their home directory.
Which tool can help achieve this?

A

cron

B

rsync

C

tar

D

dd

Q144

Q144 What is the purpose of a cron job in Linux?

A

To monitor system performance

B

To schedule repetitive tasks

C

To manage user accounts

D

To compile code

Q145

Q145 What is the role of the crontab command?

A

To display system logs

B

To edit the cron table

C

To start a service

D

To check disk usage

Q146

Q146 Which special character is used in a crontab file to denote all valid values for a field?

A

*

B

?

C

-

D

,

Q147

Q147 How do you schedule a cron job to run a script at 2 AM every day?

A

0 2 * * * /path/to/script.sh

B

0 2 * * 1 /path/to/script.sh

C

2 0 * * * /path/to/script.sh

D

2 0 * * 1 /path/to/script.sh

Q148

Q148 How do you schedule a cron job to run every Monday at 5 PM?

A

0 17 * * 1 /path/to/script.sh

B

0 5 * * 1 /path/to/script.sh

C

0 17 * * * /path/to/script.sh

D

0 17 1 * * /path/to/script.sh

Q149

Q149 A user reports that their cron job is not executing.
Which command can be used to check the cron logs?

A

crontab -l

B

cronlog

C

grep cron /var/log/syslog

D

tail -f /var/log/cron

Q150

Q150 A cron job is supposed to run a script, but it fails. The script runs fine manually.
What could be the issue?

A

Incorrect file permissions

B

Missing shebang line

C

Environment variables not set

D

Script syntax error

ad verticalad vertical
ad