Many processes continue after closing Applications

OpenSuse 13.1 x86_64 with updates

Hi all, have you come across this on OpenSuse 13.1? Take a look at Applications > System > System Monitor, then look at the process table.

This system shows

10 Gwenview Processes
2 Gimp 2.8
4 Okulars
1 Showfoto
1 krita
1 sharpen
1 unsharp-mask
1 deinterlace

All of these Applications have been closed and have no windows open. The Gimp processes along with sharpen, unsharp-mask and deinterlace probably come from my attempts to edit a photograph. Should they still be running?
Krita and Showfoto were used for a short time and then closed. Gwenview and okular are used frequently to look at image files. Naturally these processes all use memory and will continue to do so until they are killed off.

An thoughts on this?

Many other processes in the Process Table look normal, as far as I can tell.

No, I haven’t come across this.

As a test, I started dolphin. Then I opened several image files (uses “gwenview”). Then I closed the images and dolphin.

Then I looked with system monitor (ksysguard) and with “ps”. I did not find any “gwenview” processes running.

I’m merely providing a data point here for comparison. I do not know what is going wrong on your system.

In Konsole I get the below. It seems to indicate one Okular and one Gwenview process.

linux-rz2v:/home/brm # ps aux | grep okular
root 9771 0.0 0.0 10520 928 pts/0 S+ 11:49 0:00 grep --color=auto okular
linux-rz2v:/home/brm # ps aux | grep gwenview
root 9829 0.0 0.0 10520 928 pts/0 S+ 11:50 0:00 grep --color=auto gwenview
linux-rz2v:/home/brm #

Hi
No, those are just the grep commands. Maybe you have some zombie processes which can check with the ps -ef command (pstree is another command to show what’s running).

To make your life a bit easier.

<Ctrl> + <ESC>

You are just seeing grep process and not the process name after grep, it is shown in ps because okular and gwenview is the argument to the grep command and since grep is also a process from ps’s point of view :slight_smile:

linux-rz2v:/home/brm # ps aux | **grep** okular
root      9771  0.0  0.0  10520   928 pts/0    S+   11:49   0:00 **grep** --color=auto okular
linux-rz2v:/home/brm # ps aux | **grep** gwenview
root      9829  0.0  0.0  10520   928 pts/0    S+   11:50   0:00 **grep **--color=auto gwenview
linux-rz2v:/home/brm #                 

The ***–color=auto ***which you see in that output is the option to grep.

To see some options you can use to GNU grep.

grep --help

Why the default option? openSUSE has an alias, a custom grep command that came with the distro which has colored output on. If you run.

