17

How can I close all opened Nautilus (explorer) windows from the terminal?

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
MD. Mohiuddin Ahmed
  • 665
  • 3
  • 11
  • 20

2 Answers2

22
nautilus -q

or

killall nautilus

If nautilus is in the middle of doing something you should use the first command as it allows nautilus to exit gracefully. The second command just "terminates" nautilus so if invoked in the middle of e.g. a copy/move operation you might end up with corrupted data.

don_crissti
  • 79,330
  • 30
  • 216
  • 245
5
pkill nautilus

Or to kill everything with nautilus in the name, while insisting:

pkill -9 -f nautilus
Alexander
  • 9,607
  • 3
  • 40
  • 59
  • [do not `kill -9`](http://unix.stackexchange.com/questions/8916/why-not-kill-9-a-process) – Lesmana Jun 09 '13 at 13:42
  • 2
    The side-effects of kill -9 are no big deal. I agree that the executable should have had a chance to shut down cleanly first, but "do not kill -9" gives associations to parents that want their child to wear a helmet at all times. – Alexander Jun 09 '13 at 15:40
  • 1
    Yeah, not using kill -9 is impractical. In a perfect world, we don't even need to use pkill at all. – Sridhar Sarnobat Nov 19 '20 at 03:41