Showing posts with label tips. Show all posts
Showing posts with label tips. Show all posts

Thursday, 30 May 2013

MailMe: how to get notified automatically via email through BASH

In my job, I have to perform calculations on a remote machine to which I connect through ssh. It happens quite often that I have to run a few jobs overnight, if not for days. I could check manually for their termination, but I came up with a better way.

In a previous post I described how useful it can be to run script in background on the machine without having to be logged-in. Combining the power of screen with the utility of mail we can create a script which will automatically send an email whenever the job is finished.


The Script


#!/bin/bash
#
##
## This scripts sends an automated email as soon as a job is finished
##
## ***   Use with screen:
## ***  
## ***   $ screen -S [job-id]               (start screen)
## ***   $ mailme [job-id]                  (run mailme in screen)
## ***   Ctrl+a d                           (detach)
## ***   Ctrl+d                             (kill screen, from session)
## ***   $ screen -ls                       (check running screens)
## ***   $ screen -r [screen-id]            (resumes session)
## ***   screen -X -S [screen-id] kill      (kill screen, from outside)
## ***  


# Need argument: job id which needs to be checked for completion
if [ -z "${1}" ] ; then
    echo "Please insert job ID as argument"
    echo "Exiting status 1"

    exit 1
fi


# Need second argument: email
if [ -z "${2}" ] ; then
    echo "Please insert email as second argument"

    echo "Exiting status 1"
    exit 1
fi


# Put your email here
zzEMAIL="${2}"
zzJOBID="${1}"
zzFREQ=3600 #Frequency of checks, in ms
zzEND=true


# Loop that checks job status
while "${zzEND}"
do

    zzSTRING=$(bhist -d | grep "${zzJOBID}")
   
    if [ ! -z "${zzSTRING}" ] ; then
   
    zzEND=false
   
    echo -e "Dear Sir,\n\nThis is an automatic email from grep Linux indicating that the job ID\# ${zzJOBID} has been terminated (succesfully or not).\n\nThis is the output:\n\n $(bhist -d) \n\nBest, \ngrep Linux | mail -s "Job ${zzJOBID} Completed!" "${zzEMAIL}"
   
    else
   
    sleep "${zzFREQ}"
   
    fi
   
done

exit 0 


The comments should provide a satisfactory explanation, but it could be used straight away for jobs submitted through the routine bsub.

You would just need to run the script from a screen and the game is on. If you do not remember how to do this, I have put some reminders in the header section of the script, or you can check my guide to screen.

You can run multiple of these scripts in multiple screen sessions if more jobs need to be tracked.


Afterthoughts


This script has been designed to check job progress and send an email  whenever the job is complete. Through an easy modification of the condition to be checked in the variable zzSTRING in the loop, anything can trigger the delivery of an automated email, potentially making the scope of this script very broad.

Have a play with it and let me know how you use/modify it!

 

Tuesday, 23 April 2013

Screen: how to run processes in the background after log out

So, you want to run a very long process on your ssh server but you need to log out.

It sounds like an impossible problem, but as long the computer is on, why can't it run processes in the background? Well, it can, and there is a simple solution using a quite clever command-line window manager:

Screen

Screen can create multiple windows in a shell, from which you can "detach" and leave them running in the background, even if you log out of your user account.


Create a Screen


From a terminal, type:

$ screen -S [choose-a-window-name]

And you will immediately enter the window just created.
From this window you can type any command and leave it running in the background.

To detach from the window and go back to the terminal, just press the combination:

ctrl-a d

And you will go back to the terminal, where you can start more screens if needed, or even log out without stopping the job.


Access a previously created Screen


From a terminal, type:

$ screen -r [window-name]

to revert a previously created screen. If you do not remember the window name, you can list them through the command:

$ screen -ls

which gives information about the active screens and their names.


Kill a Screen


If your job is finished in one screen and you want to close it, you can go revert it and press:

ctrl-d

to close it, or you can close it from outside the screen through the command:

$ screen -X -S [window-name] kill


Conclusion


Screen is a very powerful tool and its uses span a much wider scope than the ones described here. It can be regarded as complete full-screen window manager.

For ssh users, though, it is a lifesaver as it allows to run for nasty and long processes at anytime of the day without needing your presence.

Saturday, 13 October 2012

Internet connection troubleshooting

So your internet connection is not working or it is really slow. It is pretty common and Linux has a big number of tool to try to pinpoint the problem.

