All questions

OSCP Linux Practice Exam

Browse all practice questions for the OSCP Linux Practice Exam. Search by topic, open any question and review its full explanation, then test yourself in the practice quiz.

Master the OSCP Linux Challenge 2026 – Elevate Your Cyber Skills! course image
All questions

These questions are part of the practice quiz. Start practicing

  • If you wish to list the contents of a directory, what permissions must you have for that directory?
  • Where are system binaries (programs) stored?
  • How do you sort by the 10th character in the 3rd column?
  • Which command lowers the niceness of process 100 by 10?
  • Which of the following is a valid command to start a service using systemd?
  • Which redirection is represented by &> file.txt in Bash?
  • What is the purpose of the /etc/fstab file?
  • Which command reveals how the shell will interpret a given command, including whether it's a built-in, alias, or function?
  • Which command shows all UDP sockets and the programs that are using them?
  • In the following sed command what is the g used for? sed 's/bob/jake/g'
  • What does ESTABLISHED state indicate in netstat?
  • When renaming a file, what permissions are required?
  • Which statement best describes the /usr directory in this material?
  • What is the output of echo ${hi:-bye} if hi is unset?
  • What is the fastest way to create a test file with some sample text?
  • What does the following loop do: while read i; echo $i; done < file.txt?
  • Why is the permission string 'lrwxrwxrwx' not meaningful for a symbolic link?
  • In the permission string drwxrwxr-x, which permission is granted to others?
  • Which command interrupts a program that is in the foreground?
  • Which directory contains files that are variable, meaning they change constantly, such as database files and log files?
  • If you can't remember the name of the variable that lets you run commands from any location, what would you type to find out?
  • Which directory is traditionally used for optional software packages?
  • Which sequence correctly describes the typical steps to compile software from source?
  • In a Bash case statement, which value will trigger dothisthing given the pattern 'case matchWord in 1) dothisthing ;; esac'?
  • Which command shows what currently logged-in users are doing?
  • In the command 'll &> file.txt', what does the '&>' redirection do?
  • Which directory is least associated with system configuration or device files?
  • What is the new location for /var/log/messages?
  • What does the operation a += 5 do to the variable a?
  • Which option do you add to netstat to resolve hostnames to IP addresses in the output?
  • Where is the Linux kernel stored?
  • Which command reveals how the shell will interpret a command, including if it is a built-in, alias, function, or path?
  • Can you use regex as the identifier in a Bash case statement?
  • Which command enables a service to run at startup on systemd-based systems?
  • After appending 'a cow' and 'a duck' to the animals array, how many elements does the array contain?
  • Which account has UID and GID of 0?
  • If a command produces no standard error, what will file.txt contain after using 2> file.txt?
  • Where do you store source code that is intended to be used by multiple users?
  • Which command would you use to view PATH directly?
  • With the command > file.txt 2> file2.txt, where do stdout and stderr go?
  • How can you use extended regular expressions with grep or sed without using -E or -r?
  • Which command sequence would recursively locate all .txt files from the root directory, print each path, then display the first 10 lines of that file, separated by a blank line, while discarding errors?
  • When would you not want to use the nice command?
  • What happens if you try to use chown on a symbolic link without special options?
  • Which statement exits the current loop before its normal ending?
  • Process substitution in shells allows feeding the output of multiple commands into another command. Which command demonstrates this technique?
  • Which statement about hard links and symbolic links is true?
  • Given the Bash array animals defined as ("a dog" "a cat" "a fish"), what does echo ${animals[1]} print?
  • Which command changes the owner to 'spankme' and the group to 'baby' for bob.txt?
  • What does the command awk '{print $1}' <(ll) <(cat /etc/passwd) do?
  • To use a library of functions in a Bash script, which command imports the functions into your script?
  • What is the effect of quoting the end marker in a here-document?
  • What does a /= 5 do to the variable a?
  • Which command can verify a program's installation and locate its path (for example under /usr/local/bin)?
  • Which command writes stdout to stdout.txt and stderr to stderr.txt?
  • Which command sends a job with ID 1 to the foreground?
  • How would you set the same permissions in binary mode?
  • Which statement correctly describes the shell parameters $@, $$, and $!?
  • In a find command using -exec, what placeholder represents the current file?
  • What does the code 'while :; do echo hi; done' do?
  • If you wanted to pass arguments to a function that you made, how would you do it?
  • When using the ln command to create a link, which argument specifies the name of the link?
  • Which command lists the current user’s crontab entries?
  • What is the effect of echo test > file.txt 2>&1?
  • What does the redirection '2> /dev/null' accomplish in a shell command?
  • In Bash arithmetic, what does echo $((a++)) print?
  • In a shell, using 'command || exit 1' ensures what behavior?
  • Which filter matches packets where IP is 1.1.1.1 and the TCP port is 80?
  • What does the <<- redirection do in Bash here documents?
  • Which display filter shows only packets with IP address 1.1.1.1?
  • Which directory is the primary location for log files in a Linux system?
  • You can sort by multiple columns using the sort command by doing what argument?
  • How do you perform arithmetic in Bash so that 3 + 3 prints 6?
  • In a long directory listing, what does the number 3495253 typically represent?
  • How do you create a grep that matches a word that starts with any random character, followed by a lower case b, an upper case C or the numbers 1 through 3, then followed by anything that isn't the number 7 or the number 9, followed by any number of characters and ending with the letter j or any number. OR that matches at least one letter (capital or lower case) followed by exactly 17 numbers
  • What is the purpose of local variables in Bash, and how are they created?
  • Which control flow statement leaves the current function when executed?
  • What are the basic regular expression characters?
  • If you wanted to edit /etc/passwd, /etc/shadow, /etc/group, and /etc/gshadow safely, which sequence of commands would you run respectively?
  • In the command 'll asdfkjsdfhk > file.txt 2>&1', what does the '2>&1' portion do?
  • What does 2> file.txt accomplish?
  • In a diff output, what does the change '2a3' mean?
  • In the command 'll &> file.txt', which streams are redirected to file.txt?
  • Which directory typically contains system-wide configuration files in Linux?
  • What type of content does /etc primarily store?
  • What is a more efficient way to perform: if grep searchTerm; then echo hi; fi?
  • What happens if you make a for loop without 'in blahblah'?
  • What are the extended regular expression characters?
  • What is the purpose of a here document in shell scripting?
  • In Bash, what does the shift command do?
  • What is the difference between redirecting stdout with > file and redirecting stderr with 2> file?
  • How would you make a SysV-compatible service run at startup?
  • Which display filter shows only TCP traffic on port 80?
  • Which directory is a virtualized Linux file system that allows you to peek into how the kernel sees things?
  • How would you stop a service from starting at startup on SysV-style systems?
  • In a Bash case statement, what is the effect of the ;;& operator?
  • What is the effect of pressing Ctrl+Z while a process runs in the foreground?
  • Which sequence best describes typical steps to compile software from a tarball?
  • If you want to create a file in a directory, which permissions must you have?
  • What does the arithmetic expression ((i<1?++i:--i)) do?
  • What is special about using the -p option with netstat?
  • If you're trying to redirect stdout or stderr AND throw a long command that's been piped multiple times and includes multiple commands into the background, how do you need to do it?
  • Which of the following is a valid alternative method to locate PATH without using printenv?
  • When following a symbolic link, whose permissions determine access?
  • Which command prints the contents of a file named file.txt to standard output?
  • In Bash, how do you append text immediately after a variable's value without creating a second variable?
  • Which of the following represents a valid set of SysV init commands to control the 'apache2' service?
  • Which command changes only the group of bob.txt to 'baby'?
  • Which sequence sends only standard error to a file while leaving standard output untouched?
  • Which line is used to specify the interpreter for a Bash script?
  • Which command starts the process of creating a new GPG key pair?
  • In Bash, what does the loop for i in "${animals[@]}"; do echo $i; done print?
  • Which directory is commonly used as the mount point for removable media such as USB drives on many Linux systems?
  • Where are log files stored?
  • Which file is used to define system-wide cron jobs in many Linux distributions?
  • Which command shows the users currently logged in?
  • In the permission string rwx rwx rwx, what does this indicate for user, group, and others?
  • What does the loop for ((i=0;i<5;++i)); do echo $i; done print?
  • What is the effect of sourcing a file in Bash?
  • If you're looking for a man page for a command and nothing shows up (for example read), which resource should you use?
  • What directory is the root user's home directory?
  • Which characters, if used, indicate you should use single quotes to prevent shell expansion?
  • Which command edits the crontab for the current user?
  • Which statement best describes [[ expression ]] compared to [ expression ]?
  • Which command creates a local variable inside a Bash function?
  • If a diff shows '2,4c2,4', what does this indicate about the change?
  • Which command sends the job with job id 2 to the background?
  • If a script prints an error message to standard error using redirection, what is the conventional exit code to indicate failure?
  • What is the effect of > file.txt 2>&1?
  • What does a %= 5 do to the variable a?
  • Which of the following is a valid use of the 'declare' command when locating PATH?
  • To delete a file, what permissions do you need?
  • In crontab notation, which day of the week does 6 represent?
  • What is special about a negative nice value?
  • Which form supports regex matching within a conditional expression, enabling patterns like a string matching a regex?
  • Which command lists the public keys stored in your GPG keyring?
  • If you encounter an unfamiliar parameter expansion in a Bash script, which manual page should you consult for more information?
  • Which command is used to determine which users have logged into the system?
  • Which two commands disable and then re-enable shell history recording?
  • If you're trying to throw a long command that's been piped multiple times into the background, how should you run it?
  • Which directory provides kernel information via a virtual filesystem?
  • What is the typical purpose of the /tmp directory in Unix-like systems?
  • Which directory is used for variable data such as database files and log files?
  • What does the command 'echo $?' display?
  • What is the purpose of the plus sign in the date command's format specifier '+%F %T.%N %Z'?
  • What prefix is used to run a script located in the current directory when it is not in PATH?
  • What exit value does the command 'true' align with and what does that mean?
  • Which command decrypts an encrypted archive to produce the original tar.gz file?
  • What is another name for a tar.gz file?
  • What does the shell parameter $0 store?
  • What is the standard alternative syntax to 'source filename' that achieves the same result?
  • In Bash arithmetic, what does echo $((++a)) print?
  • What does the shell do when you use > file.txt before a command?
  • Which directory is typically used for user-specific personal workspaces and data?
  • Which command unarchives a tar.gz file?
  • Which directory represents a virtualized filesystem that lets you inspect kernel information from user space?
  • Which command can show the target of a symbolic link in a detailed listing?
  • Which command shows the manual page describing the file format for /etc/fstab?
  • Which command demonstrates starting a process with the default niceness value?
  • What is the default exit value of a command and what does it signify?
  • In the permission string drwxrwxr-x, what does the first character 'd' indicate?
  • What's special about -eq compared to = and == ?
  • Where is the typical location for source code on a Linux system?
  • Which command shows all TCP sockets and the programs that are using them, including listening services?
  • In shell scripting, which of the following is a zero exit code typically indicating success?
  • Which directory contains device files on a Linux system?
  • Which directory is described as the location for user installed binaries (programs)?
  • How do you reference a positional parameter after $9?
  • What does the diff notation '4d3' indicate?
  • Which netstat state indicates the socket is listening for incoming connections?
  • Interpret the crontab line: 3 */1 * 3 6 wall hi. Which statement is true?
  • How would you add write permission for the owner and read/write permissions for the group to bob.txt using symbolic notation?
  • In Bash, which redirection sends both stdout and stderr to the same file?
  • Which key combination stops a foreground process so it can be sent to the background?
  • What is the effect of using >&2 in a command?
  • Where are user directories stored?
  • Which command brings job 1 to the foreground?
  • Which filter shows all TCP and ICMP packets?
  • Which directory stores shared libraries (.so)?
  • What exit value does the command 'false' align with and what does that mean?
  • What is the difference between ${hi:-bye} and ${hi:=bye}?
  • Which expression sets a default value for a variable if it is unset or empty?
  • Which directory stores system binaries (programs)?
  • In the command 'll asdfkjsdfhk > file.txt 2>&1', which streams are written to file.txt?
  • Which command should you run to view the file format information for /etc/fstab?
  • Which command outputs the target path of a symbolic link?
  • In a Bash loop, what does 'continue' do?
  • Which command encrypts a tar.gz archive using the public key associated with Evan?
  • In crontab notation, which month does 3 represent?
  • Which command creates a tar.gz archive from a file named file.txt?
  • In a diff output, what does a line starting with '<' denote?
  • Which line is used at the start of a Bash script to specify the interpreter?
  • What is the effect of using prefix ++var versus postfix var++ in Bash arithmetic expansion?
  • What are the symbols for boolean AND, OR, NOT in Bash and what is notable about their behavior?
  • In a here document, what does the delimiter mark?
Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy