TAR is a linux command that makes it easy to wrap up entire files & directories and put them into one file that can be moved to another location. Basically it creates a tape archive (TARBALL) of your files, allowing you to extract them later on and even compress their contents via BZIP; plus it’s really fast!
tar -cvvf backup.tar work
…creates a tar file named work.tar which contains everything in work directory and recursively everything beyond
tar -cjvf backup.tbz work
…adding -j enables tar to compress files & directories with bzip, backing up everything in the work directory and everything beyond. note the different extension used -> .tbz denoting it’s a compressed archive
tar -xvvf backup.tar
…extracts / untar’s everything from the work.tar tarball inside the directory your in
if bzipped, extract with…
tar -xjvf backup.tgz
or gzipped, extract with…
tar -xcvf backup.tar.gz
GZip is essentially a free version of winzip without the you-gotta-pay-for-it stamp. Now used on it’s own it works on single files turning them into gzipped .gz files, with TAR and it allows you to gzip tons of files (see examples above).
to gzip a file do…
gzip myfile.txt
…this gzips it to myfile.gz
to extract the gzipped file do…
gunzip myfile.gz
tar -zcvf backup.tgz .
tar -xzvf backup.tgz
The following is a short guide on using the Linux VI editor (aka VIM) and a few helpful Linux console commands you may need…
h4. VI Editor
this is an inline text editor which is used within your terminal window to create & edit text files on your system, usually used remotely to setup servers it’s not that hard to get a handle round,
vi filename.txt p. …this will open the VI editor and create a textfile called filename.txt. VI will initally open in INSERT mode so you can just start by adding text to your file like any other editor.
p. …to switch to COMMAND mode, hit the ESC key, the status-bar on the bottom will change to reflect this, now to quit and save your file type :wq and hit enter.
p. …to switch to INSERT mode, press shift + i
p. …if you don’t want to save the file & just quit, type :q! and hit enter.
The VIM editor is a really powerful tool and I’d recommend you to read this guide to get you up to speed if you want to do more advanced things, but this should be good enough to get you going.
h4. Linux Commands
In the terminal window, you can do the following to access & navigate your Linux system:
CD .. p. …this moves you down one directory from where you are
CD mydir p. …moves you to the mydir directory
MKDIR foo p. …creates the directory foo
RM -fr foo p. …deletes the directory foo and any other files & directories within it
MV [from] [to] p. …moves a file or directory from one location to another
PASSWD p. …change current password
Enjoy, will update later,