Linux Process Management 1. Write a command that will display the value of the P
ID: 3723008 • Letter: L
Question
Linux Process Management
1. Write a command that will display the value of the PATH variable, insert the output of the
command below it
2. Write a command that will add the directory ~/.bin to the end of your path. Insert the
output of the command below it
3. Write a command that will display the name of every file on the Linux system where the
file content contains the string "Tom Snyder". The command must run in the background, and
must redirect standard error to /dev/null. Insert the output of the command below it
4. Write a command that will display the process ID number and total CPU time for each process
on the system. Insert the output of the command below it.
Explanation / Answer
1. $PATH will give the value of the path variable. Using the pipe operator (|) the output can be forwarded to the next command, that is,
$PATH |
2. Use the export command to modify PATH, enter:
export PATH=$PATH~/.bin
3. You can use the ls command to list the files using wildcard characters. A period . is a wild card, allowing you to substitute for <anything>. The * will let you repeat it 0 or more times.
ls *Tom Snyder*
4. To get the pid of a Running-Program
pgrep:
pgrep [options] pattern
DESCRIPTION : pgrep looks through the currently running processes and lists the process IDs which match the selection criteria to stdout. All the criteria have to match. For example,
To find process named sshd owned by root.
$ pgrep -u root sshd
List the processes owned by root OR daemon.
$ pgrep -u root,daemon
pidof:
DESCRIPTION:
Pidof finds the process id's (pids) of the named programs. It prints those id's on the standard output.
syntax: pidof program_name
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.