183k views
3 votes
Write a Bourne Shell function called “psuser” that will display the processes running on the process status list for the System Administrator / Super User, redirecting the output to the filename psuser.out.

1 Answer

7 votes

Final answer:

To create a Bourne Shell function called 'psuser' that lists processes for the Super User and redirects output to a file, use the ps command with specific flags to filter for root processes, redirecting the output using the '>' operator.

Step-by-step explanation:

The question involves writing a Bourne Shell function named psuser which has the aim of showing the processes currently running on the system for the Super User. This function should also redirect the output to a file called psuser.out. Here is a simple example of what the function might look like:

psuser() {
ps -U root -u root u > psuser.out
}

This function uses the ps command to display the processes run by the Super User, commonly known as 'root'. The '-U' flag specifies the effective user ID to be listed, and the '-u' flag repeats this for user names. The 'u' option tells 'ps' to provide detailed user-oriented information. The output is then redirected into the file named psuser.out.

User Roychri
by
8.2k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.