Questions tagged [ps]

ps is the UNIX command for retreiving process information.

From the Linux User's Manual:

DESCRIPTION
   ps displays information about a selection of the active processes.

By default, ps displays the current processes owned by the user executing the command and attached to the same process group as the shell that launches it. On most UNIX systems, the command
ps -A (or ps -e) will display information about all processes running on the system.

See also:
[unix] tag info
[process] tag info
[fork] tag info


  • For questions about the Postscript language, please use the tag instead.
  • For questions about the windows power shell, please use the tag instead.
585 questions
0
votes
5 answers

Removing part of a line? [bash]

I'm writing my own ps-command in bash, but i'm having some trouble getting cmdline. This is my code: get_cmdline(){ if [ -f "/proc/$1/cmdline" ]; then cat /proc/$1/cmdline | cut -d " " -f 1 else echo n/a fi } But this is what i'm…
bitspuke
  • 39
  • 7
0
votes
0 answers

Java code to get data from process control block

i need to work with Process control block of each individual process. Is there any chance to get data from PCB using java code? Thanks in advance
user4162105
0
votes
2 answers

Sed removes matches from output

I'm trying to extract the process numbers starting with the number 3. When using ps | sed "/^\s\+3/", I get an error message : sed: -e expression #1, char 8: missing command I then added a global flag : ps | sed "/^\s+3/g" which succeeds but instead…
Corb3nik
  • 1,177
  • 7
  • 26
0
votes
2 answers

Nonzero CPU% in Linux

I want to exclude processes with CPU=0.0 from result of ps aux command. Is it possible without any perversions (such as grep)?
Bred
  • 11
  • 5
0
votes
1 answer

How to Implement a single program in C that replicates the following Unix command(s): ps -ef | grep YOUR_USER_id | wc

My teacher gave us a practice assignment for studying in my Operating Systems class. The assignment was to pipe three processes together and implement the commands in the title all at once. We are only allowed to use these commands when implementing…
ANIME4154142
  • 3
  • 2
  • 5
0
votes
1 answer

php exec('ps -aeo') doesn't return all processes

I'm trying to build a simple php script to return a JSON formatted list of running processes. This script of course is executed by apache. I have everything figured out except one little detail. When the script is executed by apache the command only…
Sean256
  • 2,849
  • 4
  • 30
  • 39
0
votes
3 answers

Capture historical process history UNIX?

I'm wondering if there a way of capturing a list of the processes executed on a non-interactive shell? Basically I have a script which calls some variables from other sources and I want to see what the values of said variables are. However, the…
Huskie69
  • 795
  • 3
  • 11
  • 31
0
votes
2 answers

How to find a unix process in Python

I would to find if the output of 'ps' command contain the process 'smtpd' The problem is that various busybox need different ps command! some need ' ps x ', other need ' ps w ' and other only the ' ps ' How i can make a universal algorithm that try…
rocherz
  • 31
  • 1
  • 2
  • 7
0
votes
1 answer

fetch the value of number of active threads in a process

I am trying to fetch the number of threads of a process in a UNIX using command line. After going through the man page of unix command, I learnt that following command: ps -o nlwp returns the number of threads spawned in a process. Whenever i…
Ritesh Kumar Gupta
  • 5,055
  • 7
  • 45
  • 71
0
votes
1 answer

TTY says ? on ps -p command

I am running on a python script on Putty using & at the end of the command. When I checked ps -p processid, it showed some name under TTY. After some time internet got disconnected. After connecting back, I check the process status using ps -p…
blackmamba
  • 1,952
  • 11
  • 34
  • 59
0
votes
0 answers

Minix 3 Number of processes

I'm working in a Unix-Like Kernel called Minix 3. I am having some trouble creating a function within the kernel that will allow me to output the number of processes being run. This is my code I have so far: PUBLIC void numproc_dmp() { …
Gamme40
  • 33
  • 6
0
votes
2 answers

Suppress warning give in ps command output

When I run the ps command i get a warning saying "Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ" How do i suppress this warning? Is there some system setting that i must do for this. The command that i fire is…
user2318314
  • 113
  • 2
  • 12
0
votes
1 answer

Previous running processes

I need to see the processes that were running on my systems (Ubuntu, OpenWRT, Fedora) at a specific time. The only way that I am aware of is "ps" which gives me a current snapshot.
Aman
  • 1,157
  • 7
  • 13
0
votes
2 answers

Need to execute "ps -ef | grep amq | awk '{print $(NF-1)}' " command in C++

I am writing a c++ code in my project that should tell whether my websphere mq server is running or not. In order to extract that we need to run "/opt/mqm/bin/amq status" to show whether it is running or not.Tricky thing is MQHOME=/opt/mqm is not…
0
votes
2 answers

How to control a script is not already running?

I have a shell script executed by cron and I want to control that it's not already running. This is my control test: set -A processes ps -elf | grep -v grep | grep -E "/bin/ksh.+scriptName" | while read line ;do…
user1334149
  • 161
  • 1
  • 7