Free OSCP Linux Questions and Answers — Questions and Answers
Question 1: How should a lengthy command that has been piped numerous times and contains multiple instructions be executed in the background? <br> Answer: It must be enclosed in parenthesis, and at the end, the & must appear outside the parenthesis (commands; commands | commands) &.
- TRUE (Correct answer)
- FALSE
Correct answer: TRUE
To execute a lengthy command pipeline or sequence of commands in the background in Linux, the entire sequence must be grouped together. This is achieved by enclosing the commands in parentheses `()` and then appending an ampersand `&` outside the closing parenthesis. This ensures that all commands within the pipeline or sequence are treated as a single job and sent to the background, allowing the terminal to be used for other tasks.
Question 2: What makes using -p with netstat unique? <br> Answer: Like echo, it lets you print to the screen, except it writes actual text rather than ignoring single and double quotes. Additionally, you may use it to input a line of instructions into an application like ssh or cat.
- TRUE
- FALSE (Correct answer)
Correct answer: FALSE
The description provided for `netstat -p` is incorrect. The `netstat -p` command is used to display the PID (Process ID) and program name associated with each network connection. It does not function like `echo` for printing text or for inputting instructions into applications; its purpose is specifically to provide process information related to network sockets.
Question 3: Where .so (Library file, stands for "shared object") are stored (basically like Windows .dll files).
- /lib (Correct answer)
- /boot
- /etc
- /bin
Correct answer: /lib
In the Linux file system hierarchy, the `/lib` directory (or `/usr/lib` for non-essential libraries) is where shared libraries, often ending with the `.so` extension (shared object), are stored. These files are analogous to `.dll` files in Windows and contain code that can be used by multiple programs, allowing for efficient resource sharing and modularity across the system.
Question 4: Linux file system that is virtualized and gives you access to the kernel's perspective
- /dev
- /sbin
- /var
- /proc (Correct answer)
Correct answer: /proc
The `/proc` file system in Linux is a virtual file system that provides a dynamic interface to the kernel's internal data structures and processes. It doesn't contain traditional files but rather real-time system information, including details about running processes, kernel parameters, and hardware. This allows users and programs to access the kernel's perspective and monitor system status.
Question 5: The location of the log files.
- ctrl + c
- /var/log (Correct answer)
- /etc/crontab
- /etc/fstab
Correct answer: /var/log
In the Linux file system, the `/var/log` directory is the standard location for storing system and application log files. These logs contain records of system events, errors, warnings, and other operational data, which are crucial for troubleshooting, security auditing, and monitoring system performance. This centralized location helps administrators manage and review system activity efficiently.
Question 6: File for creating cron jobs.
- /var/log
- /etc/fstab
- /etc/mtab
- /etc/crontab (Correct answer)
Correct answer: /etc/crontab
The `/etc/crontab` file is a system-wide configuration file used to schedule cron jobs, which are automated tasks that run at specified intervals. This file defines the commands to be executed and their respective schedules, allowing system administrators to automate routine maintenance, backups, and other operations without manual intervention. It's a central point for managing recurring system tasks.
Question 7: Where system binaries (programs) are stored
- /dev
- /sbin (Correct answer)
- /etc
- /usr
Correct answer: /sbin
The `/sbin` directory (short for 'system binaries') in Linux contains essential system administration binaries that are typically used by the root user for system maintenance and management. These programs are crucial for booting, restoring, and repairing the system, and are distinct from user-level binaries found in `/bin` or `/usr/bin`, which are for general user commands.
How should a lengthy command that has been piped numerous times and contains multiple instructions be executed in the background?
Answer: It must be enclosed in parenthesis, and at the end, the & must appear outside the parenthesis (commands; commands | commands) &.