0

Right now what I'm doing is redirecting the output of pgrep sshd to a file, and what I'm being asked to do is print out the process name next to the process ID number. How exactly do I find the process ID number and the process name, if it isn't pgrep sshd? I just want to know how to find it, I've tried researching this but I feel like I'm not getting a clear answer.

The objective I was given : Man pages usually have a helpful section near the end called "SEE ALSO" that you can use to find a list of commands and topics related to the command that the current man page is about. Use this feature to locate a command related to "ps" that will search for processes based on some criteria. Use this command to locate all processes called sshd, directing the output to a file named processes.txt in ~/sysadmin1, making sure that the command also prints out the process name next to the process ID number. You will have to specify a flag with the command that you find in the man page for the command in order to do this. When you have finished add the full command used to the top of the processes.txt file.

1 Answers1

0

What you are tasked with is probably to find the pgrep command and use it with -l option and then redirect the output to a file.

E.g. pgrep -l sshd > ~/sysadmin1/processes.txt

From man pgrep: ... -l, --list-name list PID and process name

marekful
  • 14,986
  • 6
  • 37
  • 59