Recently, we showed you how to open a directory in Terminal from within Nautilus. However, what if you’re working on the command line in Terminal and need to access the same directory in Nautilus? There’s an easy solution for that.
NOTE: When we say to type something in this article and there are quotes around the text, DO NOT type the quotes, unless we specify otherwise.
To open the current directory open in Terminal, type the following command at the prompt and press Enter.
NOTE: Be sure to type a space between “nautilus” and the period (“.”).
It doesn’t matter which directory is active in Terminal before jumping to a specific directory in Nautilus.
Nautilus opens directly to the specified directory.
You can easily jump to other directories in Nautilus, such as your Home directory…
…or your Music directory. You can also jump to other directories within your Home directory, such as Documents (nautilus ~/Documents), pictures (nautilus ~/Pictures), or Downloads (nautilus ~/Downloads).
Jumping to directories you created are just as easy. Note that for directory names that contain spaces, preface each space with a backslash (\).
If there are certain directories you access a lot, you can create aliases, or shortcuts, to access those directories in Nautilus from Terminal. For example, you can create the following alias so you can simply type “nh” to access your Home directory in Nautilus.
alias nh=’nautilus .’
See our article to learn how to create and use aliases to customize Ubuntu commands.
Then, on the command line in Terminal, you can type “nh” from any directory to jump to your Home directory in Nautilus.
To close the Terminal window, type “exit” at the prompt and press Enter, or click the X button in the upper-left corner of the window.
You can also create a bash shell script containing the “nautilus .” command. This allows you to press Alt + F2 to access the command bar from Unity, type “nh” (or whatever filename you assigned to the script), and press Enter, to open your Home directory without ever opening a Terminal window.
NOTE: You can also click on the resulting icon for your script to run it.
See our Beginner’s Guide to Shell Scripting series to learn how to create shell scripts.
If you’re already in Nautilus and you need to move to a different directory, you can use the keyboard to get there if you show the location entry instead of the breadcrumb bar.