Linux Commands Multiple Choice 2

69 Questions  I  By Mariiikar
Please take the quiz to rate it.

Linux Quizzes & Trivia
This is part two of Linux commands multiple choice questions. These quizes should get you up to scratch for any Linux certificate, college module, etc. Just repeat the quiz over and over until you get 90% + and you will surely be ahead of the rest at exam time.

  
Changes are done, please start the quiz.


Questions and Answers

Removing question excerpt is a premium feature

Upgrade and get a lot more done!
  • 1. 
    What two commands display the status of processes on a Linux system?
    • A. 

      Ls and df

    • B. 

      Ps and top

    • C. 

      Ps and df

    • D. 

      Df and top

    • E. 

      Du and df


  • 2. 
    What does the device file /dev/hdb6 represent?
    • A. 

      An extended partition on a SCSI disk drive

    • B. 

      A logical partition on a SCSI disk drive

    • C. 

      An extended partition on an IDE disk drive

    • D. 

      A primary partition on an IDE disk drive

    • E. 

      A logical partition on an IDE disk drive


  • 3. 
    Which command will display the last lines of the text file file1?
    • A. 

      Head -b file1

    • B. 

      Head --bottom file1

    • C. 

      Head -v file1

    • D. 

      Tail file1

    • E. 

      Tail -n 1 file1


  • 4. 
    In the Bash shell, entering !! has the same effect as which one of the following?
    • A. 

      Ctrl-P and Enter

    • B. 

      Ctrl-N and Enter

    • C. 

      Ctrl-U and Enter

    • D. 

      !-2

    • E. 

      !2


  • 5. 
    Which of the following commands can be used to check an ext2 filesystem? Select three that apply.
    • A. 

      Fsck -ext2 /dev/hda5

    • B. 

      Fsck /dev/hda5

    • C. 

      E2fsck /dev/hda5

    • D. 

      Fsck.ext2 /dev/hda5

    • E. 

      Fsck.linux /dev/hda5


  • 6. 
    In response to the df command, the system reports a Use% of 98% for the filesystem mounted on /home. Which one of the following best describes the significance of this information?
    • A. 

      Files on /home are consuming 98% of the physical disk.

    • B. 

      File read/write activity on /home is consuming 98% of system I/O capacity.

    • C. 

      Files on /home are consuming 98% of the /home filesystem.

    • D. 

      Inodes on /home are nearly exhausted.

    • E. 

      Inodes on /home are 98% free.


  • 7. 
    Of the following directories, which one is the most important to back up on a routine basis?
    • A. 

      /var

    • B. 

      /tmp

    • C. 

      /usr

    • D. 

      /root

    • E. 

      /etc


  • 8. 
    Carolyn has a text file named guest_list containing 12 lines. She executes the following command. What is the result?# split -4 guest_list gl
    • A. 

      The first four columns in the text are written to new files glaa, glab, glac, and glad.

    • B. 

      The first four columns in the text are written to new files aagl, abgl, acgl, and adgl.

    • C. 

      The lines of guest_list are evenly divided among new files glaa, glab, glac, and glad.

    • D. 

      The lines of guest_list are evenly divided among new files glaa, glab, and glac.

    • E. 

      The lines of guest_list are evenly divided among new files aagl, abgl, and acgl.


  • 9. 
    Which one of the following commands would be best suited to mount a CD-ROM containing a Linux distribution, without depending on any configuration files?
    • A. 

      Mount /dev/cdrom /dev/hdc

    • B. 

      Mount -f linux /dev/hdc /mnt/cdrom

    • C. 

      Mount -t iso9660 /dev/cdrom /mnt/cdrom

    • D. 

      Mount -t linux /dev/cdrom /mnt/cdrom

    • E. 

      Mount -t iso9660 /mnt/cdrom /dev/cdrom


  • 10. 
    An ext2 filesystem is configured with user quotas enabled. The soft limit is set at 100 MB per user, the hard limit is set at 110 MB per user, and the grace period is seven days. User bsmith already owns 90 MB of the data stored on the filesystem. What happens when bsmith writes a new file of size 30 MB? Select one.
    • A. 

      The write will fail, but the superuser can recover the entire file within seven days.

    • B. 

      The write will fail, and the file will be truncated permanently.

    • C. 

      The write will succeed, but the file will be truncated permanently.

    • D. 

      The write will succeed, but the file will be available for only seven days.

    • E. 

      The write will succeed, but the file will be truncated in seven days.


  • 11. 
    Which of the following commands displays the comments from a bash script? Select all that apply.
    • A. 

      Find "^#" /etc/rc.d/rc.local

    • B. 

      Sed '/^#/ !d' /etc/rc.d/init.d/httpd

    • C. 

      Grep ^# /etc/rc.d/init.d/httpd

    • D. 

      Grep ^# /etc/passwd

    • E. 

      Locate "^#" /etc/skel/.bashrc


  • 12. 
    .Which one of the following answers creates an environment variable VAR1, present in the environment of a bash child process?
    • A. 

      VAR1="fail" ; export VAR1

    • B. 

      VAR1="fail" \ export VAR1

    • C. 

      VAR1="fail"

    • D. 

      Set VAR1="fail" ; enable VAR1

    • E. 

      Export VAR1 \ VAR1="fail"


  • 13. 
    State the syntax to direct the standard output of cmd1 directly into the standard input of cmd2.
    • A. 

      Cmd1 | cmd2

    • B. 

      ...


  • 14. 
    Which of the following directories must be part of the root filesystem? Select two of the following that apply.
    • A. 

      /etc

    • B. 

      /home

    • C. 

      /lib

    • D. 

      /usr

    • E. 

      /root


  • 15. 
    Alex is currently working in a directory containing only one file, Afile1. What is displayed after the following commands are entered in bash?# MYVAR=ls # echo $MYVAR "$MYVAR" '$MYVAR' '$MYVAR'
    • A. 

      Afile1 Afile1 Afile1 Afile1

    • B. 

      Ls Afile1 Afile1 Afile1

    • C. 

      Ls ls Afile1 Afile1

    • D. 

      Ls ls $MYVAR Afile1

    • E. 

      Ls ls ls $MYVAR


  • 16. 
    What does the & character do when placed at the end of a command?
    • A. 

      It allows another command to be entered on the same line.

    • B. 

      It causes the process to be stopped.

    • C. 

      It restarts a stopped process.

    • D. 

      It causes the process to be placed into the foreground.

    • E. 

      It causes the process to be placed into the background.


  • 17. 
    Which one of the following commands could be used to change all uppercase characters to lowercase in the middle of a pipe?
    • A. 

      Grep

    • B. 

      Egrep

    • C. 

      Wc

    • D. 

      Tr

    • E. 

      Pr


  • 18. 
    What is the PID of init? Select one.
    • A. 

      0

    • B. 

      1

    • C. 

      2

    • D. 

      Undefined

    • E. 

      Unknown


  • 19. 
    Which one of the following outcomes results from the following command?# chmod g+s /home/software
    • A. 

      The SUID bit will be set for /home/software.

    • B. 

      The SGID bit will be set for /home/software, preventing access by those not a member of the software group.

    • C. 

      The SGID bit will be set for /home/software, in order to keep group membership of the directory consistent for all files created.

    • D. 

      The sticky bit will be set for /home/software.

    • E. 

      The sticky bit will be applied to all files in /home/software.


  • 20. 
    Which one of the following commands is equivalent to the following command for user jdoe whose home directory is /home/jdoe?# chmod 754 ~/file1
    • A. 

      Chmod u=rwx,g=rx,o=r /home/jdoe/file1

    • B. 

      Chmod ugo=rwx ~/file1

    • C. 

      Chmod u=7,g=5,o=4 ~/file1

    • D. 

      Chmod 754 \home\jdoe\file1

    • E. 

      Chmod 754 /usr/jdoe/file1


  • 21. 
    What command and single required option creates a symbolic link in a Linux filesystem?
    • A. 

      Ln -s

    • B. 

      ...


  • 22. 
    What command can display the contents of a binary file in a readable hexadecimal form? Select one.
    • A. 

      Xd

    • B. 

      Hd

    • C. 

      Od

    • D. 

      Xd

    • E. 

      Dump


  • 23. 
    Which one of the following commands copies files with the .txt extension from /dir1 into /dir2, while preserving file attributes such as dates?
    • A. 

      Mv --copy /dir1/*.txt /dir2

    • B. 

      Mv /dir1/*.txt /dir2

    • C. 

      Cp -k /dir1/*.txt /dir2

    • D. 

      Cp -p /dir1/*.txt /dir2

    • E. 

      Cp -p /dir2 < /dir1/*.txt


  • 24. 
    Which one of the following file globs matches "Linux" and "linux," but not "linux.com" and not "TurboLinux"?
    • A. 

      [L/linux]

    • B. 

      ?inux

    • C. 

      \L\linux

    • D. 

      [Ll]inux

    • E. 

      [Ll]inux?


  • 25. 
    A process with PID 4077 is misbehaving on your system. As superuser, you enter the following command:# kill 4077However, nothing changes as a result. What can you do to terminate the process? Select one.
    • A. 

      Kill -9 4077

    • B. 

      Kill -1 4077

    • C. 

      Kill +9 4077

    • D. 

      Kill 4078

    • E. 

      Kill --die 4077


  • 26. 
    Which one of the following key sequences is used to put a noninteractive text-mode program that is attached to the terminal into the background to allow it to continue processing?
    • A. 

      Ctrl-C

    • B. 

      Ctrl-B

    • C. 

      Ctrl-B and then enter the bg command

    • D. 

      Ctrl-Z

    • E. 

      Ctrl-Z and then enter the bg command


  • 27. 
    What basic command is used to create hard disk partitions?
    • A. 

      Fdisk.

    • B. 

      ...


  • 28. 
    With a umask of 027, how is the initial mode set for a newly created file?
    • A. 

      0750

    • B. 

      0640

    • C. 

      0027

    • D. 

      1027

    • E. 

      1640


  • 29. 
    Which one of the following commands verbosely extracts files from a tar archive on a magnetic tape device?
    • A. 

      Tar cvf /dev/st0

    • B. 

      Tar cvf /dev/ttyS0

    • C. 

      Tar xvf /dev/st0

    • D. 

      Tar xvf /dev/ttyS0

    • E. 

      Tar rvf /dev/st0


  • 30. 
    Alex wants to protect himself from inadvertently overwriting files when copying them with cp. How should he go about this?
    • A. 

      Put alias cp='cp -i' in ~/.bashrc.

    • B. 

      Put alias cp='cp -i' in ~/.bash_profile.

    • C. 

      Put alias cp='cp -p' in ~/.bashrc.

    • D. 

      Put alias cp='cp -p' in ~/.bash_profile.

    • E. 

      Put alias cp='cp -I' in ~/.bashrc.


  • 31. 
    Which one of the following utilities outputs a text file with line numbers along the left margin?
    • A. 

      Tar

    • B. 

      Wc

    • C. 

      Tr

    • D. 

      Nl

    • E. 

      Ln


  • 32. 
    Which one of the following is an accurate statement regarding this regular expression?[^1-8A-Za-z]
    • A. 

      It matches all letters and numbers.

    • B. 

      It matches all letters and numbers except 9.

    • C. 

      It matches all letters and numbers except 9 and 0, but only at the beginning of a line.

    • D. 

      It matches 9, 0, and other nonletter and nonnumber characters.

    • E. 

      It matches characters other than letters or numbers.


  • 33. 
    Monica consults the /etc/passwd file expecting to find encrypted passwords for all of the users on her system. She sees the following:jdoe:x:500:500::/home/jdoe:/bin/bash bsmith:x:501:501::/home/bsmith:/bin/tcsh Which of the following is true? Select one.
    • A. 

      Accounts jdoe and bsmith have no passwords.

    • B. 

      Accounts jdoe and bsmith are disabled.

    • C. 

      The passwords are in /etc/passwd-

    • D. 

      The passwords are in /etc/shadow

    • E. 

      The passwords are in /etc/shadow-


  • 34. 
    What command (include applicable options) is used to initiate a change to runlevel 5?
    • A. 

      Init 5. telinit 5 would also work, as they are both links to the same file.

    • B. 

      ...


  • 35. 
    What does the "sticky bit" do? Select one.
    • A. 

      It prevents files from being deleted by anyone.

    • B. 

      It marks files for deletion.

    • C. 

      It prevents files from being deleted by nonowners except root.

    • D. 

      It prevents files from being deleted by nonowners including root.

    • E. 

      It marks files for archive.


  • 36. 
    Dave has a Linux system with an interrupt conflict caused by his 3c509 network card. Dave's kernel is fully modular. How could Dave instruct the system to use IRQ 11 for his network adapter?
    • A. 

      Enter linux eth0=irq11 at the LILO boot loader prompt.

    • B. 

      Enter linux 3c509=irq11 at the LILO boot loader prompt.

    • C. 

      Add options 3c509 irq=11 to /etc/conf.modules.

    • D. 

      Add options irq=11 3c509 to /etc/conf.modules.

    • E. 

      Add ifup -irq 11 eth0 to /etc/rc.d/rc.sysinit.


  • 37. 
    What is contained in directory /sbin? Select the single best answer.
    • A. 

      Commands needed in the event of a system emergency of interest to all system users.

    • B. 

      Commands of interest to all system users.

    • C. 

      Commands needed in the event of a system emergency of interest mainly to the administrator.

    • D. 

      Commands of interest mainly to the administrator.

    • E. 

      Libraries needed in the event of an emergency.


  • 38. 
    What ext2 filesystem attribute allows a process to take on the ownership of the executable file's owner?
    • A. 

      SUID.

    • B. 

      ...


  • 39. 
    What is appended to the beginning of a command line in order to modify the execution priority of the resulting process?
    • A. 

      Nice.

    • B. 

      ...


  • 40. 
    How are the cat and tac commands related? Select one.
    • A. 

      Cat displays files and tac does the same but in reverse order.

    • B. 

      Cat concatenates files while tac splits a file into pieces.

    • C. 

      Cat creates file catalogs while tac displays the catalogs.

    • D. 

      The two commands are links to the same executable.

    • E. 

      There is no relation or similarity between cat and tac.


  • 41. 
    With regard to the use of regular expressions to match text in a file, describe a metacharacter. Select one.
    • A. 

      They are standard text characters used in the regular expression.

    • B. 

      They are special control characters used in the regular expression.

    • C. 

      They are used to display results after using a regular expression.

    • D. 

      They are used by the shell to display graphics.

    • E. 

      Metacharacters aren't used in regular expressions.


  • 42. 
    How many IDE devices can be installed and simultaneously used in a typical Intel-based system? Select one.
    • A. 

      1

    • B. 

      2

    • C. 

      3

    • D. 

      4

    • E. 

      5


  • 43. 
    Consider the following line of console output, excerpted from among other lines of output. Which one of the commands produced it?/dev/hda8 1.9G 559M 1.2G 30% /home
    • A. 

      Du -s

    • B. 

      Du -k

    • C. 

      Df -h

    • D. 

      Df -k

    • E. 

      Df -m


  • 44. 
    Which one of the following would be a consequence of a filesystem running out of inodes?
    • A. 

      More inodes would be automatically created in the filesystem.

    • B. 

      Quotas would become disabled on the filesystem.

    • C. 

      The filesystem would be corrupted.

    • D. 

      The filesystem would be marked read-only.

    • E. 

      No writes would be possible on the filesystem until existing files were deleted.


  • 45. 
    Which one of the following is true about the LILO boot loader?
    • A. 

      It can start the Windows NT Loader.

    • B. 

      It is started using the lilo command.

    • C. 

      It is the only boot loader available for Linux.

    • D. 

      It can start multiple Linux kernels, but no foreign operating systems.

    • E. 

      It resides entirely in the boot sector.


  • 46. 
    Which one of the following statements correctly describes the > and >> symbols in the context of the bash shell?
    • A. 

      > appends standard output to an existing file, and >> writes standard output to a new file.

    • B. 

      > writes standard output to a new file, and >> appends standard output to an existing file.

    • C. 

      > writes standard error to a new file, and >> appends standard error to an existing file.

    • D. 

      > pipes standard output to a new file, and >> pipes standard output to an existing file.

    • E. 

      > pipes standard output to an existing file and >> pipes standard error to a new file.


  • 47. 
    What is the correct syntax to remove mypkg entirely from a Debian GNU/Linux system, including configuration files? Select one.
    • A. 

      Dpkg -r mypkg

    • B. 

      Dpkg --remove mypkg

    • C. 

      Dpkg --kill mypkg

    • D. 

      Dpkg -R mypkg

    • E. 

      Dpkg --purge mypkg


  • 48. 
    Your system's FontPath directives include only one entry:unix/:-1 Which of the following is true? Select one.
    • A. 

      Error -1 has occurred during X startup

    • B. 

      Only the default font will be available to applications

    • C. 

      An X font server is to be used

    • D. 

      An X font server failed to initialize

    • E. 

      No fonts were found by XFree86 or by a font server


  • 49. 
    How do you use dpkg to verify the status of an installed package mypkg? Select one.
    • A. 

      Dpkg -s mypkg

    • B. 

      Dpkg -S mypkg

    • C. 

      Dpkg -stat mypkg

    • D. 

      Dpkg --stat mypkg

    • E. 

      Dpkg --Status mypkg


  • 50. 
    Which of the following statements is true about an X server? Select one.
    • A. 

      An X server is a high-performance system offering graphical programs over a network.

    • B. 

      An X server sends its graphical output to a window manager.

    • C. 

      An X server is under the control of a window manager.

    • D. 

      A window manager is under the control of an X server.

    • E. 

      A window manager is also known as an X server.


  • 51. 
    What are the two interrupts usually associated with a PC's onboard serial interface?
    • A. 

      3 and 4.

    • B. 

      ...


  • 52. 
    How can you query the RPM database for a list of all installed RPM packages? Select one.
    • A. 

      Rpm -q

    • B. 

      Rpm -qa

    • C. 

      Rpm -a

    • D. 

      Rpm -al

    • E. 

      Rpm -qal


  • 53. 
    Which pair of dpkg options are equivalent and what do they do? Select one.
    • A. 

      -C and --configure; they reconfigure an unpackaged package.

    • B. 

      -C and --clear-avail; they erase existing information about what packages are available.

    • C. 

      -A and --audit; they update information about what packages are available.

    • D. 

      -C and --audit; they provide resource consumption information on installed packages.

    • E. 

      -C and --audit; they search for partially installed packages.


  • 54. 
    What will happen when rpm is launched as follows?rpm -Uvh file
    • A. 

      The RPM file will be verified.

    • B. 

      An installed package may be upgraded with the version in file, with verbose output.

    • C. 

      An installed package may be upgraded with the version in file, with verbose output and hash marks indicating progress.

    • D. 

      An error will occur because a major mode is not specified.

    • E. 

      An error will occur because no file options were specified.


  • 55. 
    How are changes to the system BIOS made? Select one.
    • A. 

      Using linuxconf.

    • B. 

      By manually editing text files.

    • C. 

      Using the lilo command.

    • D. 

      At boot time using system-specific menus.

    • E. 

      At boot time using LILO commands.


  • 56. 
    When using xdm, which of the following files can be used to start a window manager? Select one.
    • A. 

      Xservers

    • B. 

      Xaccess

    • C. 

      Xdm-config

    • D. 

      Xsession

    • E. 

      Xsetup_0


  • 57. 
    When partitioning a disk with more than 1024 cylinders, which of the following could affect the system's ability to boot? Select all that apply.
    • A. 

      Location of LILO on disk.

    • B. 

      Location of /boot on disk.

    • C. 

      Location of /var on disk.

    • D. 

      Disk transfer rate.

    • E. 

      Disk seek time.


  • 58. 
    Which of the following is a reasonable size for a swap partition for a Linux workstation with 128 MB RAM? Select one.
    • A. 

      1 KB

    • B. 

      0.5 MB

    • C. 

      100 MB

    • D. 

      5 GB

    • E. 

      10 GB


  • 59. 
    What is XDMCP, and how is it used? Select one.
    • A. 

      An X utility, used to copy files between a host and an X terminal.

    • B. 

      An X utility, used to configure XDM.

    • C. 

      An X utility, used to configure IP addresses on X terminals on the network.

    • D. 

      An X protocol, used to discover/listen for X terminals on the network.

    • E. 

      An X protocol, used to exchange graphics information between X clients and X servers over the network.


  • 60. 
    How many target devices can be added to an 8-bit SCSI-2 bus? Select one.
    • A. 

      6

    • B. 

      7

    • C. 

      8

    • D. 

      15

    • E. 

      16


  • 61. 
    How can you obtain a list of files contained in an .rpm file? Select one.
    • A. 

      Rpm -q file

    • B. 

      Rpm -i file

    • C. 

      Rpm -ql file

    • D. 

      Rpm -qlp file

    • E. 

      Rpm -qal file


  • 62. 
    Which of the following accurately describes the contents of the xdisp:1.0 DISPLAY environment variable? Select one.
    • A. 

      System xdisp is to send X programs to the first display of the local X server.

    • B. 

      System xdisp is to receive X programs on the first display of its X server.

    • C. 

      System xdisp is to receive X programs on the second display of its X server.

    • D. 

      Local program xdisp is to use the second display of the local X server.

    • E. 

      Local program xdisp is to use the second display of any available X terminal.


  • 63. 
    Which file contains information on the I/O port assignments in use? Select one.
    • A. 

      /dev/ioports

    • B. 

      /etc/ioports

    • C. 

      /etc/sysconfig/ioports

    • D. 

      /etc/proc/ioports

    • E. 

      /proc/ioports


  • 64. 
    Why might an administrator use the --force option for rpm?
    • A. 

      To overwrite a previously installed package.

    • B. 

      To overwrite a Debian package.

    • C. 

      To prevent confirmation messages.

    • D. 

      To force the deletion of installed packages.

    • E. 

      To force the deletion of package dependencies.


  • 65. 
    Which of the following commands cannot be used to exit from vi when in command mode? Select one.
    • A. 

      ZZ

    • B. 

      :x

    • C. 

      :q

    • D. 

      :q!

    • E. 

      :bye


  • 66. 
    Which is not a valid dpkg installation command? Select one.
    • A. 

      Dpkg -i package_file

    • B. 

      Dpkg -iL package_file

    • C. 

      Dpkg -iR package_dir

    • D. 

      Dpkg -iG package_file

    • E. 

      Dpkg -iE package_file


  • 67. 
    Which of the following is the text file that contains directories where the dynamic linker should look for libraries? Select one.
    • A. 

      Ld.so.conf

    • B. 

      Conf.ld.so

    • C. 

      Ld.so.cache

    • D. 

      So.config

    • E. 

      Configld


  • 68. 
    The following line comes from /etc/fstab Which of the statements is accurate given the contents of this line? Choose two that apply./dev/fd0 /mnt/fd0 vfat noauto,users 0 0
    • A. 

      Users are prohibited from mounting and unmounting the filesystem.

    • B. 

      Users are permitted to mount and unmount the filesystem.

    • C. 

      The filesystem will be mounted on mount point /dev/fd0.

    • D. 

      The filesystem is expected to be a Linux native filesystem.

    • E. 

      The filesystem is on a floppy disk.


  • 69. 
    What is the startx command? Select one.
    • A. 

      A script included with XFree86 to make startup user friendly.

    • B. 

      A script used to start xdm.

    • C. 

      A compiled binary program that directly launches the X server.

    • D. 

      A configuration file created by X configuration tools such as XF86Config.

    • E. 

      A script originated by Linux distributors to tailor X startup to their particular X implementation.


Back to top

Removing ad is a premium feature

Upgrade and get a lot more done!
Take Another Quiz
We have sent an email with your new password.