The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

If you can read me, I'm broken!

Views: 1,610     Votes:  2     ✅ Solution
Tags: gnome   desktop   nautilus   icons  
Link: 🔍 See Original Question on Unix & Linux ⧉ 🔗

URL: https://unix.stackexchange.com/q/546241
Title: Best way to check if Nautilus File Manager is running?
ID: /2019/10/11/Best-way-to-check-if-Nautilus-File-Manager-is-running_
Created: October 11, 2019    Edited:  October 13, 2019    Favorites:  0
Upload: April 8, 2024    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


I’ve been working hours on this problem. When nautilus file manager is NOT running nautilus is running because it controls icons on the desktop.

$ ps -aux | grep nautilus | grep -v grep
rick      5613  0.2  1.7 2355392 140012 pts/19 Sl+  19:04   0:08 nautilus

So use this command without nautilus file manager open and you see:

$ ps -L -p 5613 -o pid,nice,lwp,comm
  PID  NI   LWP COMMAND
 5613   0  5613 nautilus
 5613   0  5614 gmain
 5613   0  5615 gdbus
 5613   0  5617 dconf worker

Now open up nautilus file manager and redo ps command:

$ nautilus

$ ps -L -p 5613 -o pid,nice,lwp,comm
  PID  NI   LWP COMMAND
 5613   0  5613 nautilus
 5613   0  5614 gmain
 5613   0  5615 gdbus
 5613   0  5617 dconf worker
 5613   0  4788 pool

Close the nautilus files window and rerun the command (after waiting a second or two) and the pool disappears.

Is this the correct way of seeing if nautilus file manager is running?

I’ve incorporated above technique into an answer in Ask Ubuntu I’d like to improve if possible:

⇧ How do I disable all spectre/meltdown/l1tf mitigations on kernel 4.15.0? Best way to make Ubuntu installation as lean as possible?  ⇩