Linux Cli Basics

25 Questions | Attempts: 320
Share

SettingsSettingsSettings
Linux Quizzes & Trivia

This quiz contains questions on commonly used Linux/Unix commands. See how well you do!

If you find any issues with this exam, then I'm sorry. I don't word questions the best.

Specifically, this test is geared around Fedora Core 10 using a bash shell.


Questions and Answers
  • 1. 

    I want information about the "ls" command.  What command can I type?

    • A.

      Man -k ls

    • B.

      Manual ls

    • C.

      Man ls

    • D.

      Lookup ls

    Correct Answer
    C. Man ls
  • 2. 

    User "john" wants his password changed.  What command would I need to type as root to change his password?

    • A.

      Password john

    • B.

      Changepassword john

    • C.

      Passwd

    • D.

      Passwd john

    • E.

      None are acceptable.

    Correct Answer
    D. Passwd john
  • 3. 

    User "jacob" is attempting to run the bash script p1 using the command "./p1".  He receives the following error:-bash: ./p1: Permission deniedHe types "ls -l p1" and gets the following result:-rw-r--r-- 1 jacob jacob  2 2010-01-21 20:36 p1What is causing his problem?

    • A.

      The root user has not given him permission to run this program.

    • B.

      He has not granted execute permissions to the file.

    • C.

      It is not a bash script.

    • D.

      He lacks the permission to read the file.

    Correct Answer
    B. He has not granted execute permissions to the file.
  • 4. 

    What type of file path is "/home/john/work/p1.c"?

    • A.

      Absolute Path

    • B.

      Relative Path

    • C.

      Related Path

    • D.

      Unknown Path

    Correct Answer
    A. Absolute Path
  • 5. 

    User "mary" is in her home directory, which is located in "/home/mary".  Mary attempts to access the "work" sub-directory inside her home directory by typing "cd /work".  She receives the error:-bash: cd: /work: No such file or directoryWhat is Mary doing incorrectly?

    • A.

      She does not have permission to enter the "/home/mary/work" directory.

    • B.

      The root user deleted her work directory at "/home/mary/work".

    • C.

      She is specifying an absolute path to a folder which does not exist. She should type "cd work".

    • D.

      She needs to create the directory first.

    Correct Answer
    C. She is specifying an absolute path to a folder which does not exist. She should type "cd work".
  • 6. 

    Which of the following commands will print a calender of the year 2002 to the terminal?

    • A.

      Calender 2002

    • B.

      Cal

    • C.

      Touch cal 2002

    • D.

      Cal 2002

    Correct Answer
    D. Cal 2002
  • 7. 

    How do you show what your current working directory is?

    • A.

      Passwd

    • B.

      Pwd

    • C.

      Pd

    • D.

      Ls

    Correct Answer
    B. Pwd
  • 8. 

    Which one of the following characters is considered a "wildcard"?

    • A.

      !

    • B.

      &

    • C.

      *

    • D.

      $

    Correct Answer
    C. *
  • 9. 

    Which of the following is NOT a valid way to change to your home directory?

    • A.

      Cd $HOME

    • B.

      CD ~

    • C.

      Cd

    • D.

      Cd ~

    Correct Answer
    B. CD ~
  • 10. 

    User "thomas" needs root access temporarily.  To do this, he types "su -" and enters a root password.  Once he is done, he types "su - thomas" to switch back to his normal account.  What is wrong with this?

    • A.

      If someone comes to his terminal and executes the "exit" command, they become root again.

    • B.

      He specified an incorrect username.

    • C.

      He used the "-" switch.

    • D.

      There is nothing wrong with this...

    Correct Answer
    A. If someone comes to his terminal and executes the "exit" command, they become root again.
  • 11. 

    User "matt" issues the command "vim p2.c" and enters the vim utility.  How does he enter "insert" mode to enter text?

    • A.

      :s

    • B.

      I

    • C.

      A

    • D.

      R

    • E.

      :wq

    Correct Answer
    B. I
  • 12. 

    Jacob does a long directory listing of his /usr/bin directory and comes across the following entry:-rwsr-xr-x 1 root root 41292 2009-07-31 08:55 passwdWhat can be told about this file? (2 answers)

    • A.

      It is actually a directory.

    • B.

      The root user is the user and group for this file.

    • C.

      This is a symbolic link.

    • D.

      This file does not have an inode associated with it.

    • E.

      This file has its "setuid" bit set, which means it will execute with root privileges every-time.

    Correct Answer(s)
    B. The root user is the user and group for this file.
    E. This file has its "setuid" bit set, which means it will execute with root privileges every-time.
  • 13. 

    Randy does a long directory listing of his /dev directory and comes across the following entry: lrwxrwxrwx 1 root root          15 2010-01-21 21:20 stdout -> /proc/self/fd/1 What can be told about this file? (2 answers)

    • A.

      It is actually a directory.

    • B.

      The root user is the user and group for this file.

    • C.

      This is a symbolic link.

    • D.

      This file does not have an inode associated with it.

    • E.

      This file has its "setuid" bit set, which means it will execute with root privileges every-time.

    Correct Answer(s)
    B. The root user is the user and group for this file.
    C. This is a symbolic link.
  • 14. 

    Which command would a user execute to create a symbolic link of his "/etc" directory to his home directory called the same thing?

    • A.

      Symlink /etc ~

    • B.

      Ls -l /etc ~

    • C.

      Ln /etc ~

    • D.

      Link /etc ~

    • E.

      Ln -s /etc ~

    Correct Answer
    E. Ln -s /etc ~
  • 15. 

    Which of the following commands will work as expected if you are NOT root?

    • A.

      Passwd john

    • B.

      Chkconfig openvpn on

    • C.

      Service network restart

    • D.

      Iptables -L

    • E.

      Echo $PATH

    Correct Answer
    E. Echo $PATH
  • 16. 

    What does the "env" command do?

    • A.

      Nothing, the command does not exist.

    • B.

      Prints your current environmental variables to standard out.

    • C.

      Sets an environmental variable.

    • D.

      Configures your network settings.

    Correct Answer
    B. Prints your current environmental variables to standard out.
  • 17. 

    Jacob wants to use the SSH protocol to administer a remote system.  What command could he give to do this?

    Correct Answer
    A. Ssh [email protected]
  • 18. 

    By default on most Linux distributions, what will the "init 6" command do?  Assume root privileges.

    • A.

      Shutdown the system

    • B.

      Start X11.

    • C.

      Shutdown X11.

    • D.

      Restart the system.

    Correct Answer
    D. Restart the system.
  • 19. 

    Jacob runs the following command:$cal > testWhat did Sam just do?

    • A.

      Nothing, this command would return an error saying "test" does not exist.

    • B.

      Redirected the output of the "cal" command to the file from standard out to a file called "test", overwriting the old file if it existed.

    • C.

      Redirected the output of the "cal" command to the file from standard out to a file called "test", appending to the end of the file if it existed.

    • D.

      Use the file "test" as the input for the cal command, overriding the keyboard.

    Correct Answer
    B. Redirected the output of the "cal" command to the file from standard out to a file called "test", overwriting the old file if it existed.
  • 20. 

    Sam runs the following command: $cal >> test What did Sam just do?

    • A.

      Nothing, this command would return an error saying "test" does not exist.

    • B.

      Redirected the output of the "cal" command to the file from standard out to a file called "test", overwriting the old file if it existed.

    • C.

      Redirected the output of the "cal" command to the file from standard out to a file called "test", appending to the end of the file if it existed.

    • D.

      Use the file "test" as the input for the cal command, overriding the keyboard.

    Correct Answer
    C. Redirected the output of the "cal" command to the file from standard out to a file called "test", appending to the end of the file if it existed.
  • 21. 

    The user "hiro" enters the command "ps".  What, by default, is the output consist of?

    • A.

      Nothing, Hiro needs to be the root user.

    • B.

      All processes on the system.

    • C.

      All processes owned by Hiro.

    • D.

      Only the processes on the current terminal session.

    Correct Answer
    D. Only the processes on the current terminal session.
  • 22. 

    Doug executes "cat p1.c | less".  What is true about this command?(2 answers)

    • A.

      Runs "cat p1.c" and "less" separately, showing the output of each after both are finished executing.

    • B.

      Redirects stdout of "cat p1.c" to the stdin of "less".

    • C.

      Redirects stdout of "cat p1.c" to the file "less".

    • D.

      Runs "less" in the background, so you may perform other tasks.

    • E.

      Is the equivalent of "less p1.c".

    Correct Answer(s)
    B. Redirects stdout of "cat p1.c" to the stdin of "less".
    E. Is the equivalent of "less p1.c".
  • 23. 

    Bob needs to type a long filename of "NCPL-1.000.051.tar.gz", but is lazy.  He types "tar -xzf N" in an empty directory, what can he do to type the full filename?

    • A.

      The command will auto complete without any further input, just press enter.

    • B.

      Press alt to auto complete the entry.

    • C.

      Press tab to auto complete the entry.

    • D.

      Stare at it until it chooses to auto complete.

    Correct Answer
    C. Press tab to auto complete the entry.
  • 24. 

    Which command would user "bill" use to remove ALL privileges to a file named "test" without changing the file's current user or group?Before:-rw-r--r-- 1 bill bill 3089 2010-01-12 17:37 testAfter:---------- 1 bill bill 3089 2010-01-12 17:37 test

    • A.

      Chmod 000 test

    • B.

      Chmod -x test

    • C.

      Chown root:root test

    • D.

      Chgrp nobody test

    Correct Answer
    A. Chmod 000 test
  • 25. 

    The user "johnny" wants to use the contents of the file "f1" as the input for the "less" command.  Johnny wants to see this output on his terminal.  Which of the following would work?(3 answers)

    • A.

      Cat f1 | less

    • B.

      Less < f1

    • C.

      Less > f1

    • D.

      Cat f1 | less > /dev/null

    • E.

      Less f1

    Correct Answer(s)
    A. Cat f1 | less
    B. Less < f1
    E. Less f1

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Jan 10, 2013
    Quiz Edited by
    ProProfs Editorial Team
  • Feb 20, 2010
    Quiz Created by
    Tcprescott
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.