Related Topics
Take Another Quiz

Linux Commands Multiple Choice

53 Questions
Linux Commands Multiple Choice

Linux commands multiple choice quiz for anyone who is in college studying Linux, systems administration or other computer courses and want to test themselves on multiple choice questions for exams.

Questions and Answers
  • 1. 
    During the linux boot process, what happens immediately after the phase called "load kernel"?
    • A. 

      Load initial ramdisk

    • B. 

      Run init

    • C. 

      Mount root filesystem

    • D. 

      Load modules

  • 2. 
    • A. 

      Cp -r Project Project.backup

    • B. 

      Cp -e Project Project.backup

    • C. 

      Cp -d Project Project.backup

    • D. 

      Cp -s Project Project.backup

  • 3. 
    How do you create a crontab entry?
    • A. 

      Crontab -c

    • B. 

      Crontab -e

    • C. 

      Crontab -make

    • D. 

      Crontab --create

  • 4. 
    How do you delete your crontab entry?
    • A. 

      Crontab -d

    • B. 

      Crontab -e

    • C. 

      Crontab -r

    • D. 

      Del -crontab

  • 5. 
    How do you direct the shell to execute a command in the background?
    • A. 

      Put an & symbol at the end of the command line.

    • B. 

      Key in fg followed by the command name.

    • C. 

      Press Ctrl+c after you have keyed in the command.

    • D. 

      Press Ctrl+d after you have keyed in the command.

  • 6. 
    How do you display the kernel release?
    • A. 

      Kernel -r

    • B. 

      Uname -r

    • C. 

      Cat /proc/etc/kernel/release

    • D. 

      Cat /etc/config/kernel/release

  • 7. 
    How do you display your current crontab entry?
    • A. 

      Crontab -display

    • B. 

      Crontab -d

    • C. 

      List --crontab

    • D. 

      Crontab -l

  • 8. 
    • A. 

      Echo $UID

    • B. 

      Id

    • C. 

      Cat /etc/passwd

    • D. 

      Cat /etc/groups

  • 9. 
    How do you run a job that will continue running even if you are logged out?
    • A. 

      Hup.out command

    • B. 

      Hup command

    • C. 

      Jobc command

    • D. 

      Nohup command

  • 10. 
    How do you see hidden files in your home directory?
    • A. 

      Ls -h

    • B. 

      Ls -la

    • C. 

      Ls -hn

    • D. 

      Ls -R

  • 11. 
    • A. 

      Hl -l

    • B. 

      Ln -s

    • C. 

      Ls -i

    • D. 

      Link -s

  • 12. 
    How do you create a crontab entry?
    • A. 

      Crontab --create

    • B. 

      Crontab -make

    • C. 

      Crontab -e

    • D. 

      Crontab -c

  • 13. 
    How would you avoid accidentally removing files?
    • A. 

      Rm -i

    • B. 

      Rm -chk

    • C. 

      Rm -a

    • D. 

      Rm -r

  • 14. 
    • A. 

      Free -s 5

    • B. 

      Top -m 5

    • C. 

      Du -m 5

    • D. 

      Mem -c 5

  • 15. 
    How would you display running httpd processes?
    • A. 

      Ps -C httpd

    • B. 

      Ps -d httpd

    • C. 

      Ps -r httpd

    • D. 

      Ps -D httpd

  • 16. 
    • A. 

      Cat /etc/shell

    • B. 

      Cat /etc/current/shell

    • C. 

      Ps | grep sshd

    • D. 

      Echo $$SHELL

  • 17. 
    How would you list oldest files first and newest ones last?
    • A. 

      Ls /o-d

    • B. 

      Ls -od

    • C. 

      Ls -rt

    • D. 

      Ls -dt

  • 18. 
    How would you lock the user account named csm099?
    • A. 

      Usermod -l csm099

    • B. 

      Usermod -L csm099

    • C. 

      Usermod --l csm099

    • D. 

      Usermod -lock csm099

  • 19. 
    How would you remove a directory that is not empty?
    • A. 

      Rm -r

    • B. 

      Rm -f

    • C. 

      Rmdir -f

    • D. 

      Rmdir -le

  • 20. 
    How would you search for the string clothes at the end of the line in a file called shopping?
    • A. 

      Grep 'clothes#' shopping

    • B. 

      Grep 'clothes!' shopping

    • C. 

      Grep 'clothes$' shopping

    • D. 

      Grep 'clothes^' shopping

  • 21. 
    How would you show process hierarchy in forest format?
    • A. 

      Ps -ef -tree

    • B. 

      Ps -ef --f

    • C. 

      Ps -ef --forest

    • D. 

      Ps -ef -t

  • 22. 
    How would you sort a file called shopping on column 3?
    • A. 

      Sort -n 3 shopping

    • B. 

      Sort -k 3 shopping

    • C. 

      Sort -c 3 shopping

    • D. 

      Sort -c3 shopping

  • 23. 
    How would you switch to virtual terminal 1?
    • A. 

      Ctrl+Alt+F1

    • B. 

      Alt+F1

    • C. 

      Ctrl+F1

    • D. 

      Shift+Ctrl+F1

  • 24. 
    • A. 

      Chmod u+s /tmp

    • B. 

      Chmod +st /tmp

    • C. 

      Chmod a+s /tmp

    • D. 

      Chmod o+t /temp

  • 25. 
    In which directory are the crontab files for users stored on suse linux?
    • A. 

      /var/spool/cron/tabs

    • B. 

      /usr/lib/cron

    • C. 

      /usr/bin/cron/crontabs

    • D. 

      /var/spool/cron/users/tabs

  • 26. 
    Some commands, including cat, interpret a minus sign (-) as a shortcut for...
    • A. 

      /dev/stdin

    • B. 

      /dev/stdout

    • C. 

      /dev/stderr

    • D. 

      /dev/hdal

  • 27. 
    Suppose you are in your home directory, /home/raf as in diagram above. What is the relative path for the file called "save" in the Email subdirectory?
    • A. 

      Raf/email/save

    • B. 

      /email/save

    • C. 

      /home/raf/email/save

    • D. 

      Email/save

  • 28. 
    The following can be used to set the immutable attribute on a file?
    • A. 

      Chattr +i

    • B. 

      Attrib +i

    • C. 

      Imod +a

    • D. 

      Chmod +i

  • 29. 
    To display information about the processor itself - display the contents of which file?
    • A. 

      /bin/cpu

    • B. 

      /dev/cpuinfo

    • C. 

      /etc/cpu

    • D. 

      /proc/cpuinfo

  • 30. 
    To run date first, and then ls -l, which of the following is correct?
    • A. 

      Date $ ls -l

    • B. 

      Date ; ls -l

    • C. 

      Date - ls -l

    • D. 

      Date > ls -l

  • 31. 
    What does the 2>&1 at the end of the following command mean?find / -name fred.txt > names 2>&1
    • A. 

      Send standard error to a file called &1

    • B. 

      Append standard error to a file called &1

    • C. 

      Send standard error to the same place as standard output

    • D. 

      Send the output of the find command to /dev/null

  • 32. 
    • A. 

      754

    • B. 

      724

    • C. 

      624

    • D. 

      742

  • 33. 
    What is the following syntax used for? command >file1 2>file2
    • A. 

      Send command's standard output to file1,and its standard error to file2

    • B. 

      Send command's standard error to file1, and its standard output to file2

    • C. 

      Send command's standard error to file1, and its standard input to file2

    • D. 

      Send command's standard input to file1,and its standard output to file2

  • 34. 
    What is the following syntax used forcommand 2> /dev/null
    • A. 

      Send the output of command to a file called /dev/null

    • B. 

      Discard standard error entirely.

    • C. 

      Append the output of command to a file called /dev/null

    • D. 

      Send error messages from command to a file called /dev/null

  • 35. 
    What is the full path for grub's configuration file
    • A. 

      /boot/grub/lsof.conf

    • B. 

      /boot/grub/menu.lst

    • C. 

      /etc/grub/grub.conf

    • D. 

      /etc/grub/grub.txt

  • 36. 
    What is the purpose of the following operator? >>
    • A. 

      It is used to send the output of one command so it becomes the input of a second command.

    • B. 

      It is used to send both input and output to the same file.

    • C. 

      It is used to overwrite the contents of a file.

    • D. 

      It appends data to a file without overwriting it.

  • 37. 
    What is the shortest command to take you to your home directory?
    • A. 

      Cd ~

    • B. 

      Cd $HOME

    • C. 

      Cd

    • D. 

      .

  • 38. 
    • A. 

      Ctrl+E

    • B. 

      Ctrl+C

    • C. 

      Ctrl+D

    • D. 

      Ctrl+Z

  • 39. 
    What symbol is used to show that ACLs have been set on a file?
    • A. 

      <

    • B. 

      +

    • C. 

      ~

    • D. 

      >

  • 40. 
    Which command can be used to edit and then run command no. 40?
    • A. 

      Fc 40

    • B. 

      Hs 40

    • C. 

      Rc 40

    • D. 

      Er 40

  • 41. 
    Which command displays the settings for all services at all runlevels?
    • A. 

      Runlevel --settings

    • B. 

      Status --l

    • C. 

      Services --runlevels

    • D. 

      Chkconfig --list

  • 42. 
    Which command is used to unmount a filesystem?
    • A. 

      Dmount

    • B. 

      Dismount

    • C. 

      Unmount

    • D. 

      Umount

  • 43. 
    Which file determines what will be run at each runlevel?
    • A. 

      /etc/init/runlevels

    • B. 

      /etc/levels/fstab

    • C. 

      /etc/fstab

    • D. 

      /etc/inittab

  • 44. 
    Which file is the list of commands you recently entered stored in?
    • A. 

      .bashrc_history

    • B. 

      .history

    • C. 

      .bash_history

    • D. 

      .bash_list_history

  • 45. 
    Which file is the list of commands you recently entered stored in?
    • A. 

      .bash_list

    • B. 

      .bash_history

    • C. 

      .history

    • D. 

      .bashrc

  • 46. 
    Which of the following can be used to set the immutable attribute on a file?
    • A. 

      Chmod +i

    • B. 

      Immut +a

    • C. 

      Attrib +i

    • D. 

      Chattr +i

  • 47. 
    Which of the following cannot be used as a mount option in /etc/fstab?
    • A. 

      Rw

    • B. 

      Noexec

    • C. 

      Ndev

    • D. 

      Defaults

  • 48. 
    Which of the following could you use to check if the cron daemon is running?
    • A. 

      Service --status-all

    • B. 

      Ps -list --daemons

    • C. 

      Daemons --list --all

    • D. 

      Cron --status

  • 49. 
    Which of the following runs the last command you entered?
    • A. 

      ~!

    • B. 

      !~

    • C. 

      !!

    • D. 

      ..

  • 50. 
    Which runlevel allows full multiuser mode but with no graphical login manager?
    • A. 

      Runlevel 2

    • B. 

      Runlevel 3

    • C. 

      Runlevel 0

    • D. 

      Runlevel 1

  • 51. 
    Which runlevel allows full multiuser mode but with no graphical login manager?
    • A. 

      Runlevel 1

    • B. 

      Runlevel 2

    • C. 

      Runlevel 3

    • D. 

      Runlevel 0

  • 52. 
    Which signal number corresponds with the SIGSTOP signal?
    • A. 

      1

    • B. 

      19

    • C. 

      9

    • D. 

      18

  • 53. 
    You want to display a message when you open a new terminal window. Which file do you edit?
    • A. 

      .bashtr

    • B. 

      .linux_term

    • C. 

      .term_win

    • D. 

      .bashrc

Related Topics