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.

OSCP Linux Practice Exam course image
More practice questions

These questions are part of the practice quiz. Start practicing

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

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy