I'm redirecting results for something into a file and I also need to find the process name and ID number and redirect it to the file as well. I'm guessing the process name is the command in which I'm directing the results to. As in if the command is
pgrep sshd and I redirect the results to the file,
pgrep sshd would be the process name. I'm just curious though how exactly I find the process ID number and what would be the simplest way to redirect it to a file if there is a command to find it.
Here is the original objective I was given, I'm sorry if I seem really new at this, I am a student.
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
~/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