The first easy steps that really help understand what is wrong in the connection do not actually require any hack or software. I will call them Safety Checks. It includes parts of the routine checks they ask you to go through at annoying helplines and - for how annoying they could seem - they solve the problem most of the times. You could go straight to the command line and try find a solution without any pre-check, but why complicate life so much, especially when you are already frustrated by a non-working internet connection.

This guide is for ethernet connections (I will add wireless later, so switch to cables if you are using wireless, as often wireless has channel, signal or authentication problems).

1. Safety Checks (these apply to any OS)


a. Check again that cables are connected correctly, that your router is on and it is not giving problems (e.g. error messages through flashing leds). If the hardware is giving problem, do not think you will manage to magically fix your internet with a string of command.

b. If everything is ok, shut off your modem and wait a few minutes before turning it on. Meanwhile, reboot your computer as well (I know it is very annoying!). You will thank me later if that solves the problem.

c. If you tried that already/it is not enough, it really helps to try internet on other computers or operative systems. That will help localize the problem. If internet does work on other devices, you can be sure that the problem is within your device. This is good, as it is usually easier to solve (the problem depends on you - where you can put hands on - and not on them). If this is the case, you will be able to solve the problem, otherwise the problem could not be within your range (Power failures, remote server shut down, bad cabling, network congestion).

d. Control DHCP settings. DHCP is a tool in your router that assigns IP to each device automatically, making it non-static. You need to control DHCP is activated both on router and local device. You usually access the control panel of your router by typing the default route (Gateway, the IP of your router) into your web browser address bar. If you do not know what is it, it is usually 192.168.0.1 or 192.168.0.255 (you can try them), or more easily found under the name of Gateway in connection information (depends on OS).

e. Ping! Most of the times bad connectivity is caused by bad DNS servers. DNS are used to translate website names into IP numbers. Pinging the direct IP will then work as usual if the problem is in the DNS. In order to ping, run (from terminal or otherwise):

$ ping 74.125.132.147

That IP is actually from a Google server. If the problem is in the DNS, you will receive back using this command, but not using:

$ ping www.google.com

In which case you will need to change your DNS (depends on OS, but they are usually under your connection settings, together with IP, Gateway and Subnet mask settings). Try put the OpenDNS: 208.67.222.222 as primary DNS and  208.67.220.220 as secondary.

If both ping do not work, that could be due to invalid ping (rare), server down (rare), firewall blocking packets (quite rare) or most likely incorrect routing or missing connectivity.

2. Eliminating interface problems


Check that the local interface is working. It might have been shut down for some reasons or it might be broken. From a terminal, logged in as root, type:

# ifconfig

The output should include eth0 (and lo and wlan0 if you have a wireless connection). But we will care about eth0, being the cable connection. If the interface is on, you will see a line with

inet addr:192.168.0.4  Bcast:192.168.0.255  Mask:255.255.255.0

and it should say UP BROADCAST MULTICAST instead of BROADCAST MULTICAST. This is how the output should look like:

eth0      Link encap:Ethernet  HWaddr 00:1b:13:84:3g:4d 
          inet addr:192.168.0.7  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:2924 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2287 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:180948 (176.7 Kb)  TX bytes:166377 (162.4 Kb)
          Interrupt:16

You should see no (or just a few) errors, dropped, overruns or collisions. Each could give a hint towards the problem, but if you do see errors (say more than 1%) you should be warned that it is usually hardware problems (either local but also possibly not within your powers), but I will deal with them in section 4.

If your interface is down, instead, run:

# ifconfig eth0 up

