Legend
Legend

Reputation: 116800

Terminal: Opening the current path in a window?

Often times, I find myself navigating very deep into a directory and wanting to open the graphical window (nautilus) for various reasons. So the question is simple:

After doing,

cd sampledirectory  
cd sampledirectory2 

How can I open this location in a GUI?

Upvotes: 23

Views: 30071

Answers (6)

Wayne's World
Wayne's World

Reputation: 397

Surprised that you all not mention:

( dolphin . & )

Detaching programs form the terminal is always key for me because when you close the console window after just do

dolphin . &

... it will also close your file manager or whatever program you started this way together with it and probably nobody wants this.

Upvotes: 0

nkrupa
nkrupa

Reputation: 1

Similar to DigitalRoss' comment, on a Mac you can add the following to your ~/.bash_profile:

alias finder="open /System/Library/CoreServices/Finder.app ${1:-.}"

then, from any Terminal window session, you can simply type:

finder

to launch the Finder at your current location.

Upvotes: 0

Diego Torres Milano
Diego Torres Milano

Reputation: 69198

The most portable way should be using freedesktop's xdg-utils xdg-open. For example

   $ xdg-open .

this has the advantage of choosing from your desktop preferences the tool to open different file types, like for example

   $ xdg-open ~/Documents/mypresentation.odp

or

   $ xdg-open ~/Pictures/mypic.png

Upvotes: 9

DigitalRoss
DigitalRoss

Reputation: 146043

nautilus .


I've done this a zillion times.

Here is how I do it on every system:

Mac:

#!/bin/sh
open /System/Library/CoreServices/Finder.app ${1:-.}

Linux / BSD, if Gnome:

#!/bin/sh
nautilus ${1:-.}

Windows ... Cygwin ...

#!/bin/sh
[ $# -eq 1 ] && exec explorer "$(cygpath -w "$1")"

Upvotes: 4

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798536

nautilus --no-desktop . &

Upvotes: 5

Nick Presta
Nick Presta

Reputation: 28665

I assume Gnome with Nautilus:

nautilus .

To open in the current directory.

Replace nautilus with whichever File Manager you use (Dolphin, etc).

Upvotes: 46

Related Questions