Linux MCQs (01-100)

  1. Linux is an example of a:
    A) Operating System
    B) Kernel
    C) Application
    D) Programming Language
    Answer: B

  2. The Linux kernel is written mostly in:
    A) C
    B) C++
    C) Java
    D) Python
    Answer: A

  3. The first version of Linux was developed by:
    A) Linus Torvalds
    B) Richard Stallman
    C) Dennis Ritchie
    D) Ken Thompson
    Answer: A

  4. Linux is based on which operating system?
    A) UNIX
    B) DOS
    C) Windows
    D) MacOS
    Answer: A

  5. The command to display the current working directory is:
    A) pwd
    B) cd
    C) ls
    D) dir
    Answer: A

  6. The command used to list files in a directory is:
    A) ls
    B) list
    C) show
    D) view
    Answer: A

  7. Which command is used to change directories?
    A) cd
    B) chdir
    C) mv
    D) dir
    Answer: A

  8. The root directory is represented by:
    A) /
    B) \
    C) ~
    D) .
    Answer: A

  9. The home directory of the root user is:
    A) /root
    B) /home
    C) /usr
    D) /etc
    Answer: A

  10. To display hidden files, use:
    A) ls -a
    B) ls -h
    C) show hidden
    D) ls -s
    Answer: A

  11. The command to create a new empty file:
    A) touch filename
    B) new file
    C) create filename
    D) echo > filename
    Answer: A

  12. To remove a file:
    A) rm filename
    B) del filename
    C) erase filename
    D) clear filename
    Answer: A

  13. To remove a directory and its contents:
    A) rm -r dirname
    B) rmdir dirname
    C) delete dirname
    D) rm dirname
    Answer: A

  14. Command to copy files:
    A) cp source destination
    B) copy source destination
    C) mv source destination
    D) clone source destination
    Answer: A

  15. Command to move or rename a file:
    A) mv
    B) move
    C) rn
    D) transfer
    Answer: A

  16. To display file contents:
    A) cat filename
    B) open filename
    C) show filename
    D) display filename
    Answer: A

  17. To show first 10 lines of a file:
    A) head filename
    B) top filename
    C) start filename
    D) less filename
    Answer: A

  18. To show last 10 lines of a file:
    A) tail filename
    B) end filename
    C) show filename
    D) last filename
    Answer: A

  19. To count lines, words, and characters in a file:
    A) wc filename
    B) count filename
    C) cat -n filename
    D) info filename
    Answer: A

  20. To search for a string inside a file:
    A) grep “text” filename
    B) find “text” filename
    C) search “text” filename
    D) locate “text” filename
    Answer: A


