Shortcut menu for adding "computer" and "open terminal" under Ubuntu

Source: Internet
Author: User

Add "computer" on the desktop ":

Right-click the desktop, create launcher, and enter "my computer" in the name section. In the command bar, enter:/usr/bin/Nautilus COMPUTER.

COMPUTER: // indicates the URI in Nautilus.

Right-click to add "open terminal ":

Many people may switch from a Linux release such as RedHat to Ubuntu. the first common problem is that right-click the desktop and find that there is no "open terminal" option, the following describes two methods to add the "open terminal" option right-click.

Method 1:
After installing a package, you can right-click it and add a menu of "open terminal.

Sudo apt-Get install Nautilus-open-Terminal

Method 2:

Go to the. gnome2/Nautilus-scripts directory in the main directory. Create a new file with any file name (this file name will be displayed in the right-click menu, preferably easy to understand, such as "open terminal" or "open-terminal"). The file content is as follows.

Reference
#! /Bin/bash
#
# This script opens a gnome-terminal in the directory you select.
#
# Distributed under the terms of gnu gpl version 2 or later
#
# Install in ~ /. Gnome2/Nautilus-scripts or ~ /Nautilus/scripts
# You need to be running Nautilus 1.0.3 + to use scripts.

# When a directory is selected, go there. Otherwise go to current
# Directory. If more than one directory is selected, show error.
If [-n "$ nautilus_script_selected_file_paths"]; then
Set $ nautilus_script_selected_file_paths
If [$ #-EQ 1]; then
Destination = "$1"
# Go To File's directory if it's a file
If [! -D "$ destination"]; then
Destination = "'dirname" $ destination "'"
Fi
Else
Zenity -- error -- Title = "error-open terminal here "\
-- Text = "You can only select one directory ."
Exit 1
Fi
Else
Destination = "'echo" $ nautilus_script_current_uri "| SED's/^ file :\/\///''"
Fi

# It's only possible to go to local directories
If [-n "'echo" $ destination "| grep' ^ [a-zA-Z0-9] \ +:'' "]; then
Zenity -- error -- Title = "error-open terminal here "\
-- Text = "only local directories can be used ."
Exit 1
Fi

Cd "$ destination"
Exec X-terminal-emulator

After adding the file, add executable permissions to the file.

Chmod + X file

Let's talk about the advantages and disadvantages of the two methods:
1. the second method is to create a level-2 menu. It first adds a menu named scripts to the context menu, in this menu, we need to "Open the terminal" or "open-terminal" (the name of this place is the file name of the new script), so it seems inconvenient. The first method is to add a menu directly in the right-click menu.

(There are different online statements on this point. Different versions may have different directories.) 2. both methods are based on Nautilus. This feature can be enabled on any Nautilus interface. More specifically, the second method recognizes the current directory, the default directory of the opened terminal is the current directory, which is more user-friendly. The first method is to use the default directory, No matter what directory you are in.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.