And check with ifconfig again. If internet does work now, problem solved! Otherwise, continue (I will assume the interface is active now and working, if you can't manage to turn it on, it might likely be a distro-related problem).

3.  Eliminating Routing Problems


Sometimes, regardless of what your OS might be showing (Connection established icons or messages), it does not understand that it is connected, but routed badly (missing IP, different Gateway, DHCP conflict). That can result in a bad connectivity.

a. Try this command:

# route

and you will see an output of this kind:

Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1000 0 0 eth0
default 192.168.0.1 0.0.0.0 UG 100 0 0 eth0

where the last line is the one that matters. You will see your Gateway (check it is correct) and the flag UG, with the interface you are using, eth0. If you do not, try to receive the information about your gateway and run:

# route add default gw 192.168.0.1 eth0

and you should see your gateway appear under the route command again.

b. Try the command:

# arp -a

 and you will see an output of this kind:

? (192.168.0.1) at 00:1b:13:84:3g:4d [ether] on eth0

where in brackets it will be your Gateway. If you see this, instead:

? (192.168.0.1) at <incomplete> on eth0

There are problem, and most likely it will be a wrong setting for gateway, or DHCP conflict. Check you DHCP settings in the router again, as pointed in Section 1.d. If that does not work, continue.

c. Type:

# cat  /etc/network/interfaces

to show your /etc/network/interfaces file. It should look like:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

If instead of the last line, you have:

iface eth0 inet static
       address 192.168.0.2
       netmask 255.255.255.0
       gateway 192.168.0.1

it means that you are using a manual setting on your computer, so replace it with "iface eth0 inet dhcp" or configure IP settings correctly, making sure that all the addresses matches both on router and machine, and that DHCP is switched off on the router.

This should solve the routing problems and you should have a well connected router to your pc. If the internet connection is still not working, go to the next section.

4. Heavy duty tests


Before this, you should have solved your problem already, and if you are here, it means that something big is going on.

Run this commands:

# mii-tool -v

# ethtool eth0

# ethtool -S eth0

# netstat -i

They should give different outputs, but with visible errors, if there are any.
I will sum up the meaning of those errors:

Collisions: they usually happen within normal connection below 0.1% of the times. Poorly terminated cables or badly working networking card can increase such errors.

CRC errors: file transfer completed but with corrupted chunks in the transit. The presence of CRC errors usually hints toward electrical noise, such as damaged cable or non-properly connected cables.

FIFO and Overrun errors: this is usually a sign of excessive traffic

Length errors: this is most frequently due to incompatible duplex settings.

Carrier errors: faulty interfaces or networking equipment.

If you report such errors and/or still cannot manage your connection to work, it might be a problem which is not in your powers to solve. Try call your ISP.

5. Speed test


Your internet connection might be working now, but you want to test its speed. There are loads of online in-browser services to do that, but what I hate about them is the fancier and fancier flash interface they propose which literally slows down my not so powerful computer.

For this reason, I prefer to just see the speed of a file transfer and judge by myself the speed (in comfortable KB/MB [kilo/mega-byte] notation, not the annoying Mb [mega-bit], which is mainly used by big companies to confuse people about broadband speed). The way I do it is by using wget:

$ wget --output-document=/dev/null http://speedtest.wdc01.softla\
yer.com/downloads/test500.zip

This command will download a test file (no worries, redirected to /dev/null, so nowhere basically) and you will see the speed of download on screen. You can stop it anytime with Ctrl+C.


Hope this helped to solve your broadband problems or at least give you a better insight into it.


Wednesday, 26 September 2012

Quickly create new empty files on Gnome (Nautilus) desktops

I don't know if you, like me, use the Desktop as a place for urgent notes. I do, and a lot!

I create empty files and rename it with the note I want to write in it and dispose of them easily deleting them whenever I don't want the note to appear.

Unfortunately the way to create those files is not one of the nicest, if you are in a rush: right-click on Desktop, find Create Document and click on it, find Empty file and click on it.

That is why I found a quicker way using the keyboard:

- Right click on Desktop
- Press D and then Return

And you have a new empty file ready to be written!

Thursday, 16 August 2012

Mogrify: scale and crop multiple images in one command

When dealing with a lot of pictures, sometimes we want to make a common modification such as a change of resolution. In the case of multiple screenshots it is also common to crop all of the images at a fixed position (such as selecting only the same window).
Doing this job by hand, even just for three or four times, using the same parameters, is stressful and tiring, so we can ask for help to the terminal!

Mogrify is a command of the ImageMagick package and allows us to perform many operations on multiple images. In addition to scaling, resizing and cropping, mogrify can compress, convert, apply filter to images and much more.

Installation

For Fedora:
$ sudo yum install ImageMagick

For Ubuntu/Debian:
$ sudo apt-get install ImageMagick

Usage

The program overwrites the existing images, so, in order to prevent any unwanted modification, make a backup of the images or at least try the command on a sample image to make sure that it is the wanted modification.
Firstly, enter in the directory where the images that we want to modify are
$ cd folder_name

Then, say you want to scale the pictures to a resolution of 640x480:
$ mogrify -scale 640x480 *.* 
(note: if using the wildcard *.* , every single file in the folder will be modified by the command, so make sure that the folder contains only the files you want to modify or use different wildcards as *.jpg or e.g. *-2012.jpg)

If you want to scale the pictures keeping the aspect ratio, specify only the length in pixels and the height will be adjusted to keep constant the aspect ratio:
$ mogrify -scale 640 *.* 

Or using the same argument for the height instead of the width:
 $ mogrify -scale x480 *.* 

Or can also use a percentage of the original size, so if you want to halve the resolution:
$ mogrify -scale 50% *.*  

Or you can even modify only pictures bigger (or smaller) than the specified resolution and keep the others unchanged, respectively:
$ mogrify -scale '640x480>' *.*  
$ mogrify -scale '640x480<' *.*  


If you want to crop pictures in a window of 300x200 starting at pixels x=0 and y=100 where x is the offset in length from left to right and y is the offset in height from top to bottom, you need to use another option.
Since it is difficult to know the offset precise values a priori using gimp (a graphical editor) to take these values from the cursor position or selection can help. Then, use:
$ mogrify -crop 300x200+0+100 *.* 


If you want to compress images, use:
 $ mogrify -compress JPEG -quality 85 *.jpg 

where JPEG is the compression type and 85 is the quality for JPEG compression, which varies from 0 (lowest) to 100 (highest).


Or convert images from gif to jpeg format:
$ mogrify -format jpg -quality 85 *.gif


And rotate by an angle, e.g. 90 degrees:
$ mogrify -rotate 90 *.* 

Or if you want to rotate the image only in specific occasions, as if height is bigger than length (e.g. 480x640) (and viceversa), use, respectively:
$ mogrify -rotate '90>' *.*
$ mogrify -rotate '90<' *.*


Useful Links

Check out the official page of ImageMagick on Mogrify here, where you can find with more detail all the options of mogrify.

Saturday, 11 August 2012

How to reinstall the network-manager if you accidentally removed it

Using the aptitude package manager in Debian, I noticed a message that suggested me to use the command:

$ apt-get autoremove

This would have removed the unused dependencies following to having removed some unused packages. The list was long and I skimmed quickly through it, noting the fact that there weren't important packages, as someone would expect.

Unfortunately, the Gnome network-manager was included in the list, and when I run the command it removed my possibility to connect to the internet and even to re-install the network-manager itself!

In this ironic situation, angry by being tricked to run a damaging command, I was already thinking to reinstall Debian. But wait! That would be a silly move.

The solution


In order to have an internet connection, you don't need the network manager. If you still have ethernet available, grab that cable and open a terminal:

$ sudo ifconfig eth0 up
$ sudo dhclient




This will make your ethernet working even without the Gnome network-manager. After this, you can run a:

$ sudo apt-get install network-manager-gnome

and have your wireless connection working again.

A suggestion


Do not use the auto-remove command if you do not know what it is removing. It might be a vital component for your system and damage it heavily.

You can use the auto-remove with the simulate option first (-s), or just deactivate the auto-remove in /etc/apt/apt.conf 

 // auto-remove breaks on meta packages
APT::Get::AutomaticRemove "0";
APT::Get::HideAutoRemove "1";

// Recommends are as of now still abused in many packages
APT::Install-Recommends "0";
APT::Install-Suggests "0";
Debug::pkgAutoRemove "0";

// PDiffs reduce the required download for apt-get update, but increase the
// CPU requirements and quite often fail.
Acquire::PDiffs "0";

// Remove apt unauthenticated warnings
APT::Get::AllowUnauthenticated "0";

Saturday, 7 July 2012

Pdftk: How to merge two pdf documents

pdftk in terminal
Pdfs are an easy way to share documents through platforms without worrying about compatibility.

While this is clearly an advantage, pdfs lack the ease of modification that can be found in other documents types as Word documents. Essentially, pdfs are easy to read, but difficult to modify.

Fortunately, in Linux, there are many tricks to make the job easier. There is a piece of software called pdftk which allows great manipulation of pdfs.

Installation

Using Fedora:
$ sudo yum install pdftk

Using Ubuntu:
$ sudo apt-get install pdftk

 A few tricks to warm up

Pdftk allows to merge or split pdfs, rotate pdf pages, apply watermarks, attaching files to the pdfs, bursting the pdf in single pages, compressing it and repairing it in some cases, if corrupted.

In this post I will focus on how to merge pdf documents, but there is an extensive documentation on how to perform many other operations. That can be found on the PDFLabs website linked on the bottom of the page, or in the man pages.
The syntax to merge pdf files is relatively easy:
$ pdftk [input pdfs] cat output [output file name]

But its power comes from the possibility to use handles or wildcards. I'll provide a few examples.

To merge two pdf files into a file called combined.pdf :
$ pdftk file1.pdf file2.pdf cat output combined.pdf


If you want to merge all pdf files in the current directory can use the  wildcard *:
$ pdftk *.pdf cat output combined.pdf

 If you want to merge only specific pages of a pdf file with other pages of another pdf files (or the same) handles come handy:
$ pdftk A=file1.pdf B=file2.pdf cat A1 A2-10 B2 A3-7odd output combined.pdf

This may seem a bit complicated but I will explain: the input files are now called as two variables A and B, which are the handles. The codes in yellow are the rules to merge the two files, and it is here that lies the power of pdftk. It merges the pages from each file in the order we provide them. In this case:

   A1 = the first page of file1.pdf
   A2-10 = the pages from 2 to 10 of file1.pdf
   B2 = the second page of file2.pdf
   A3-7odd = the odd pages in the range from 3 to 7 of file1.pdf  (i.e. 3,5,7)

The even qualifier can be also used instead of odd, to take even pages only.

Main problem and solution

I came across pdftk when I needed to solve this problem:

I had scanned a set of papers through a fast document scanner, but since they were written on both sides, I found myself with two big pdfs, the first one containing odd pages only and the second one, containing even pages only, in reverse order!
I wanted a single file with the pages in the correct order but I could not find an easy way using a single command even using pdftk.

*** Update: This command would do the job for pdftk versions higher than 1.44:

 pdftk file2.pdf cat end-1 output - | pdftk file1.pdf - shuffle output combined.pdf

 Thanks to Andrew Peace ***

After some thinking I surrendered to the power of bash!

I decided to create a small bash script to form the command I needed to merge and order automatically the pages in a single file. For those who have done some basic bash, will immediately recognize the logic behind the script. For 50 pages pdfs:

#!/bin/bash
echo -e ' pdftk A=AQT.pdf B=AQTb.pdf cat \c'

max=50
for loop1 in {1..50}
do
    for loop2 in {A..B}
    do
    n=0
    if [[ ${loop2} == "A" ]] ; then
        let "n=$loop1"
    elif [[ ${loop2} == "B" ]] ; then
        let "n=$max-$loop1+1"
    fi
    echo -e  ${loop2}${n} '\c'
    n=0
    done
done

echo -e ' output combined.pdf \c'

Or you can download the script here and run it by simply typing:
$ ./pdftk_merge.sh

from the folder in which you downloaded the file.

The script prints automatically to the screen the command that you need to type (or better, copy) to merge the two set of pdfs! In this case the result is

pdftk A=file1.pdf B=file2.pdf cat A1 B50 A2 B49 A3 B48 A4 B47 A5 B46 A6 B45 A7 B44 A8 B43 A9 B42 A10 B41 A11 B40 A12 B39 A13 B38 A14 B37 A15 B36 A16 B35 A17 B34 A18 B33 A19 B32 A20 B31 A21 B30 A22 B29 A23 B28 A24 B27 A25 B26 A26 B25 A27 B24 A28 B23 A29 B22 A30 B21 A31 B20 A32 B19 A33 B18 A34 B17 A35 B16 A36 B15 A37 B14 A38 B13 A39 B12 A40 B11 A41 B10 A42 B9 A43 B8 A44 B7 A45 B6 A46 B5 A47 B4 A48 B3 A49 B2 A50 B1  output combined.pdf

Which, if executed from terminal, will correctly merge the two files in the right page order.

Useful links

Pdftk is a Pdflabs product: http://www.pdflabs.com. Many more examples on how to use it can be found here.


Friday, 29 June 2012

10 Nautilus tips and tricks

Nautilus is the file manager for Gnome. Gnome is a GUI for many Linux distributions and it is my favourite so far.

A file manager is the program that manages and lets you access your files. In plain words, it is the window with folders and stuff in it. Knowing how to use it properly can let you save a lot of time (unless you want to use the terminal, which could be even faster), so here is a list of a few tips and tricks to improve your file managing experience!

You can open a new window from terminal (if you have Gnome) with the command:

nautilus &

1. Change default "Open with" program for an extension

A quite common problem is the one of changing the default program with which a file is opened. If you have a Windows background, you'll endlessly search in the "Open with" from the right-click menu, but you will not find the answer there. Fortunately, the solution is easy:

-   Right-click on file with interested extension
-   Click on "Properties" at the bottom of the menu
-   Go on the "Open with" tab
-   Select wanted application and click on "Set as default"

Now the application you selected will be used by default as main application to open the files with the same extension with a double-click.


2. Multiple Panes in one window

Sometimes we want to move files from one folder to another and it would be convenient to have both folders somehow open in the same window to ease the transfer. This is possible!
In a window, just press the F3 button and a new pane will appear (initially with the same folder showing to both frames). You can switch from a pane to another just clicking on the wanted frame.


3. Select items matching a pattern

If you want to select multiple files with a certain name only or, say, with the same extension, there is an easier way rather than doing that manually!

Press Ctrl+S in a window and a dialog will open asking for the pattern. You can use the power of wildcards in this window!

The wildcards you can use are * and ?. Their working is very simple. Whenever the find program sees a *, it substitutes any random string in it. Basically, if you type just: * . It means everything.
For the ? wildcard, instead, it will replace only one character. Then, typing ????? will match any string containing 5 letters or numbers, including the extension.

It should be now clear how powerful can it be using wildcards for selecting files. I will provide a few examples:

*.jpg
Will select every file with extension .jpg, i.e. every image in a folder.
*2012*.jpg
This, instead, will select every picture in the folder containing 2012 in its name (note that *2012.jpg will only look for pictures having 2012 at the end of the filename, and viceversa for 2012*.jpg).
*.*
This will select all files (while * would also select folders).
???.*
This will select any file that contains 3 characters, such as lol.jpg or asd.txt.


4. Move, Copy, Link

You can use the click-and-drag options also present in Windows under Nautilus:

-   If you click and drag files without pressing any additional key, it will chose what to do depending on the destination. It will move files if the destination is local (same hard disk) and copy if the destination is not on the same File System (external drive).
-   If you click and drag pressing the Ctrl key, it will copy the files in any case.
-   If you click and drag pressing the Shift key, it will move the files in any case.
-   If you click and drag pressing both the Ctrl and Shift key, it will create a (soft) link to the files.


5. Move windows from anywhere

For users with low resolution screen, it may happen that some windows have the title bar (to move it) outside the borders of the screen.
This is quite annoying and it may be even impossible to close it, as the X button is hidden.
In order to move the Window, though, you can keep pressed the Alt key and left-click anywhere inside the window to move it!


6. Resize windows from anywhere

Similar to the previous one, but press Alt and middle-click with your mouse to resize the window without having to hunt for the border!


7. Run common scripts with one click

Nautilus has a default script folder in which you can put your bash scripts and run them by just selecting them (e.g. a script to remove files older than a certain date, or a script to clean the name of the selected files... you can really use your imagination here).

This is extremely useful and you can either download bash scripts or make your own. You just need to right-click and then select the "Scripts" menu, then the script which you want to run. You may find the script folder empty, initially.

In order to add your scripts to the list, you need to put your scripts in the scripts folder for nautilus. You can open it clicking on "Open scripts folder" from the same "Scripts" menu, but it is usually located in ~/.gnome2/nautilus-scripts . 


8. Quickly check number and size of multiple files

If you need to quickly know how big is a collection of files, it will be necessary to select them and check the bottom right corner of the folder. The number of the files selected, together with their total size is displayed in a pop-up balloon.


9. Keyboard shortcuts

This is a list of shortcuts to quickly perform the underlined actions. For some of them (e.g. Rename) you need to highlight a file first.

Rename: F2
Create new folder: Shift+Ctrl+N

Cut: Ctrl+X
Copy: Ctrl+C
Paste: Ctrl+V
Select All: Ctrl+A
Invert Selection: Shift+Ctrl+I

Add to Bookmarks: Ctrl+D
Search for Files: Ctrl+F

Move to Parent folder: Alt+↑
Move to Selected folder: Alt+↓
Move back: Alt+←
Move forward: Alt+→


10. Gnome 3 window tricks

This tricks will work only with Gnome 3.

Expand window: you can double-click on the title-bar to expand a window in any Gnome, but with Gnome 3 you can drag the title bar and push the window to the top to automatically expand it.

Divide screen between two windows: drag the window from the title bar and push it to the left (or right) to expand the window to half the size of the screen.

Open the activities: without clicking, push your mouse to the top right corner. This will open the "Activities menu".