10

I find it rather hard to travel through my system using nautilus and much prefer using the cd etc commands in Terminal to get around my system, but I find that sometimes I do need to look at a list of files and folders in nautilus as ls just isn't doing it for me and maybe there is such a large number of files that it would be much simpler if I could just have them all listed in a GUI instead of having to get ls to redirect the output into a file that I would then have to read.

But then what I find is that I have very quickly found the location of the directory which contains the files I want, in Terminal, and then I have to go back into nautilus and slowly move to that location through the GUI, so I am wondering if there is any way in Terminal, once you have used cd to get to your target directory, to launch nautilus and have it auto-navigate to that location (so that it opens the directory you have used cd to get to in nautilus)?


OS Information:

Description:    Ubuntu 14.10
Release:    14.10

Package Information:

nautilus:
  Installed: 1:3.10.1-0ubuntu15.1
  Candidate: 1:3.10.1-0ubuntu15.1
  Version table:
 *** 1:3.10.1-0ubuntu15.1 0
        500 http://gb.archive.ubuntu.com/ubuntu/ utopic-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     1:3.10.1-0ubuntu15 0
        500 http://gb.archive.ubuntu.com/ubuntu/ utopic/main amd64 Packages
1

5 Answers 5

28

From your terminal, just open nautilus as follow:

nautilus .

It will open a new instance of Nautilus in the directory where you were in your Terminal.

From the nautilus man page:

SYNOPSIS
       nautilus [options] URIs...
2
  • 7
    This is the answer to the question asked.
    – alexis
    Mar 29, 2015 at 21:50
  • Use (nautilus . >/dev/null 2>&1 &) to run independent of terminal process and suppress log appear in current shell session. Consider set it as alias such as na.
    – 林果皞
    Jun 8, 2019 at 19:56
11

As well as

nautilus .

you can also do:

xdg-open .

and it will do the same as if you double clicked a file in nautilus. Which also means you can open a spreadsheet in LibreOffice with

xdg-open mysheet.ods

etc. I have it aliased to xopen for slightly quicker typing by putting the following in my .bashrc

alias xopen=xdg-open
0
8

Once inside your terminal, simply type nautilus . to open a new nautilus window.

There is also a file explorer for the terminal itself. Type:

sudo apt-get install mc

Then when in a directory, type mc to open it.

Screenshot of Midnight Commander(MC) File Manager:

(MC File Manager Picture)

I use MC all the time in tty. It's mainly keyboard shortcuts and although you can click the buttons, you should learn the shortcuts. BTW, the numbers at the bottom are function keys so F1, F2, F3...

4
  • 1
    Cool! I didn't know about mc! Upvoted! ;-)
    – Fabby
    Mar 29, 2015 at 21:18
  • Excellent suggestion, one more vote :) Mar 29, 2015 at 21:37
  • MC is short for midnight commander, by the way.
    – user358533
    Mar 30, 2015 at 2:06
  • @T I know but it's just easier to type MC Mar 30, 2015 at 2:12
5

Install the nemo file manager: it has a terminal-and-file-manager-in-one.

Steampunk customised nemo

My nemo is customised with home-brewn steam punk icons, but you get the point... ;-)

Commands to install:

sudo sudo add-apt-repository ppa:webupd8team/nemo
sudo apt-get install nemo

Optional packages: (bold ones are the ones I've got installed as well)

  • nemo-dbg - File manager and graphical shell for Unity (Debugging symbols)
  • nemo-data - File manager and graphical shell for Unity (data files)
  • nemo-fileroller - File Roller integration for Nemo
  • nemo-dropbox - Dropbox integration for Nemo
  • nemo-compare - Context menu comparison extension for Nemo file manager
  • python-nemo - Python binding for Nemo components
  • nemo-seahorse - seahorse plugins and utilities for encryption
  • nemo-share - Nemo extension to share folder using Samba
  • nemo-pastebin - Nemo extension to send files to a pastebin
  • nemo-rabbitvcs - Nemo extension for RabbitVCS
  • nemo-media-columns - Nemo Extension
  • nemo-terminal - Nemo extension to enable an embedded terminal
  • nemo-image-converter - nemo extension to mass resize or rotate images
  • nemo-emblems - Change a folder or file emblem
  • nemo-filename-repairer - Nemo extension for filename encoding repair
  • nemo-folder-color - Change a folder color
2
  • 1
    Where do you find the terminal extension? github or ppa? I didn't find it in the repo. Mar 29, 2015 at 21:18
  • @SylvainPineau repository added! Thanks for the upvote and comment!
    – Fabby
    Mar 29, 2015 at 21:38
1

An even more general approach than those already presented - I have the following in my ~/.bashrc:

open() {
  for file in "$@"
  do
    xdg-open "$file" > /dev/null 2>&1
    if [ "$?" != 0 ]; then
      echo "$file"": Failed to open"
    else
      echo "$file"": Opened successfully"
    fi

  done
}

xdg-open is a useful program that opens something as though you double clicked it, but it works from the terminal. The > /dev/null 2>&1 discards the stdout from whatever program opens your file or directory, as this can be really annoying. With this you can open multiple directories in one line, e.g.

open . .. Documents

Will open 3 windows, the current directory, the directory above the current directory and the Documents folder in the current directory, all with your default file manager, be it nautilus or nemo.

Naturally, it will also open other types of files e.g. open file.doc will open file.doc in LibreOffice.