Linux Professional Institute BSD Specialist Questions and Answers
Question 17
Which command shows all processes owned by the user bob?
Options:
A.
who -1 bob
B.
pgrep -u bob
C.
ps -o -a bob
D.
top bob
E.
last -p bob
Answer:
B
Explanation:
Explanation:
The pgrep command is used to find processes by various criteria, such as user name, group name, process ID, command name, etc. The -u option specifies the user name or user ID to match. Therefore, the command pgrep -u bob will show all processes owned by the user bob. The output will be a list of process IDs, one per line. To show more information about the processes, such as command name, arguments, state, etc., the -l, -a, and -f options can be used. For example, the command pgrep -l -u bob will show the process ID and the command name for each process owned by bob. References:
pgrep - FreeBSD, the manual page for the pgrep command on FreeBSD.
How to use pgrep and pkill commands in Linux - Linuxize, a tutorial on how to use the pgrep and pkill commands in Linux.
Question 18
A file called mybackup is found while investigating a USB pen drive. Which utility can be used to determine the kind of data that is contained in that file?
Options:
A.
file mybackup
B.
Is -1 mybackup
C.
tar -t mybackup
D.
whatis mybackup
E.
touch mybackup
Answer:
A
Explanation:
Explanation:
The file command is used to determine the type of data contained in a computer file. It performs a series of tests on the file and prints a description of the file type based on the first successful test. The file command can take one or more file names as its arguments. For example, file mybackup will display the file type of mybackup. The other options are not valid commands for finding the file type. References: