Unix/Linux 101 – Compression & Useful Tools
Appendix B: compressing and uncompressing
Sometimes you will come across compressed files you need to uncompress, or have the need to compress a bunch of files to send through email or what not. There are several formats you can use – Compress/Uncompress, Pack/unpack, Zip/Unzip. Compress and uncompress replace your file/s with the data:
# compress data
will replace the file data with a compressed file called data.Z uncompress will reverse that. “zcat” works similarly as uncompress. Pack and Unpack can be found only (or mostly) on IRIX. Zip and Unzip are straight-forward:
# unzip filename
# zip filename
(more options in the man pages)
Tar file and gzip are used together quite often. Instead of me explaining the flags which you can check in the man pages, I’ll just write the simplest way to write a tar-gzip file (.tgz/.tar.gz) and the simplest way to extract it:
# tar -cf archive.tar *
# gzip archive.tar
These two lines first create a tape-archive file called archive.tar which stores all the files in the current directory (“*”). It then compresses that file with “gzip” and the final file can look like any of these (depending on the system):
archive.tar.z
archive.tar.gz
archive.tgz
Typically it will be “archive.tar.gz”.
To extract files:
# gzip -cd archive.tar.gz | tar -xf -
Appendix C: some useful tools for artists
Very briefly, I will jot down a few commands artists might find useful. These days there are so many GUI (graphic user interface) programs that replace many of these, still, it might be useful to know some of them. most of these commands can be found in the “/usr/sbin” directory.
To view images, use either “imgview” or “fcheck” which comes with Maya.
For supported image formats type “imgformats”
To change image formats you can use the “imgcopy” command:
# imgcopy test1.rgb test1.jpg
While scripts can be written to convert multiple images to a different format, or just rename them, the “imgcopy” command these days can do all of that in one line.
The command “compview” can be used to change the JPEG compression.
Use “dmconvert” for many media conversion. It handles audio, movies and many more. Check the man pages.
Small tip – if your machine is frozen, you can reset the machine with “the claw”: “Left Ctrl” + “Left Shift” + “F12″ + “/ on number keypad” This works only on Silicon Graphics machines.
Unix Conclusion
The commands shown in this article have far more to them than shown. I can’t stress enough to use the “man” command to explore them further. See the related commands at the bottom of the “man” pages to learn more commands relating to what you’re looking for.
There are some topics that I feel are important to know, but might not need to be that important for beginners. I will cover those in my next articles. Some of these are the usages of the c-shell (aliases, history, repeating commands, sets, variables , job control, etc.), the c-shell configuration file (.cshrc), the login configuration file (.login), scripting and more.
You can find plenty of information through the “man” pages and the Internet.
Good Luck!
Tags: Dani Rosen, linux, tutorial, unix






Sat, Jan 5, 2008
Unix/Linux