# type grep
grep is aliased to `grep --color=auto'

or

# command -v grep
alias grep='grep --color=auto'

You will see why it has the –color=auto

Now if you want to avoid the grep command being seen by ps then you can do something like this.

ps aux | grep -v grep | grep okular
ps aux | grep -v grep | grep gwenview

or

ps aux | grep '[o]'kular
ps aux | grep '[g]'wenview

Also you might want to think about the zombie process that malcom mention :wink:

Please copy/paste computer output between COIDE tags to make it readable for us. You get the CODE tags by clicking on the # button in the task bar of the post editor.

Thanks for these suggestions - I must keep this in mind for future use. I could not find and sign of the gwenview and okular processes showing in the System Monitor Process table … hmmm.

Depends what you mean by ‘closing’. I’ve come across several arguments
elsewhere where people think that clicking on the ‘x’ button closes the
application when all it does is close the window, leaving the
application running. I assume that you followed the correct procedure
and used ‘file ==> quit’ or some such?


Graham P Davis, Bracknell, Berks.
openSUSE 13.2-m0 (64-bit); KDE 4.12.97; AMD Phenom II X2 550 Processor;
Kernel: 3.14.0-rc7; Video: nVidia GeForce 210 (using nouveau driver);
Sound: ATI SBx00 Azalia (Intel HDA)

Really depends on the app and if it is in the system tray. Most apps quit but apps like skype or amorok do not quit but go to running in the back ground in the system tray.

And in any case there should not be multiple instances if running from the tray.

I have seen zombies but that normally means that there is some problem with the app or perhaps the destop.

Check to be sure your apps only come from normal repos. never factory. Mixing in factory can cause many problem.

Thanks for the feedback.

With digikam (for example) I find normal processes show when the app is started. Here I use konsole.

brm@linux-rz2v:~> ps aux | grep digikam
brm 29649 7.6 1.5 3449336 192508 ? Sl 06:42 0:04 /usr/bin/digikam -caption digiKam --icon digikam
brm 29718 0.1 0.2 584060 26856 ? Sl 06:42 0:00 kdeinit4: kio_digikamdates [kdeinit] digikamdates local:/tmp/k
brm 29722 0.1 0.2 583892 26744 ? Sl 06:42 0:00 kdeinit4: kio_digikamalbums [kdeinit] digikamalbums local:/tmp
brm 29889 0.0 0.0 10524 924 pts/1 S+ 06:43 0:00 grep --color=auto digikam

When digikam is closed these processes close.

brm@linux-rz2v:~> ps aux | grep digikam
brm 30640 0.0 0.0 10520 924 pts/1 S+ 06:47 0:00 grep --color=auto digikam

I get similar results with gwenview. I am not sure what System Monitor is doing, but I will watch and observe for the time being.

On 2014-04-09 05:16, jetchisel wrote:
> Now if you want to avoid the grep command being seen by ps then you can
> do something like this.

Years ago I knew a trick to make ps not show itself in the output with
grep - but I forgot it. It was simpler than the one you describe, though.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

Please post your copied/pasted computer text between CODE tags to make them better readable/un derstandable. It is the # button in the tool bar ofthe post editor.

I would like to know it too, any way i get lost in ps man page tbh, but here is a function to do just that.

pss(){ for f; do command ps -ef | grep "${f%"${f#?}"}]${f#?}"; done; }

How to use it.

pss app1 app2 app3 app4 ... and so on

In action with one app.


jetchisel@Msi:~> pss vbox
jetchis+  1937     1  0 02:09 ?        00:00:00 /usr/lib/virtualbox/vboxwebsrv --background

In action with multiple apps

jetchisel@Msi:~> pss dolphin yakuake konsole amarok
jetchis+  4594  2602  0 02:56 ?        00:00:01 kdeinit4: dolphin [kdeinit] --icon system-file-manager -caption Dolphin
jetchis+  3337     1  0 02:10 ?        00:00:02 /usr/bin/yakuake -session 104d73690000139712070100000035400091_1397239724_365056
jetchis+  3853     1  0 02:11 ?        00:00:09 kdeinit4: konsole [kdeinit]                    
jetchis+  4902     1 15 03:29 ?        00:00:02 /usr/bin/amarok

You can save it in your ~/.bashrc and source it after saving.

echo 'pss(){ for f; do command -p ps -ef | grep "${f%${f#?}}]${f#?}"; done; }' >> ~/.bashrc
source ~/.bashrc

check it

jetchisel@Msi:~> command -V pss
pss is a function
pss () 
{ 
    for f in "$@";
    do
        command -p ps -ef | grep --color=auto "${f%${f#?}}]${f#?}";
    done
}

If you want it to be system-wide you can put it in /etc/bash.bashrc.local, save it and source it. It is not efficient fucntion i know :-), but hey if just want to see the process then that will do :slight_smile:

On 2014-04-11 21:56, jetchisel wrote:
>
> robin_listas;2636280 Wrote:

>> Years ago I knew a trick to make ps not show itself in the output with
>> grep - but I forgot it. It was simpler than the one you describe,
>> though.

> I would like to know it too, any way i get lost in ps man page tbh, but
> here is a function to do just that.

I found one that does it: “-e”. But it also clears out some other
entries. And I don’t know what it does:


-e     Select all processes.  Identical to -A.

and:

-A     Select all processes.  Identical to -e.

That’s a recursive definition… :-/


> Telcontar:~ # ps -ely |grep -i pulse
> S  1000  4748     1  0  80   0  4824 94016 SyS_pp ?        00:00:20 pulseaudio
> Telcontar:~ # ps axu |grep -i pulse
> cer       4748  0.0  0.0 376064  4824 ?        Sl   Apr11   0:20 /usr/bin/pulseaudio --start --log-target=syslog
> cer       4759  0.0  0.0  71452  2160 ?        S    Apr11   0:00 /usr/lib/pulse/gconf-helper
> root     26878  0.0  0.0   9268   928 pts/1    S+   02:29   0:00 grep --color=auto -i pulse
> Telcontar:~ #

> Code:
> --------------------
> pss(){ for f; do command ps -ef | grep “${f%”${f#?}"}]${f#?}"; done; }
> --------------------

:slight_smile:

But you have to add it. Alias, function…


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

Well, my point is if there is no process running then don’t display the grep –color=auto processname
Second you do not need to type ps over and over again when searching for multiple processes :wink:

If you do not want the function then create a script.

#!/usr/bin/env bash

for f; do
  command -p ps -ef | grep --color=auto "${f%${f#?}}]${f#?}"
done

Put it in ~/bin for single user or in /usr/local/bin for system-wide then make it executable. :wink:

Square brackets round the first character of the grep string. I think that this has appeared somewhere in this thread.

http://unix.stackexchange.com/questions/2062/grep-why-do-brackets-in-grep-pattern-remove-the-grep-process-from-ps-results#2067

It also appeared in this thread too, maybe no one noticed it. It was on my first reply on this thread.

Sorry I was ambiguous. I meant your post. I was using text-to speech, and couldn’t find your example although I remembered hearing it on my first “readimg”. I meant to include the link only as a footnote.
:shame:

https://forums.opensuse.org/images/smiliesnew/shame.pngAh, ok then i would like to point out that my grep code.

grep "${f%${f#?}}]${f#?}"

Is exactly like in that thread you posted, you can see there is a open and close brackets too the ${f%${f#?}} inside the first bracket is the first character of the processname and the ${f#?} which is outside the brackets is the rest of the process name and the *for loop *is used to cycle through all the process name to grep ( if there is any). No worries though.