Give the complete command line to show processes whose PID is 1 or parent PID is 1 in Linux
ps is command to list all process.
command to show process whose PID is 1 is ps -p 1 or ps --pid 1 (you can use any of these)
and command to show process whose parent PID is 1 is ps -ppid 1
I'll illustrate this for you to understand. Even if you have any doubt regarding commands you can always find this by yourself by refering help command.
refer below screenshot:
run
ps --help list
![~$ ps --help list Usage: ps [options] Selection by list: -C <command> command name -G, --Group <GID real group id or name -g,](http://img.homeworklib.com/questions/15675c10-722e-11eb-ad0d-a75c03be898a.png?x-oss-process=image/resize,w_560)
so you can see the mark result how to use process id and parent process id.
run ps --pid 1 result attached below

run ps --ppid 1, result attached below

you can always refer ps --help <simple|list|output|threads|misc|all> for more options for this command.
Hope it helps. Please give feedback, if this answer helped resolved your query.
Happy to help you. Keep learning.
Give the complete command line to show processes whose PID is 1 or parent PID is...
Process Management in Linux Use the “ps” command to get a snapshot of current running processes. i) Use “ps ” to get all processes ii) Use “ps -f” to get more details iii) What is the PID of your "bash" process? iv) Use pgrep or “| grep” to search for “bash” Please provide screenshots
Using a Linux command-line interpreter, show the screenshots for executing the following commands: (1) display the current working directory, (2) list the contents of a directory, (3) change directory, (4) create a directory, (5) clear the screen, (6) copy a file from a directory into another directory, (7) delete a directory, (8) delete a file, (9) report information for a single process or set of processes, and (10) report a real-time statistics for current processes.
Write an SQL command to remove all dependents whose parent(s) are not supervisors.
Source code to modify:
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
int main()
{
pid_t pid;
/*fork a child process*/
pid = fork();
if (pid<0){ /*error occured*/
fprintf(stderr,"Fork failed\n");
return 1;
}
else if (pid == 0) { /*child process */
printf("I am the child %d\n",pid);
execlp("/bin/ls","ls",NULL);
}
else { /*parent process */
/*parent will wait for the child to complete*/
printf("I am the parent %d\n",pid);
wait(NULL);
printf("Child Complete\n");
}
return 0;
}
1. Write program codes for 3.21 a and...
LINUX! In shell scripting if possible and show commands (please do not copy codes form others) Thank you! Write a simple test program to find out PIDs of ALL ancestor (i.e., parent, grandparent ) processes of the current process or a given process specified by a PID. A parent process's PID of a given process pid can be found in /proc/$pid/status
On your Fedora Linux virtual machine, switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the terminal using the user name of root and the password of LNXrocks!. At the command prompt, type sleep 6000 and press Enter to start the sleep com- mand, which waits 6000 seconds in the foreground. Do you get your prompt back after you enter this command? Why? Send the process an INT signal by typing theCtrl+c key combination. At the...
e. Write a command to search all the files in your parent directory whose name is starting from a number in between 9 to 10. (0.75)
On your Fedora Linux virtual machine, switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the terminal using the user name of root and the password of LNXrocks!. At the command prompt, type ps –ef | grep bash and press Enter to view the bash shells that are running in memory on your computer. Record the PID of the bash shell running in your terminal (tty2): . At the command prompt, type kill –l and press...
Write separate programs, as described below, that create 7 processes according to the parent/child hierarchy shown on the right, where P0 is a parent to P1 and P2, etc.Before each parent terminates, it must wait until all of its children have terminated.When created, every process should print its index (0 – 6), its PID, and its parent’s PID. Each process does no work and prints a message indicating when it is done. In your report, include your program output and...
Linux command 1. Use the command to record size of all directory present on the desktop of your Linux operating System? 2. Use a command line to retrieve following information on your Ubuntu Linux operating system?