Gzip
From Waisman Brain Imaging Wiki
'gzip' compresses files so that they take up less disk space, yet can be quickly restored when they're needed again. This can be very handy when the lab file servers are getting full. To compress a single file:
gzip myFile
When 'gzip' finishes, "myFile" will be replaced with a new file called "myFile.gz", which (hopefully) is smaller. 'gzip' can squish some files down to 10% of their original size or less; other files won't squish at all. Generally speaking, the more repetitive / less noisy the contents of a file are, the better 'gzip' can mush it. Sad to say, this means that EEG data (which wiggles constantly and has a lot of noise in it) is not a great candidate for 'gzip'. Some imaging data can be, though, if it isn't noisy or has had the noise filtered out.
To restore the file:
gunzip myFile.gz
If you want to compress all of the files in a directory, you can use the "-r" (recurse through directories) option to tell 'gzip' to compress everything it finds under the specified directory:
gzip -r myDirectory
If the files to be compressed are large, or there are a lot of them, 'gzip' can be a real CPU and network hog, so to be nice to your fellow labbies, run it like this:
nice gzip -r myDirectory
And to restore all the files under "myDirectory":
nice gunzip -r myDirectory
Back to UNIX

