Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [ps]

ps is a command for printing information about running processes

1
vote
1answer
41 views

ps is not showing all processes

I used the script command immediately after I started the terminal, it started recording my current session but when i used ps command after that it is showing only two processes, one for bash and one ...
4
votes
1answer
197 views

How can I use `--lines` `--row` modifiers in `ps` command

I often used the following command, ps -eo pid,cmd,pcpu,pmem --sort=-pcpu | head But in the man page I saw the following to output modifiers, --lines n Set screen height. --rows n ...
-1
votes
1answer
28 views

Only USERID, PID, TIME, and COMMAND for specific user Shell Script

I have to get Only USERID, PID, TIME, and COMMAND for a specific user. I have tried ps -u user1 But that display PID TTY TIME CMD, but I dont want the Field TTY.
0
votes
2answers
46 views

What exactly does `ps -p PID` do that `ps -q PID` does not?

According to man ps: -p pidlist Select by PID. This selects the processes whose process ID numbers appear in pidlist. Identical to p and --pid. -q pidlist ...
0
votes
3answers
34 views

How can I parse the output of `ps` to different fields?

I would like to parse the output of ps, to get any field using awk. It seems that ps separate the fields by whitespaces, but the values in COMMAND field usually have whitespaces. Is there a way to ...
0
votes
1answer
40 views

How can I logically AND two selection conditions in ps?

I am simulating the default behavior of ps without arguments: One selection condition is to find processes with controlling terminal being the same as the one of the current shell. The other ...
0
votes
2answers
29 views

How can I find out the Screen server process?

Does GNU Screen have a server-client architecture model? Is each Screen session a Screen client process? Why can't I find out the Screen server process, but only its session processes i.e. ...
0
votes
0answers
28 views

How to list all NEW running processes? [duplicate]

How to do something like akin to "tail -f" on ps ? In other words I would like to see the list of newly created processes, as they get created. I don't think top/htop can to that. Bonus if it shows ...
3
votes
1answer
78 views

The `PRI` column of `ps` is inconsistent with man pages

I've been trying to understand how scheduling priorities work in linux. Here's what I've got: The kernel uses a priority value for each process which ranges from 0 to 139. The lower the number, the ...
0
votes
1answer
32 views

find process 0 in ps tree

I read the following sentence from an instruction Process ID 0 is usually the scheduler process and is often known as the swapper. No program on disk corresponds to this process, which is part of ...
3
votes
4answers
182 views

Get list of processes that were forked off my currently running process?

I am writing a wrapper application to bash scripts and want the application to keep a track of which tools/processes have been launched from user scripts. I would like to know what is the best way to ...
0
votes
1answer
28 views

Process state characterization in output of ps command

The ps command shows the state of the process (e.g. Sleeping, Running etc) as also some additional info about. Among two of these additional options according to the man page are < high-...
0
votes
1answer
57 views

Intepretation of -x and -a flags in ps command

According to the man page of ps command, the x flag Lift the BSD-style "must have a tty" restriction, which is imposed upon the set of all processes when some BSD-style ...
4
votes
1answer
97 views

Determine all processes running by root with 2 columns showing: pid,cmd

What I did: ps -ax -o pid,cmd,user | grep root but this shows me on 3 columns showing the root inclusive, how do I eliminate the "root" column?
0
votes
1answer
17 views

00001 root /sbin/launchd

When check the pstree $ pstree -g 2 -p $$ | sed "s/$USER/me/g" ─┬◆ 00001 root /sbin/launchd └─┬◆ 00277 me /Applications/Utilities/Terminal.app/Contents/MacOS/Terminal -psn_0_40970 └─┬◆ 00360 root ...
1
vote
1answer
25 views

Unable to see agetty ttyS0 in process list when connected with serial console

I am using ttyS0 as a serial console to connect to a redhat linux, which is setup using /etc/init/ttyS0.conf. When I am connected to serial console, could not find agetty process however sees a bash ...
0
votes
1answer
46 views

Formatting ps output based on given parent/child processes

Given a list of process names, I want those parent/child processes to not appear in the output of a ps --forest call. This will reduce the processes that I need to look at when I'm tracking things.
0
votes
1answer
31 views

How to record PID and its command every 15s?

