Linux Commands Multiple Choice 2

69 Questions | Total Attempts: 297

SettingsSettingsSettings
Please wait...
Linux Commands Multiple Choice 2

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.


Questions and Answers
  • 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

Back to Top Back to top