When I execute ps ax command with grep, it' showing a single entry of test.py  test.py was just single print statement submitted like this:    nohup python test.py &amp;    So I'm assuming it didn't take long to run. Should that entry still be there?    $ ps ax | grep test.py 18225 pts/0    S+     0:00 grep test.py
120448
When I'm checking for some process, I usually write  ps aux | grep myprocess   And sometimes I get the output of   eimantas 11998  0.0  0.0   8816   740 pts/0    S+   07:45   0:00 grep myprocess   if the process is not running.  Now I really wonder why grep is in the list of processes if it filters out the output of the ps command after ps has run?
13948
I used which to tell the location of a runnable file. For example, which pwd returns /bin/pwd. However, I found which alias or which compgen etc returns nothing.   What are commands like alias? Aren't they executable files on my Linux? I am using bash 4.3 on Ubuntu.
106013
If script is running fine from command line then, why the same script becomes zombie state after running through cron and How you will troubleshoot the same ?  Here following real example :  [root@abc ~]# ps ax | grep Z 23880 ?        Zs     0:00 [checkloadadv.sh] &lt;defunct&gt; 23926 pts/0    S+     0:00 grep Z [root@abc ~]# strace -p 23880 attach: ptrace(PTRACE_ATTACH, ...): Operation not permitted [root@abc ~]# pstree | grep  checkload init-+-crond---crond-+-checkloadadv.sh [root@abc ~]# bash /usr/bin/checkloadadv.sh System Load is OK : 0.05
61254
Suppose I have an alias in the bash shell. Is there a simple command to print out what command the alias will run?
99676
I didn't see any hits about this on google, so I'm asking you:  I just tried to run this command in an ssh session, local is Debian Wheezy KDE, remote is Fedora 21 Gnome:  ps aux | grep xscreensaver   and this is the output:  bash:  grep: command not found...   I never seen this before, what is the cause?  I just few hours before updated the system, but didn't see any packages marked for removal. There are only two users on the system, and only me installs or removes software on it.  EDIT #1  Here is the commands and output copied,notice that the space is not there the second time:  [root@Hostname ~]# ps aux |  grep xscreensaver bash:  : command not found... [root@Hostname ~]# ps aux | grep xscreensaver bash:  grep: command not found...
35834
I ran this command to try and get my python program to run in the background and let me exit the SSH connection I am using:  nohup python files.py &gt;&gt; files.log &amp;   I then check ps to check it worked   $ ps a   PID TTY      STAT   TIME COMMAND 13059 pts/0    Ss     0:00 -bash 13327 pts/0    R+     0:00 ps a [1]+  Exit 1                  nohup python files.py &gt;&gt; files.log   What does this [1]+  Exit 1 mean?  And how can I run my program in the background letting me exit correctly?
54667
I just wanted to ask whether there is any command which would work on common shells (bash, dash, kornshell)? It is supposed to check if the line variable contains any part of the path.  if [[ $line =~ "$PWD"$ ]] ;then
98883
Why is this?  When I do this   CD ~/Desktop   It doesn't take me to the Desktop. But this:  echo "foo bar" | GREP bar   gives me:  bar
55481
I saw this one-liner recently:  $ ps -ef | grep [f]irefox   thorsen   16730     1  1 Jun19 ?        00:27:27 /usr/lib/firefox/firefox ...   So it seems to return the list of processes with "firefox" in the data but leaving out the grep process itself, and therefore seems roughly equivalent to:  ps -ef |grep -v grep| grep firefox   I can't understand how it works though. I've looked at the man page on grep and elsewhere but haven't found an explanation.  And to compound the mystery if I run:  $ ps -ef | grep firefox  &gt; data $ grep [f]irefox data  thorsen   15820 28618  0 07:28 pts/1    00:00:00 grep --color=auto firefox thorsen   16730     1  1 Jun19 ?        00:27:45 /usr/lib/firefox/firefox ....   the [t]rick seems to stop working!  Someone here will know what's going on I'm sure.  Thanks.
19648
abhigenie92@ubuntu:~$ (sleep 2; echo $BASH_SUBSHELL ;sleep 2) 1 abhigenie92@ubuntu:~$ (sleep 2; echo $BASH_SUBSHELL ;sleep 2)&amp; [1] 3297 abhigenie92@ubuntu:~$ 1  [1]+  Done                    ( sleep 2; echo $BASH_SUBSHELL; sleep 2 )   What happens when launch it as a background process, why don't I get the prompt back and I have to press Enter? In both cases it launches a child shell.
81757
I have cobbled together a command to return the process ID of a running daemon:  ps aux | grep daemon_name | awk "{ print \$2 }"   It works perfectly and returns the PID, but it also returns a second PID which is presumably the process I'm running now. Is there a way I can exclude my command from the list of returned PIDs?  I've tested it a few times and it appears my command is always the second PID in the list, but I don't want to grab just the first PID in case it's inaccurate.
81463
I am currently using this command to get some information about some specific processes:  ps -C beam.smp -o pid,user:20,%cpu,%mem,args   As I use it for two process names, I would like to do it in one command in order to get a snapshot. Like that:  ps -C beam.smp,docker -o pid,user:20,%cpu,%mem,args   The problem is that the output does not display a specific column with beam.smp or docker, which would be really useful for me. How could I get a new line in my output showing that?
92786
Why do brackets in a grep pattern remove the grep process from ps results?  $ ps -ef | grep XXXX  [...] XXXX [...] grep XXXX   $ ps -ef | grep [X]XXX  [...] XXXX
86279
Here is the behaviour I want to understand:  $ ps   PID TTY           TIME CMD   392 ttys000    0:00.20 -bash  4268 ttys000    0:00.00 xargs $ kill 4268 $ ps   PID TTY           TIME CMD   392 ttys000    0:00.20 -bash [1]+  Terminated: 15          xargs $ ps   PID TTY           TIME CMD   392 ttys000    0:00.21 -bash   Why does it show the [1]+  Terminated: 15          xargs after I kill a process, instead of just not showing it as it was just killed?  I'm using bash on Mac OS X 10.7.5.
4984
Sometimes the output of ps -p $$ shows the absolute path to the currently-running zsh,  % ps -p $$   PID TTY           TIME CMD  1027 ttys005    0:00.11 /usr/local/bin/zsh   but not always:  % ps -p $$   PID TTY           TIME CMD  1507 ttys003    0:00.07 zsh -fl   What is a consistent way to get the path to the currently-running zsh?  EDIT (clarification): I'm interested in how to do this primarily in Darwin and Linux, but also in NetBSD.
5312
I thought I heard that  was able to do this, but I never figured it out.  Has anyone successfully done this?  Can I see your setup.py file, and what command line options you used?  Basically I'm thinking of it giving me a single executable file that does something like unzips itself to maybe /temp and runs.
110061
To output all lines into a file /tmp/ps.txt  $ ps -e &gt;/tmp/ps.txt       To count it with wc -l  $ wc -l /tmp/ps.txt 172   To count it without exporting a file.  $ ps -e | wc -l 173   Why ps -e | wc -l  get one more line?  I don't think  for my question.  $ echo "test" | wc -l 1   Please try it in your terminal, it would yield 2 as .