Linux Command Line Fundamentals

Comprehensive quiz covering essential Linux command line commands and concepts including file operations, process management, text processing, permissions, wildcards, and path navigation.

48 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

Shutdown the system. (Replace -h with -r for reboot.)

  1. shutdown -h now
  2. find /home -mtime -1
  3. df -h
  4. du -sh ./*
Question 2 Multiple Choice (Single Answer)

Find all files in the given directory (and subs) which have been modified in the last 24 hours.

  1. basename -s .jpg -a *.jpg | xargs -n1 -i cp {}.jpg {}_bk.jpg
  2. find /home -mtime -1
  3. du -sh ./*
  4. df -h
Question 3 Multiple Choice (Single Answer)

Make a copy of every jpg image file in the current directory and rename adding _bk

  1. basename -s .jpg -a *.jpg | xargs -n1 -i cp {}.jpg {}_bk.jpg
  2. find /home -mtime -1
  3. du -sh ./*
  4. shutdown -h now
Question 4 Multiple Choice (Single Answer)

Display how much disk space is used and also free.

  1. df -h
  2. du -sh ./*
  3. find /home -mtime -1
  4. shutdown -h now
Question 5 Multiple Choice (Single Answer)

Find the size of every directory in your current directory.

  1. du -sh ./*
  2. df -h
  3. basename -s .jpg -a *.jpg | xargs -n1 -i cp {}.jpg {}_bk.jpg
  4. find /home -mtime -1
Question 6 Multiple Choice (Single Answer)

Move the given process from the background to the foreground

  1. fg <job number>
  2. bg <job number>
  3. kill <process id>
  4. killall <process name>
Question 7 Multiple Choice (Single Answer)

See a list of current processes in the background.

  1. jobs
  2. ps
  3. tree
  4. pstree
Question 8 Multiple Choice (Single Answer)

Pause the currently running process and put it in the background.

  1. CTRL + Z
  2. CTRL + C
  3. CTRL + D
  4. CTRL + R
Question 9 Multiple Choice (Single Answer)

Obtain a listing of processes and their id's. Including the option aux will show all processes.

  1. ps
  2. jobs
  3. pwd
  4. tree
Question 10 Multiple Choice (Single Answer)

Cancel the given process. Include the option -9 to kill a stubborn process.

  1. kill <process id>
  2. fg <job number>
  3. bg <job number>
  4. jobs
Question 11 Multiple Choice (Single Answer)

Cancel the currently running process.

  1. CTRL + C
  2. kill <process id>
  3. CTRL + Z
  4. CTRL + D
Question 12 Multiple Choice (Single Answer)

Feed the STDOUT of the program on the left as STDIN to the program on the right.

  1. |
  2. <
  3. >
  4. <>
Question 13 Multiple Choice (Single Answer)

Pass the contents of a file to a program as STDIN.

  1. <
  2. 2>
  3. |
  4. ||
Question 14 Multiple Choice (Single Answer)

Redirect the STDERR to a file.

  1. 2>
  2. >>
  3. >
  4. |
Question 15 Multiple Choice (Single Answer)

Append STDOUT to the end of a file.

  1. >>
  2. >
  3. 2>
  4. |
Question 16 Multiple Choice (Single Answer)

Redirect STDOUT to a file.

  1. >
  2. >>
  3. 2>
  4. <
Question 17 Multiple Choice (Single Answer)

Search for a given pattern.

  1. grep
  2. wc
  3. sort
  4. tree
Question 18 Multiple Choice (Single Answer)

How many words, characters and lines

  1. wc
  2. grep
  3. how
  4. try
Question 19 Multiple Choice (Single Answer)

Sort lines in a given way.

  1. sort
  2. wc
  3. grep
  4. ord
Question 20 Multiple Choice (Single Answer)

Show the last n lines.

  1. tail
  2. head
  3. wc
  4. grep
Question 21 Multiple Choice (Single Answer)

Show the first n lines.

  1. head
  2. tail
  3. sort
  4. wc
Question 22 Multiple Choice (Single Answer)

Change permissions. Permissions can be either shorthand (eg. 754) or longhand (eg. g+x).

  1. chmod <permissions> <path>
  2. chown <permissions> <path>
  3. chperm <permissions> <path>
  4. chinge <permissions> <path>
Question 23 Multiple Choice (Single Answer)

View the permissions of a file or all items in a directory.

  1. ls -l [path]
  2. ls [path]
  3. dir [path]
  4. dir -l [path]
Question 24 Multiple Choice (Single Answer)

--x

  1. execute
  2. read
  3. write
  4. nothing
Question 25 Multiple Choice (Single Answer)

-w-

  1. write
  2. read
  3. execute
  4. nothing
Question 26 Multiple Choice (Single Answer)

r--

  1. read
  2. write
  3. execute
  4. nothing
Question 27 Multiple Choice (Single Answer)

Range

  1. [ ]
  2. *
  3. ?
  4. .
Question 28 Multiple Choice (Single Answer)

Single character

  1. ?
  2. *
  3. .
  4. [ ]
Question 29 Multiple Choice (Single Answer)

Zero or more characters

  1. *
  2. ?
  3. [ ]
  4. .
Question 30 Multiple Choice (Single Answer)

Remove a file or directory. Common options: -r -f

  1. rm <path>
  2. del <path>
  3. remove <path>
  4. delete <path>
Question 31 Multiple Choice (Single Answer)

Move the source file to the destination. May also be used to rename files or directories.

  1. mv <source> <destination>
  2. cp <source> <destination>
  3. ren <source> <destination>
  4. move <source> <destination>
Question 32 Multiple Choice (Single Answer)

Copy the source file to the destination.

  1. cp <source> <destination>
  2. mv <source> <destination>
  3. copy <source> <destination>
  4. ls <source> <destination>
Question 33 Multiple Choice (Single Answer)

Create a blank file.

  1. touch <file name>
  2. rm <path>
  3. mkdir <directory name>
  4. rmdir <directory name>
Question 34 Multiple Choice (Single Answer)

Remove a directory (only if empty).

  1. rmdir <directory name>
  2. mkdir <directory name>
  3. touch <file name>
  4. rm <path>
Question 35 Multiple Choice (Single Answer)

Create a directory

  1. mkdir <directory name>
  2. rmdir <directory name>
  3. touch <file name>
  4. rm <path>
Question 36 Multiple Choice (Single Answer)

Search for man pages containing the search term.

  1. man -k <search term>
  2. man -s <search term>
  3. man -r <search term>
  4. man -l <search term>
Question 37 Multiple Choice (Single Answer)

View the man page for a command.

  1. man <command>
  2. man -k <command>
  3. man -r <command>
  4. man -s <command>
Question 38 Multiple Choice (Single Answer)

Find out what type of item a file or directory is.

  1. file [path]
  2. ls [path]
  3. cd [path]
  4. pwd
Question 39 Multiple Choice (Single Answer)

Start typing and press SOME KEY. The system will auto complete the path.

  1. TAB
  2. ESC
  3. SPACE
  4. NUM LOCK
Question 40 Multiple Choice (Single Answer)

Used in paths as a reference to your current directories parent directory.

  1. .. (dot dot)
  2. . (dot)
  3. ~ (tilde)
  4. cd [path]
Question 41 Multiple Choice (Single Answer)

Used in paths as a reference to your current directory.

  1. . (dot)
  2. .. (dot dot)
  3. ~ (tilde)
  4. pwd
Question 42 Multiple Choice (Single Answer)

Used in paths as a reference to your home directory.

  1. ~ (tilde)
  2. . (dot)
  3. .. (dot dot)
  4. cd [path]
Question 43 Multiple Choice (Single Answer)

One relative to where you currently are in the system (eg. Documents/music ).

  1. Relative Path
  2. Absolute Path
  3. ~ (tilde)
  4. . (dot)
Question 44 Multiple Choice (Single Answer)

One beginning from the root of the file system (eg. /etc/sysconfig ).

  1. Absolute Path
  2. Relative Path
  3. pwd
  4. . (dot)
Question 45 Multiple Choice (Single Answer)

A description of where a file or directory is on the filesystem.

  1. Path
  2. pwd
  3. ~ (tilde)
  4. cd [path]
Question 46 Multiple Choice (Single Answer)

Change into the given path or into your home directory.

  1. cd [path]
  2. ls [path]
  3. pwd
  4. .. (dot dot)
Question 47 Multiple Choice (Single Answer)

Perform a listing of the given path or your current directory. Common options: -l, -h, -a

  1. ls [path]
  2. pwd
  3. cd [path]
  4. file [path]
Question 48 Multiple Choice (Single Answer)

Where am I in the system.

  1. pwd
  2. cd
  3. ~ (tilde)
  4. .. (dot dot)