For troubleshooting purpose, I'd like to record PID and its command every 15s and write them to a text file. The desired output: TimeStamp, PID, Command
7
votes
1answer
136 views

Why would ps *very* occasionally fail to find a valid process?

I've run into an odd issue in which a ps -o args -p <pid> command very occasionally fails to find the process in question, even though it is definitely running on the server in question. The ...
3
votes
1answer
383 views

ps -a fails to find a process which is running

I could find a process named typora from htop but I cannot trace it from ps or pstree $ ps -a | grep -i typora 9696 ttys003 0:00.01 grep -i typora $ pstree | grep -i typora | |--- 09713 ...
0
votes
1answer
24 views

Upgrade to local ps command to the latest

I am monitoring the process with us on macos $ ps -f UID PID PPID C STIME TTY TIME CMD 501 367 366 0 Sun06AM ttys000 0:00.21 -bash 501 1814 1812 0 Sun06AM ttys001 ...
2
votes
1answer
54 views

The counterpart of ps --forest in BSD

I tried to explore the bash on macOS using the process, $ ps --forest ps: illegal option -- - usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]] [-g grp[,grp...]] [-u [...
0
votes
2answers
41 views

Search for running script PID by script name

I have the following script hello.sh -------- while : do echo "hello" sleep 20 done And when I ran the above script, I got 2627 as the PID of the script root@localhost ~]# ./hello.sh & [...
-1
votes
2answers
29 views

analyzing ps|wc output

First - i wanted to know how many process are currently running so i used this command: $ ps | wc i was expecting to one number, but the output was: 20 115 844 Three numbers were printed - with ...
0
votes
0answers
15 views

Understanding how PS command works in Linux [duplicate]

I want to understand how PS command works internally in Linux . where does it gets the value of PID and TTY and CMD ? how does it computes the time ?
-1
votes
1answer
37 views

Return single instance of multiple patterns from grep command

I have the output of a ps -ef command that returns hundreds of lines, and I need to grep for a pattern that is mostly identical, except for the number at the end, and have a single instance of each ...
0
votes
2answers
54 views

ps command the program name

Is there a way to display the program name? Like in windows when you open the task manager, it will display the program name instead of the directory under COMMAND EDIT: Commands I used so far ps ...
1
vote
1answer
36 views

How to log a process's uptime and restarts

I know that I can check a process's uptime with the following: ps -o etime= -p "PID" where PID = pid number. I would like to write to a log when this process ends, and include it's uptime. The ...
2
votes
2answers
148 views

From where is my script started on reboot

Before some days I wrote a script and put it somewhere to get it started automatically on booting on my raspberry with wheezy. ps -ax gives me: 2041 ? S 0:00 /usr/sbin/apache2 -k start ...
2
votes
1answer
111 views

Among these two in my ps output, which real-time process will be preempted over the other by linux?

I have got some idea from: https://stackoverflow.com/questions/8887531/which-real-time-priority-is-the-highest-priority-in-linux about how the real time priority values assigned to different ...
0
votes
1answer
30 views

Why pdftops gives extra padding but pdf2ps doesn't?

I tried both pdftops and pdf2ps to convert a pdf figure(no text) into eps. pdf2ps created a ps figure same to the original one, but the ps file produced by pdftops contains an extra white padding/...
6
votes
1answer
236 views

How shall I generate a pdf file instead of a ps file using enscript?

I was wondering why the following generates a ps file not a pdf file? How can I make it generate a pdf file? Thanks. $ enscript -B -PPDF code/bloom.c -o bloom.pdf [ 2 pages * 1 copy ] left in bloom....
0
votes
0answers
20 views

How long does my Java process run? [duplicate]

@11.3.92.203 $ ps -o etime= -p "55548" 18:19:07 @11.3.92.203 $ ps -o stime,time $$ STIME TIME 08:40 00:00:00 Does this mean my process has running for >18 hours? What about the output of ...
0
votes
1answer
58 views

ps options help, how to report a truncated list of processes sorted by desired columns

Just discovered ps. Spent about 20 minutes reading through the man ps, testing out different options, but only found myself both more intrigued and deeply perplexed by the options. The ordinality and ...
0
votes
1answer
353 views

“error: process ID list syntax error”

I have bash a script that logs in to a remote server, and checks for the number of instances of a desired script script.py running on that server, and subsequently echoes the total memory consumed by ...
1
vote
1answer
188 views

How to pass PID of one process to another process within the same shell script?

Okay, so this might be a very silly question and I don't write shell scripts too often. I'm trying to start 3 processes in the background, one after the another within a shell script, for example: #!/...
4
votes
1answer
283 views

Unrecognized process state output in ps command

Running ps aux in an Ubuntu 18.04 I see some processes having state I, as in... root 1 0.0 0.0 225520 9144 ? Ss 10:36 0:02 /sbin/init splash root 2 0.0 0.0 0 ...
0
votes
1answer
34 views

How does ps measure %CPU per process (and can this be changed?)

When doing ps -r -e -o pcpu=,comm=, the % CPU displayed per process, over how long time is this value measured? Is it one second? The manual page does not seem to mention this. And a follow-up ...
0
votes
1answer
285 views

“Killing” a zombie defunct process without killing its parent

I know there are hundreds of questions on "How to kill a defunct process" but in all of those I found the final answer was: "Don't worry. They don't use any resources." and that basically you either ...
0
votes
3answers
226 views

Does `ps` provide the working directory of each process?

Is it correct that the output of jobs contains the working directory when invoking each job (not necessarily the current working directory of each job)? $ jobs -l | grep JDBC [15] 20422 Running ...
-3
votes
1answer
73 views

Is pstree available on all Unices and Linux operating systems? [closed]

Is it a standard command that I can be assured is available on all standard-conformant operating systems? If so, what is the guarantee given by the relevant standard? Is it, conversely, a non-...
1
vote
1answer
23 views

How to know which script/binary/other running process?

From ps -ef | grep java, I see many process like this that take a lot of memory. hadoop-+ 65369 65322 0 Jul06 ? 00:01:45 /usr/jdk64/jdk1.8.0_112/bin/java -Xmx8024m -Dhdp.version=2.6.4-091 -...
3
votes
0answers
151 views

How can `cat /proc/$pid/cmdline` take several seconds?

I encountered this strange behavior yesterday on one of our servers. ps, pgrep and htop (on startup) were very slow. strace ps showed that read('/proc/$pid/cmdline) took several seconds on some ...
2
votes
1answer
857 views

ps: get short command name and elapsed time

I am on a Debian 8 System trying to determine the processes and their respective runtime of a certain user: $ ps -u <user> PID TTY TIME CMD 26038 ? 00:00:00 php5-fpm 26052 ? ...
0
votes
2answers
84 views

Using `pgrep` to emulate `ps -ef` for use in a `for i in` loop

Ubuntu 16.04 I am used to using this command line to kill any process match said COMMAND for i in $(ps -ef | grep COMMAND | awk '{ print $2 }'); do kill -9 "$i" &>/dev/null;done shellcheck ...
1
vote
0answers
23 views

Understand kernel task names [duplicate]

If I have something like this: root 27 0.0 0.0 0 0 ? S 04:06 0:00 [migration/3] root 28 0.0 0.0 0 0 ? S 04:06 0:00 [ksoftirqd/3] root ...
0
votes
1answer
34 views

Will there ever be processes that are shown by ps -ef and not ps -e?

I was under the impression that ps -e as root will display every process but several coworkers have claimed that the -ef flag is needed. The man page seems to indicate that all -f changes is ...
5
votes
2answers
1k views

Makefile: kill a process if it is running

I have a makefile like this, that kills a process if it's already running, test: client server pgrep myserver && killall myserver /build/bin/myserver --background /build/bin/...
13
votes
3answers
763 views

Why doesn't “ps ax” find a running bash script without the “#!” header?

When I run this script, intended to run until killed... # foo.sh while true; do sleep 1; done ...I'm not able to find it using ps ax: >./foo.sh // In a separate shell: >ps ax | grep foo.sh ...
-1
votes
1answer
22 views

How can i achieve pstree -sup $$ just with ps?

how can i achieve pstree -sup $$ just using ps? Tried ps h -a -o pid,user,comm= $$ but can't figure it out, how to get the "process-chain"... Do I need a shell-script for it? Thx Johnny