$BASHPID And $$ differ in some cases
I’m reading “BASH pocket guide of Oreilly”.
It said:
I’m reading “BASH pocket guide of Oreilly”.
It said:
I’ve noticed, that all mate-terminal instances I start, be it inside a mate-terminal or via a link button, have the same PID.
I start a new process from GNOME Terminal and then this process fork a child.
But when I killed the parent process the orphaned process’s parent id became something other than 1 which represent init --user pid.
When I do this in virtual terminals, the parent pid is 1 which represent init process.
How can I execute new process from GNOME Terminal so that when it is died, the child process’s parent pid became 1 and not pid of init --user process?
Thanks a lot.
In general, does a user have to log in to run a process and become its owner (ruid, or euid)? Does this apply to any user or any non-root user?
For example:
recently I had to clean up a hacked server. The malicious process would appear as “who” or “ifconfig eth0” or something like that in “ps aux” output, even tough the executable was just a jumble of letters, which was shown in /proc/[pid]/status .
For a given process in /proc/<pid>/smaps, for a given mapping entry what are:
If the current user only has execute (–x) permissions on a file, under which user does the interpreter (specified by #!/path/to/interpreter at the beginning of the file) run?
Suppose I have a thousand or more instances of any process (for example, vi) running. How do I kill them all in one single shot/one line command/one command?
I found that pidstat would be a good tool to monitor processes. I want to calculate the average memory usage of a particular process. Here is some example output: