Linux LPI 117-101 # 5 Of 9

57 Questions

Settings
Please wait...
Linux Quizzes & Trivia

Linux lpi testing


Questions and Answers
  • 1. 
    What switch is used with the useradd command to specify a user's initial group?
    • A. 

      -g

    • B. 

      -i

    • C. 

      -u

    • D. 

      -ig

  • 2. 
    What option is used with the useradd command to specify the user's user id?
    • A. 

      -u

    • B. 

      -s

    • C. 

      -ui

    • D. 

      -id

  • 3. 
    What option is used with the useradd command to specify the user's login shell?
    • A. 

      -s

    • B. 

      -l

    • C. 

      -u

    • D. 

      -sh

  • 4. 
    Which of the following can be used to change a user's home directory?
    • A. 

      Usermod -d

    • B. 

      Usermod -h

    • C. 

      Usermod -u

    • D. 

      Usermod -c

  • 5. 
    You had a contractor come into your company. You originally set his account to expireafter thirty days. You now need to change this. How can you do this?
    • A. 

      Usermod -e

    • B. 

      Usermod -a

    • C. 

      Usermod -x

    • D. 

      Usermod -d

  • 6. 
    You are logged in as user tux1, but now you want to switch users to tux2 with tux2'senvironment. How would you do this?
    • A. 

      Su tux2

    • B. 

      Su -e tux2

    • C. 

      Su - tux2

    • D. 

      Su -m tux2

    • E. 

      Su -f tux2

  • 7. 
    You logged in as user linux1, but now you want to switch users to linux2 with linux'senvironment. How would you do this?
    • A. 

      Su linux2

    • B. 

      Su -e linux2

    • C. 

      Su - linux2

    • D. 

      Su -m linux2

    • E. 

      Su -f linux2

  • 8. 
    Which of these commands would report how many total accounts (including specialaccounts) there are?
    • A. 

      Count /etc/passwd

    • B. 

      Nl /etc/passwd | head

    • C. 

      Wc --users /etc/passwd

    • D. 

      Wc --lines /etc/passwd

    • E. 

      Expand --lines /etc/passwd

  • 9. 
    What does the following command do?            cat '$TEST'
    • A. 

      Displays a bash syntax error message.

    • B. 

      Displays the contents of the file named $TEST if it exists.

    • C. 

      Waits for the user to enter text and then echos the text back.

    • D. 

      Displays the contents of the file named inside the back quotes.

    • E. 

      Displays the contents of the named by the environment variable TEST.

  • 10. 
      file1 and file2 are text files in your local directory.            file1 contains this:            allan            bart            ceasar            file2 contains this:            alicia            beatrice            Cecilia            What would the output of the following command be?            tac file1 file2
    • A. 

      Allan/ bart/ ceasar/ alicia/ beatrice/ cecilia

    • B. 

      Alicia/ beatrice/ cecilia/ allan/ bart/ ceasar

    • C. 

      Alicia/ beatrice/ cecilia/ ceasar/ bart/ allan

    • D. 

      Cecilia/ beatrice/ alicia/ ceasar/ bart/ allan

    • E. 

      Ceasar/ bart/ allan/ cecilia/ beatrice/ alicia

  • 11. 
    Which of the following would copy the file file1.txt to file2.txt?
    • A. 

      Cp file1.txt | file2.txt

    • B. 

      Cat file1.txt | file2.txt

    • C. 

      Cat file1.txt > file2.txt

    • D. 

      Copy file1.txt | file2.txt

    • E. 

      Cat | file1.txt | file2.txt

  • 12. 
    What command would help you identify the I/O address range being used by thenetwork card?
    • A. 

      Cat /proc/modules

    • B. 

      Cat /proc/devices

    • C. 

      Cat /proc/meminfo

    • D. 

      Cat /io/dma

    • E. 

      Cat /proc/ioports

  • 13. 
    Type the command will identify the io address range used by a NIC?
  • 14. 
     What is the result of the following command?# cat 'echo "$ Certkiller
    • A. 

      A syntax error

    • B. 

      The value of $ Certkiller

    • C. 

      Cat followed by the value of $ Certkiller

    • D. 

      Echo followed by the value of $ Certkiller

    • E. 

      Echo followed by $ Certkiller

  • 15. 
    To convert all uppercase letters in stream to lowercase, pipe the stream into which
    • A. 

      Tr A-Z a-z

    • B. 

      Tac A-Z a-z

    • C. 

      Sed /A-Z a-z

    • D. 

      Sed -tolower

    • E. 

      Conv [A-Z] [a-z]

  • 16. 
     Which of the following command would most likely be used to output a file inreverse? Choose TWO correct answers.
    • A. 

      Tac

    • B. 

      Pr

    • C. 

      Rev

    • D. 

      Sed

    • E. 

      Back

  • 17. 
    You have a file with the following contents:            A. allan            B. bart            C. ceasar            D. alicia            E. beatrice            F. ceciliaWhat single command could you use to list the file contents in reverse order? (Includeonly the command without options or arguments)
  • 18. 
    You have a file with the following contents:            A. allan            B. bart            C. ceasar            D. alicia            E. beatrice            F. CeciliaWhat single command could you use to list the file contents in reverse order? Pleaseinclude only the command without options or arguments.
  • 19. 
    What command will easily convert tabs in files to spaces?
    • A. 

      Convert

    • B. 

      Expand

    • C. 

      Tr

    • D. 

      Sed

    • E. 

      None of the above

  • 20. 
    Which of the following would do the same as the command cat < file1.txt > file2.txt?
    • A. 

      Cat < file1.txt file2.txt

    • B. 

      Cat file1.txt >file2.txt

    • C. 

      Cat

    • D. 

      Cat file 1.txt | file2.txt

    • E. 

      Cp file1.txt>file2.txt

  • 21. 
    Which of the commands will show you only the middle 10 lines of a 30 line text filenamed textfile?
    • A. 

      Head -n 11-20 textfile

    • B. 

      Head -n 20 textfile | tail

    • C. 

      Tail -n 11-20

    • D. 

      Cat textfile | pr -n 11-20

    • E. 

      Nl -n 11-30 textfile

  • 22. 
    What command will show the first 10 lines of a file by default?
    • A. 

      Head

    • B. 

      Cat

    • C. 

      Tac

    • D. 

      Nl

    • E. 

      Tail

  • 23. 
    What command will show the last 10 lines of a file by default?
    • A. 

      Tail

    • B. 

      Head

    • C. 

      Cat

    • D. 

      Prstat

    • E. 

      Ps

  • 24. 
    • A. 

      Cat /proc/ioports

    • B. 

      Cat /proc/interrupts

    • C. 

      Cat /proc/memoryinfo

    • D. 

      Which interrupts

    • E. 

      Tail /var/log/messages

  • 25. 
    • A. 

      Cat file1.txt > file2.txt

    • B. 

      Cat file1.txt | file2.txt

    • C. 

      Cp file1.txt > file2.txt

    • D. 

      Cp file1.txt file2.txt

    • E. 

      Cpio < file1.txt > file2.txt

  • 26. 
     What utility would use to remove/display columns from each line of a file?
    • A. 

      Pwd

    • B. 

      Col

    • C. 

      Cut

    • D. 

      Tail

    • E. 

      Extract

  • 27. 
    After executing the following command line, what will be the contents of the filemyout.txt?echo \" Certkiller \" | cat > myout.txt
    • A. 

      Certkiller

    • B. 

      " Certkiller "

    • C. 

      Certkiller cat

    • D. 

      The file is empty

  • 28. 
    You wish to cut the 3rd and 7th fields from a colon (:) delimited text file called 'my Certkiller ' and display them on the screen. Type the command that would do this?
  • 29. 
    What command returns the first few lines of a given file?
  • 30. 
    What command is used to display a file in octal format?
  • 31. 
    You need to replace all instances of the word Certkiller with Certkiller in a file calledfile.txt, and send the output to a file named Certkiller .txt. Type the simplest commandstring to accomplish this.
  • 32. 
    You want to redirect the last 30 lines of a file to another file.What single command would best fit your needs?
  • 33. 
    • A. 

      Wc -l ' Certkiller /var/log/maillog'

    • B. 

      For " Certkiller " in [maillog (count) +1]

    • C. 

      Wc -l /var/log/maillog | grep ' Certkiller '

    • D. 

      Cat /var/log/maillog | grep ' Certkiller ' | wc -l

    • E. 

      Cat /var/log/mailog | grep ' Certkiller ' | wc -r

  • 34. 
    To prevent a command run as root from sending both standard out (stdout) andstandard error (stderr) to any terminal or other file or device, which of thefollowing strings should be appended to the command?
    • A. 

      >/dev/null

    • B. 

      >/dev/null 1>&2

    • C. 

      >/dev/null 2>&1

    • D. 

      1>&2 >/dev/null

    • E. 

      2>&1 >/dev/null

  • 35. 
    • A. 

      Sed 's/foo/foobar/g' file1.txt

    • B. 

      Sed 's/foo/foobar/g' file1.txt > file1.txt

    • C. 

      Sed 's/foo/foobar/g' file1.txt | file1.txt

    • D. 

      Sed -i 's/foo/foobar/g' file1.txt

    • E. 

      Sed -i 's/foo/foobar/g' file1.txt > file1.txt

  • 36. 
    What command will print a list of usernames (first column) and theircorresponding user id (uid, third column) from /etc/passwd?
    • A. 

      Cut -d: -f 1,3 /etc/passwd

    • B. 

      Chop -c 1,3 /etc/passwd

    • C. 

      Tac 1-3 /etc/passwd

    • D. 

      Fmt -u /etc/passwd

  • 37. 
    What command will remove duplicate lines from a sorted file?
    • A. 

      Filter

    • B. 

      Trim

    • C. 

      Uniq

    • D. 

      Wc

  • 38. 
    ├Łou have a text file with tab-separated values, but your application needs themspace-separated. What command would you use from the Bash shell to achieve this?Please fill in the command only, without any options.
  • 39. 
    Which command is used to dump files in octal format?
    • A. 

      Od

    • B. 

      Octdump

    • C. 

      Dumpoct

    • D. 

      Cat -o

  • 40. 
    • A. 

      The current year

    • B. 

      The current month

    • C. 

      The current hour

    • D. 

      The current minute

    • E. 

      The current second

  • 41. 
    Which of the following commands can you use to rename a file in Linux?
    • A. 

      N

    • B. 

      Mv

    • C. 

      New

    • D. 

      Rm

  • 42. 
    What dose the command cd~foo do?
    • A. 

      It will take you to the ~foo directory.

    • B. 

      It will create the foo directory and change to it

    • C. 

      It will take you to the home directory of the user "foo"

    • D. 

      It will change the directory to the system foo directory.

    • E. 

      It will change to the foo directory in your home directory.

  • 43. 
    As root you have navigated to directory /B. You wish to move all of the files anddirectories from directory /A to directory /B. Which of the following options wouldbe the most appropriate command line to execute this task?
    • A. 

      Cp /a/*

    • B. 

      Mv -f /A/* .

    • C. 

      Mv -Rf /a/* .

    • D. 

      Cp -f /a/* ..

    • E. 

      Cp -rf /A/* /b/

  • 44. 
    • A. 

      The group for /home/poms/foo/bar will be poms.

    • B. 

      The owner for /home/poms/foo/bar will be devel

    • C. 

      The owner for /home/poms/foo/bar will be bubba.

    • D. 

      The group for /home/poms/foo/bar will be bubba.

    • E. 

      The permissions for /home/poms/foo/bar will allow group read.

  • 45. 
    Which command removes all subdirectories in /tmp, regardless ofwhether they are non-existent or in use?
    • A. 

      Del /tmp/*

    • B. 

      M -rf /tmp

    • C. 

      Rm -Ra /tmp/*

    • D. 

      Rm -rf /tmp/*

    • E. 

      Delete /tmp/*,*

  • 46. 
    • A. 

      Ratas

    • B. 

      Jacaw

    • C. 

      Saran

    • D. 

      Cabal

    • E. 

      Cabin

  • 47. 
    You need to display all files in the current directory that start with a "a" and endwith a "v", regardless of their length or use of delimiters. Choose the best answer.
    • A. 

      Ls a*v

    • B. 

      Ls a.v

    • C. 

      Ls a-v

    • D. 

      Ls [a-v]

  • 48. 
    You want to move all files in /dir1 to /dir2 that begin with a and end with v. What isthe correct command to do this?
    • A. 

      Mv /dir1/a*v /dir2

    • B. 

      Mv -r /dir1/a.v /dir2

    • C. 

      Move /dir1/a?v /dir2

    • D. 

      Ls a*v | cp /dir2

    • E. 

      Mv /dir1/[a-v] /dir2

  • 49. 
    You wish to copy the full contents of the /home/jack directory and all subdirectoriesto the /home/bill directory.Type in the simplest command to do this.
  • 50. 
    You wish to move all files and directories from within /home/john to the directory/home/certkiller.Type in the command line that would do this?
  • 51. 
  • 52. 
    Which of the following commands will duplicate the contents of the /A directory inthe existing and empty /B directory?
    • A. 

      Mv /A/* /B

    • B. 

      Mv /A/ /B

    • C. 

      Mv /A /B

    • D. 

      Mv /A/* .

  • 53. 
    What command takes you to your home directory without using a path?
  • 54. 
    What will the command cd ~ do?
    • A. 

      Take you to the ~ directory

    • B. 

      Take you to the sys directory.

    • C. 

      Take you to your home directory.

    • D. 

      Nothing, this command is invalid.

  • 55. 
    You need to create a simple hierarchy of directories:images/photos/summer/ottawa/. None of the directories on that path exists. Whatcommand will create all of the needed directories in one step?
    • A. 

      Mkdir -r images/photos/summer/ottawa/

    • B. 

      Mkdir -R images/photos/summer/ottawa/

    • C. 

      Mkdir -p images/photos/summer/ottawa/

    • D. 

      Mkdir -P images/photos/summer/ottawa/

    • E. 

      Mkdir -m images/photos/summer/ottawa/

  • 56. 
    To send input to both stdout AND a file, you use the _____ command.
  • 57. 
    To change all lower case characters in a file to upper case, pick the correctcommand. Select all that apply.
    • A. 

      Tr 'a-z' 'A-Z' file

    • B. 

      Tr [a-z] [A-Z] < file

    • C. 

      Tr "a-z" "A-Z" file

    • D. 

      Tr 'a-z' 'A-Z' < file

    • E. 

      Tr {a-z} {A-Z} > file