Open the directory in the Ubuntu Nautilus window (corresponding to the Windows Resource Manager). Sometimes you want to open the terminal in the current window for operations, if you select the menu-> application-> attachment-> terminal and then CD it to the directory, it is very troublesome for a lazy like me. So I thought, is there a way to start the terminal directly in the current window through the shortcut key?
Search for it first. A script is found:
1 #! /Bin/bash
2 # This script opens a gnome-terminal in the directory you select.
3 # Distributed under the terms of gnu gpl version 2 or later
4 # Install in ~ /. Gnome2/nautilus-scripts or ~ /Nautilus/scripts
5 # You need to be running Nautilus 1.0.3 + to use scripts.
6 # When a directory is selected, go there. Otherwise go to current
7 # directory. If more than one directory is selected, show error.
8
9 if [-n "$ NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"]; then
10 set $ nautilus_script_selected_file_paths
11 if [$ #-EQ 1]; then
12 Destination = "$1"
13
14 # Go To File's directory if it's a file
15 if [! -D "$ destination"]; then
16 Destination = "'dirname" $ destination "'"
17 fi
18 else
19 zenity -- error -- Title = "error-open terminal here "\
20 -- text = "You can only select one directory ."
21 Exit 1
22 fi
23 else
24 Destination = "'echo" $ nautilus_script_current_uri "| SED's/^ file :\/\///''"
25 fi
26
27 # It's only possible to go to local directories
28 if [-n "'echo" $ destination "| grep '^ [a-zA-Z0-9] \ +:'' "]; then
29 zenity -- error -- Title = "error-open terminal here "\
30 -- text = "only local directories can be used ."
31 Exit 1
32 fi
33
34 cd "$ destination"
35 exec X-terminal-emulator
Copy the script to./gnome2/Nautilus-scripts in the main directory, and set any name (for example, "open terminal"). chmod 777.
Test:
In any window, right-click "script" and "open terminal" (that is, the script name ).
It turns on a terminal and automatically switches to the current directory. This is exactly what I want!
(This script is based on nautilus. It is estimated that not only ubuntu, but all systems using nautilus should be able to run this script .)