特殊:Badtitle/NS100:NautilusScriptsHowto/SampleScripts
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/NautilusScriptsHowto/SampleScripts }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/af | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|Afrikaans| [[::NautilusScriptsHowto/SampleScripts/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/ar | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|العربية| [[::NautilusScriptsHowto/SampleScripts/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/az | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|azərbaycanca| [[::NautilusScriptsHowto/SampleScripts/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/bcc | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|جهلسری بلوچی| [[::NautilusScriptsHowto/SampleScripts/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/bg | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|български| [[::NautilusScriptsHowto/SampleScripts/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/br | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|brezhoneg| [[::NautilusScriptsHowto/SampleScripts/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/ca | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|català| [[::NautilusScriptsHowto/SampleScripts/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/cs | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|čeština| [[::NautilusScriptsHowto/SampleScripts/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/de | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|Deutsch| [[::NautilusScriptsHowto/SampleScripts/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/el | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|Ελληνικά| [[::NautilusScriptsHowto/SampleScripts/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/es | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|español| [[::NautilusScriptsHowto/SampleScripts/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/fa | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|فارسی| [[::NautilusScriptsHowto/SampleScripts/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/fi | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|suomi| [[::NautilusScriptsHowto/SampleScripts/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/fr | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|français| [[::NautilusScriptsHowto/SampleScripts/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/gu | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|ગુજરાતી| [[::NautilusScriptsHowto/SampleScripts/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/he | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|עברית| [[::NautilusScriptsHowto/SampleScripts/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/hu | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|magyar| [[::NautilusScriptsHowto/SampleScripts/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/id | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|Bahasa Indonesia| [[::NautilusScriptsHowto/SampleScripts/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/it | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|italiano| [[::NautilusScriptsHowto/SampleScripts/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/ja | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|日本語| [[::NautilusScriptsHowto/SampleScripts/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/ko | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|한국어| [[::NautilusScriptsHowto/SampleScripts/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/ksh | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|Ripoarisch| [[::NautilusScriptsHowto/SampleScripts/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/mr | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|मराठी| [[::NautilusScriptsHowto/SampleScripts/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/ms | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|Bahasa Melayu| [[::NautilusScriptsHowto/SampleScripts/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/nl | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|Nederlands| [[::NautilusScriptsHowto/SampleScripts/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/no | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|norsk| [[::NautilusScriptsHowto/SampleScripts/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/oc | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|occitan| [[::NautilusScriptsHowto/SampleScripts/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/pl | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|polski| [[::NautilusScriptsHowto/SampleScripts/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/pt | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|português| [[::NautilusScriptsHowto/SampleScripts/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/ro | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|română| [[::NautilusScriptsHowto/SampleScripts/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/ru | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|русский| [[::NautilusScriptsHowto/SampleScripts/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/si | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|සිංහල| [[::NautilusScriptsHowto/SampleScripts/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/sq | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|shqip| [[::NautilusScriptsHowto/SampleScripts/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/sr | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|српски / srpski| [[::NautilusScriptsHowto/SampleScripts/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/sv | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|svenska| [[::NautilusScriptsHowto/SampleScripts/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/th | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|ไทย| [[::NautilusScriptsHowto/SampleScripts/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/tr | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|Türkçe| [[::NautilusScriptsHowto/SampleScripts/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/vi | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|Tiếng Việt| [[::NautilusScriptsHowto/SampleScripts/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/yue | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|粵語| [[::NautilusScriptsHowto/SampleScripts/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/zh | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|中文| [[::NautilusScriptsHowto/SampleScripts/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/zh-hans | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|中文(简体)| [[::NautilusScriptsHowto/SampleScripts/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts | UbuntuHelp:NautilusScriptsHowto/SampleScripts | {{#if: | :}}NautilusScriptsHowto/SampleScripts}}/zh-hant | • {{#if: UbuntuHelp:NautilusScriptsHowto/SampleScripts|中文(繁體)| [[::NautilusScriptsHowto/SampleScripts/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:NautilusScriptsHowto/SampleScripts|:NautilusScriptsHowto/SampleScripts|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :NautilusScriptsHowto/SampleScripts/zh | | {{#ifexist: NautilusScriptsHowto/SampleScripts/zh | | {{#ifeq: {{#titleparts:NautilusScriptsHowto/SampleScripts|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:NautilusScriptsHowto/SampleScripts|1|-1|}} | zh | | }}
- title Sample Scripts
Sample scripts
Note: These scripts may be out of date. Use at your own risk.
Email the selected file
[[UbuntuHelp:[Top|Back to top]]] This one is really useful. How many times have you needed to find a file and then send it? And to be honest, from Evolution or mozilla-thunderbird this is not that simple. It is much easier to use Nautilus to find your file and then send it from there.
#!/usr/bin/perl -w # By John Russell # This script sends the selected file(s) with your email client. use strict; my $MAILTO_URL="mailto:?"; my @files = split("\n", $ENV{NAUTILUS_SCRIPT_SELECTED_FILE_PATHS}); my $count = 0; foreach my $file (@files) { if ( ! -f $file && ! -l $file ) { my @dialog = ("gdialog","--title","Error","--msgbox", "\nError: Can not send $file. \n\n Only regular files can be mailed. ","200", "300"); system (@dialog); } else { $MAILTO_URL = $MAILTO_URL . "attach=" . $file . "&"; shift; $count += 1; } } if ($count > 0) { my @command = ("gnome-open", $MAILTO_URL); system(@command); }
Added by Darrell: I found that the mailto: syntax in the above does not work with mozilla-thunderbird. I have created the following amended version which seems to work with Thunderbird:
#!/usr/bin/perl -w # By John Russell # and hacked to work with thunderbird by Darrell # This script sends the selected file(s) with mozilla-thunderbird. use strict; my $attach_string="\"attachment='"; my @files = split("\n", $ENV{NAUTILUS_SCRIPT_SELECTED_FILE_PATHS}); my $count = 0; foreach my $file (@files) { if ( ! -f $file && ! -l $file ) { my @dialog = ("gdialog","--title","Error","--msgbox", "\nError: Can not send $file. \n\n Only regular files can be mailed. ","200", "300"); system (@dialog); } else { $attach_string = $attach_string . "file://" . $file . ","; shift; $count += 1; } } if ($count > 0) { $attach_string = $attach_string . "'\""; # replace spaces with '%20' as demanded by mozilla/thunderbird $attach_string =~ s/\s/%20/g; # invoke shell script to call thunderbird differently depending on whether it's running already or not my $command = ("~/scripts/thunderbird-email-attachments " . $attach_string); system($command); }
You will see there is also a shell script which is required, (~/scripts/thunderbird-email-attachments in my example above, don't put it in the nautilus-scripts directory, otherwise it will show up in the context menu):
#!/bin/sh # if thunderbird is already running open a compose window in the running instance if `ps xc | grep -q mozilla-thunder`; then exec mozilla-thunderbird -a Mozilla-Thunderbird -remote "xfeDoCommand(ComposeMessage,$1)" # else start a new instance with the compose window only else exec mozilla-thunderbird -compose $1 fi
Mount ISO
[[UbuntuHelp:[Top|Back to top]]] Mount an ISO image, from Nautilus. Note from carney1979 - this script will be updated to work with filenames containing spaces soon.
#!/bin/bash # #By modprobing loop it makes sure that the module is loaded and ready for #use. If it is already loaded then nothing will happen. modprobe loop for I in `echo $*` do foo=`gksudo -u root -k -m "enter your password for root terminal access" /bin/echo "got r00t?"` sudo mount -o loop -t iso9660 $I /media/iso done done exit0
Unmount ISO
[[UbuntuHelp:[Top|Back to top]]] Unmount an iso image, from nautilus. Note from carney1979 - this script will be updated to work with filenames containing spaces soon.
#!/bin/bash # for I in `echo $*` do foo=`gksudo -u root -k -m "enter your password for root terminal access" /bin/echo "got r00t?"` sudo umount $I done done exit0
Set file read-only
[[UbuntuHelp:[Top|Back to top]]] Change file-permission to read-only.
#!/bin/bash chmod ugo-wx $*
Edit file with gedit with root-privileges
[[UbuntuHelp:[Top|Back to top]]] Note from carney1979 - this script will be updated to work with filenames containing spaces soon.
#!/bin/bash # for I in `echo $*` do foo=`gksudo -u root -k -m "enter your password for root terminal access" /bin/echo "got r00t?"` sudo gedit $I done done exit0
Note from blazoner - A much simpler alternative that works with filenames containing spaces is:
#!/bin/sh gksudo "gedit $NAUTILUS_SCRIPT_SELECTED_URIS"
Open Nautilus with root-privileges here
[[UbuntuHelp:[Top|Back to top]]]
#!/bin/bash # root-nautilus-here # opens a root-enabled instance of a nautilus window in selected location # requires sudo privileges and gksudo, which may involve security risks. #Install in your ~/Nautilus/scripts directory. # # Placed in the public domain by Shane T. Mueller 2001 # Fixes provided by Doug Nordwall # # 2004.04.18 -- [email protected] - Added gksudo usage to provide popup # password window if sudo has expired. Line only echos got # root to std output. But gksudo updates your sudo access # privs, so running nautilus with sudo will succeed # without asking for a password. foo=`gksudo -u root -k -m "enter your password for nautilus root access" /bin/echo "got r00t?"` sudo nautilus --no-desktop $NAUTILUS_SCRIPT_CURRENT_URI
Note from blazoner - A much simpler alternative:
#!/bin/sh ### root-nautilus-here gksudo "nautilus --no-desktop $NAUTILUS_SCRIPT_CURRENT_URI"
Run file with root privileges
[[UbuntuHelp:[Top|Back to top]]] Note from carney1979 - this script will be updated to work with filenames containing spaces soon.
#!/bin/bash # for I in `echo $*` do /usr/bin/gksudo $I done done exit0
Note from blazoner - A much simpler alternative that works with filenames containing spaces and also opens folders (in nautilus) as root is:
#!/bin/sh gksudo "gnome-open $NAUTILUS_SCRIPT_SELECTED_URIS"
Open search window here
[[UbuntuHelp:[Top|Back to top]]]
#!/bin/sh # From Johnathan Bailes # This script opens a gnome-search-tool in the directory you select. # # Distributed under the terms of GNU GPL version 2 or later # # Install in your ~/Nautilus/scripts directory. # You need to be running Nautilus 1.0.3+ to use scripts. cd $NAUTILUS_SCRIPT_CURRENT_URI exec gnome-search-tool
Open terminal here
[[UbuntuHelp:[Top|Back to top]]]
#!/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
Hide or Show Hidden Files
[[UbuntuHelp:[Top|Back to top]]] (doesn't work on Hardy Heron)
#!/bin/sh # When hidden files (.emacs, etc) are hidden, shows "Show Hidden Files" option. # When hidden files are shown, shows "Hide Hidden Files" option. # Uses gconf to toggle between the two Nautilus options. # Should be placed in ~/.gnome2/nautilus-scripts/ with executable permission. OLDSTATE=$(gconftool-2 --get "/desktop/gnome/file_views/show_hidden_files") if [ "$OLDSTATE" == "false" ] ; then NEWSTATE="True" mv ~/.gnome2/nautilus-scripts/Show\ Dot\ Files ~/.gnome2/nautilus-scripts/Hide\ Dot\ Files else NEWSTATE="False" mv ~/.gnome2/nautilus-scripts/Hide\ Dot\ Files ~/.gnome2/nautilus-scripts/Show\ Dot\ Files fi gconftool-2 --set "/desktop/gnome/file_views/show_hidden_files" --type boolean $NEWSTATE
Note: You can do the same without a script by pressing CTRL+H under Nautilus
[[UbuntuHelp:[Top|Back to top]]]