File Permissions

  1. Command to change file permissions:
    A) chmod
    B) chown
    C) chperm
    D) setperm
    Answer: A

  2. To change file ownership:
    A) chown
    B) chmod
    C) ownfile
    D) permset
    Answer: A

  3. To change the group of a file:
    A) chgrp
    B) chown -g
    C) groupmod
    D) setgrp
    Answer: A

  4. In Linux, permissions are represented as:
    A) rwx
    B) xyz
    C) abc
    D) lpr
    Answer: A

  5. Numeric value of read, write, execute respectively:
    A) 4, 2, 1
    B) 1, 2, 3
    C) 7, 6, 5
    D) 0, 1, 2
    Answer: A

  6. The default permission assigned to new files is determined by:
    A) umask
    B) chmod
    C) chown
    D) setperm
    Answer: A

  7. To see file permissions, use:
    A) ls -l
    B) ls -p
    C) showperm
    D) listperm
    Answer: A

  8. To give execute permission to everyone:
    A) chmod a+x filename
    B) chmod 777 filename
    C) chperm x filename
    D) exec filename
    Answer: A

  9. The command chmod 755 file gives:
    A) rwxr-xr-x
    B) rwxrw-r–
    C) rw-r–r–
    D) rwxrw-rw-
    Answer: A

  10. To remove write permission from group:
    A) chmod g-w filename
    B) chmod g+x filename
    C) chmod o-w filename
    D) chmod u-w filename
    Answer: A

  11. To view all running processes:
    A) ps -ef
    B) lsproc
    C) top
    D) runlist
    Answer: A

  12. Command to display real-time processes:
    A) top
    B) ps
    C) showproc
    D) jobs
    Answer: A

  13. To terminate a process:
    A) kill PID
    B) end PID
    C) stop PID
    D) exit PID
    Answer: A

  14. To terminate all processes by name:
    A) killall name
    B) stop name
    C) endall name
    D) close name
    Answer: A

  15. To suspend a process:
    A) Ctrl + Z
    B) Ctrl + C
    C) Ctrl + D
    D) Ctrl + P
    Answer: A

  16. To resume a suspended job in background:
    A) bg
    B) fg
    C) cont
    D) jobs
    Answer: A

  17. To bring a background job to foreground:
    A) fg
    B) bring
    C) front
    D) resume
    Answer: A

  18. To view job list:
    A) jobs
    B) ps
    C) show
    D) list
    Answer: A

  19. To display system uptime and load:
    A) uptime
    B) sysinfo
    C) loadstat
    D) top
    Answer: A

  20. To check memory usage:
    A) free -m
    B) memstat
    C) ps -m
    D) lsram
    Answer: A


  1. To display IP address:
    A) ifconfig
    B) ipconfig
    C) ipstat
    D) netconfig
    Answer: A

  2. To check network connectivity:
    A) ping
    B) netstat
    C) testnet
    D) checkip
    Answer: A

  3. To display routing table:
    A) netstat -r
    B) route show
    C) ifroute
    D) ping -r
    Answer: A

  4. To show active network connections:
    A) netstat -a
    B) connect -s
    C) showip
    D) traceroute
    Answer: A

  5. Command to trace the route of packets:
    A) traceroute
    B) tracepath
    C) routepath
    D) ping -t
    Answer: A

  6. To test DNS resolution:
    A) nslookup
    B) dnsquery
    C) pingdns
    D) host -d
    Answer: A

  7. To display hostname:
    A) hostname
    B) showhost
    C) namehost
    D) gethost
    Answer: A

  8. Command to display kernel version:
    A) uname -r
    B) version
    C) sysinfo
    D) kernel -v
    Answer: A

  9. To check system architecture:
    A) uname -m
    B) archinfo
    C) sysarch
    D) info -a
    Answer: A

  10. Command to shut down the system immediately:
    A) shutdown -h now
    B) halt
    C) poweroff
    D) All of the above
    Answer: D

  1. Command to add a new user:
    A) useradd
    B) adduser
    C) createuser
    D) mkuser
    Answer: A

  2. Command to set or change a user password:
    A) passwd username
    B) chpass username
    C) usermod -p username
    D) password username
    Answer: A

  3. Command to delete a user:
    A) userdel username
    B) deluser username
    C) removeuser username
    D) rmuser username
    Answer: A

  4. To create a new group:
    A) groupadd
    B) newgroup
    C) mkgroup
    D) addgrp
    Answer: A

  5. To change a user’s primary group:
    A) usermod -g groupname username
    B) chgrp -p groupname username
    C) groupmod username
    D) newgrp username
    Answer: A

  6. To add an existing user to a group:
    A) usermod -aG groupname username
    B) groupadd -u username groupname
    C) chgroup username groupname
    D) adduser -g groupname username
    Answer: A

  7. To see all logged-in users:
    A) who
    B) users
    C) w
    D) All of the above
    Answer: D

  8. To see login history:
    A) last
    B) history
    C) who -a
    D) logshow
    Answer: A

  9. To switch to another user:
    A) su username
    B) switch username
    C) login username
    D) sudo username
    Answer: A

  10. To execute a command as root:
    A) sudo command
    B) runas root command
    C) exec root command
    D) superuser command
    Answer: A

  1. The default shell in most Linux distributions is:
    A) bash
    B) sh
    C) csh
    D) zsh
    Answer: A

  2. To check the current shell:
    A) echo $SHELL
    B) show shell
    C) get shell
    D) ps shell
    Answer: A

  3. To make a script executable:
    A) chmod +x script.sh
    B) exec script.sh
    C) run script.sh
    D) make script.sh
    Answer: A

  4. To run a shell script:
    A) ./script.sh
    B) run script.sh
    C) bash -x script.sh
    D) All of the above
    Answer: D

  5. A shell variable is created by:
    A) var=value
    B) set var=value
    C) define var value
    D) var := value
    Answer: A

  6. To display a variable:
    A) echo $var
    B) print $var
    C) show var
    D) cat var
    Answer: A

  7. To make a variable available to subshells:
    A) export var
    B) share var
    C) global var
    D) declare var
    Answer: A

  8. To take user input in shell:
    A) read variable
    B) input variable
    C) scanf variable
    D) echo variable
    Answer: A

  9. In shell scripting, $0 represents:
    A) Script name
    B) First argument
    C) Last argument
    D) Return value
    Answer: A

  10. To check the exit status of the last command:
    A) echo $?
    B) status
    C) lastcmd
    D) ret
    Answer: A

  1. Debian-based systems use which package manager?
    A) apt
    B) yum
    C) dnf
    D) zypper
    Answer: A

  2. Red Hat-based systems use:
    A) yum
    B) apt
    C) dpkg
    D) snap
    Answer: A

  3. Command to install a package in Ubuntu:
    A) sudo apt install pkgname
    B) sudo yum install pkgname
    C) install pkgname
    D) dpkg pkgname
    Answer: A

  4. To remove a package in Ubuntu:
    A) sudo apt remove pkgname
    B) yum remove pkgname
    C) dpkg -d pkgname
    D) apt uninstall pkgname
    Answer: A

  5. Command to update all packages:
    A) sudo apt upgrade
    B) sudo apt update
    C) sudo yum update
    D) apt-get refresh
    Answer: A

  6. To list all installed packages:
    A) dpkg -l
    B) apt list
    C) yum list installed
    D) All of the above
    Answer: D

  7. Command to install a .rpm package:
    A) rpm -ivh file.rpm
    B) dpkg -i file.rpm
    C) apt install file.rpm
    D) pkgadd file.rpm
    Answer: A

  8. To remove a .rpm package:
    A) rpm -e pkgname
    B) yum remove pkgname
    C) dpkg -r pkgname
    D) apt delete pkgname
    Answer: A

  9. To check dependencies of an rpm package:
    A) rpm -qpR file.rpm
    B) rpm -d file.rpm
    C) yum info file.rpm
    D) depcheck file.rpm
    Answer: A

  10. To check a package version:
    A) rpm -q pkgname
    B) apt info pkgname
    C) dpkg -s pkgname
    D) All of the above
    Answer: D

  1. Command to check disk space usage:
    A) df -h
    B) du -h
    C) lsblk
    D) fdisk -l
    Answer: A

  2. Command to check directory size:
    A) du -sh directory
    B) df -d directory
    C) ls -s directory
    D) size directory
    Answer: A

  3. To list partitions:
    A) fdisk -l
    B) lsblk
    C) blkid
    D) All of the above
    Answer: D

  4. To mount a device:
    A) mount /dev/sdX /mnt
    B) attach /dev/sdX
    C) plug /dev/sdX
    D) start /dev/sdX
    Answer: A

  5. To unmount a device:
    A) umount /mnt
    B) unmount /mnt
    C) remove /mnt
    D) eject /mnt
    Answer: A

  6. To format a partition as ext4:
    A) mkfs.ext4 /dev/sdX
    B) format ext4 /dev/sdX
    C) mke2fs /dev/sdX
    D) partformat /dev/sdX
    Answer: A

  7. To display file system type:
    A) df -T
    B) fsinfo
    C) listfs
    D) showfs
    Answer: A

  8. To repair a Linux file system:
    A) fsck /dev/sdX
    B) repair /dev/sdX
    C) fixfs /dev/sdX
    D) chkfs /dev/sdX
    Answer: A

  9. The swap space is used for:
    A) Virtual memory
    B) Disk caching
    C) Boot files
    D) Temporary logs
    Answer: A

  10. To check swap usage:
    A) swapon -s
    B) swapinfo
    C) showmem
    D) swapstat
    Answer: A

  1. System log files are stored in:
    A) /var/log
    B) /usr/logs
    C) /log
    D) /etc/logs
    Answer: A

  2. To view system logs:
    A) tail -f /var/log/syslog
    B) view /var/log/messages
    C) cat /var/log/kern.log
    D) All of the above
    Answer: D

  3. Command to check CPU usage:
    A) top
    B) htop
    C) mpstat
    D) All of the above
    Answer: D

  4. To display disk I/O statistics:
    A) iostat
    B) vmstat
    C) top -d
    D) netstat -i
    Answer: A

  5. To check current date and time:
    A) date
    B) time
    C) showtime
    D) datetime
    Answer: A

  6. To display calendar:
    A) cal
    B) calendar
    C) showcal
    D) date -c
    Answer: A

  7. Command to schedule tasks:
    A) cron
    B) at
    C) systemd timers
    D) All of the above
    Answer: D

  8. Cron jobs are stored in:
    A) /etc/crontab
    B) /var/cron
    C) /usr/schedule
    D) /root/cron
    Answer: A

  9. To list user’s cron jobs:
    A) crontab -l
    B) cron -show
    C) showcron
    D) listcron
    Answer: A

  10. To edit cron jobs:
    A) crontab -e
    B) cron -edit
    C) vi /etc/cron
    D) editcron
    Answer: A

Leave a Comment

Your email address will not be published. Required fields are marked *

You cannot copy content of this page

Scroll to Top