Quick tip: Using sort on large files

When using the sort command on a 2GB file, with a small /tmp (mine was 16M at the time), it failed with the following error…

sort: write failed: /tmp/sort9tRGAQ: No space left on device

I briefly considered that I may need to expand my /tmp partition, until I consulted Google and found a much easier solution – make sort use an alternate location for its temporary files with the -T switch, as follows:

sort -T /path/to/alternate/tmp

Leave a Reply

Your email address will not be published. Required fields are marked *