Effectively work with Nautilus File Manager

copyright (C) qingfeng Xia 2011-2020 CC-BY-NC 4.0

This belongs to Research Software Engineering on Linux series

 

Add new file types into “Create Document” shortcut menu

After adding empty or template files into “Template” folder in the user home, right click at the blank space of Nautilus (in small icon view, not in list view), there will be new file types in “Create Document” sub-menu.

 

Show hidden folder and files by shortcut key “Ctrl + h”

On Linux, file and folder names begins with “.” will not shown in Nautilus file manager, the shortcut key “Ctrl + h” can toggle the hiding status on and off, without resorting mouse.

This shortcut also works for other program’s file open dialog, for example, if you want to open “.bashrc” from your favourite text editor, this can be very useful.

 

Hide files with specific file suffix *.pyc”

In each folder, there is a configuration file “.hidden”, just like “.gitignore” all file name listed inside will not shown in file manager. To hide python cache file, open a terminal in this folder, run

ls *.py[co] >> .hidden

 

Add new shortcut menu item by Nautilus scripts

sudo apt-get install nautilus-scripts-manager , nautilus-scripts-manager seems does not works with latest Ubuntu 18.04, even if I installed scripts to system script folder.

Solution is adapted from https://askubuntu.com/questions/68078/keyboard-shortcut-for-open-a-terminal-here

Since version 3.15.4 Nautilus doesn’t load the accel file anymore (Source). Fortunately there’s a better approach in order to get what you want.

see also https://help.ubuntu.com/community/NautilusScriptsHowto

In short:

Create a script file with content from the code block below, to generate an executable script called Terminal in the folder ~/.local/share/nautilus/scripts

Test the newly added script

close and open Nautilus, right click on some folder, not right click on any blank space in file manager, and choose Scripts > Terminal.

#!/bin/sh

# local script is NOT allowed
DIR=~/.local/share/nautilus/scripts
# system wide, so must has su previledge
#DIR=/usr/share/nautilus_scripts

# better to check existence
if [ ! -d $DIR ]; then
    echo '$DIR' folder does not exist!
    mkdir -p $DIR
fi

# make a script, Actually script is not limited to bash
# dash or underscore, hypen in file name is NOT encouraged/allowed
FILE=${DIR}/openTerminal.sh
if [  -f $FILE ]; then
    echo "%FILE exists, just overwrite"
fi

#append multiple lines into this file
cat > $FILE <<EOL
#!/bin/sh
gnome-terminal
EOL

#Make it executable, then restart any Nautilus instance:
chmod +x $FILE



CC-BY-NC 4.0 licensed free for non-commercial usage
Author: Qingfeng XIA
copyright (C) 2011-2020
http://www.iesensor.com
please keep the original link in your reference.
http://www.iesensor.com/blog/2020/04/15/effectively-work-with-nautilus-file-manager/
This entry was posted in Linux, Uncategorized. Bookmark the permalink.