-tar (-c for create, -x for extract) - tar alone simply creates a collection (Tape ARchive) of uncompressed files.
tar -cvf result.tar file1 file2 file3
tar -xvf file.tar
NOTES: compression algorithms:
-add -j for bzip2 compression (AMAZING for plain english text i.e. 200M down to 14M). result file extension: .tbz or .tar.bz2
-add -z for gzip compression (good for general use). result file extension: .tgz or .tar.gz
-rar (a for add)
rar a output.rar file1 file2 file3
-unrar (e for extract)
unrar e file.rar
ADDITION: see extractrars script in Linux>shell scripting
The most important tool you will need: rsync. It copies changes between 2 directories (potentially on 2 different servers)
rsync -av src_dir/* user@server:/dest_dir/
-a means archive mode, which means recursive, preserve permissions, last modified time etc
-v means verbose
--exclude .svn means ignore all paths that contain .svn i.e. all svn folders and their contents!
NOTE: exclude can also be used to match specific files e.g. --exclude docs/readme.txt
--delete means if you have deleted a file in the source dir, delete it at the destination dir too!
Add these to the end of your ~/.bashrc
# how I like ls to work: coloured, grouping directories first, and appending '/' to them so they are clear i.e. "home/"
alias ls='ls --color=auto --group-directories-first -p'
# a common alias: ll for human readable list form
alias ll='ls -hl'
# little simplification for getting the size of a directory
alias dirsize='du -sh'
# disk space (i have added a grep to customise the output, which is specific to my partition setup)
alias diskspace='df -h | grep /dev/sda'
# alias grep for highlighted search terms and case insensitivity
alias grep='grep -i --color=auto'
GENERAL NOTE: can put quotes around pattern if contains spaces
GREP searches INSIDE the given stream/file(s) for the pattern string
grep [options] pattern [stream/file]
EXAMPLES
grep -lir jack csYear3 ~ searches INSIDE all files in the given dir (csYear3) for the string "jack" (-l means output filenames not lines, -i = ignore case, -r = recursive)
grep -i dijkstra /home/jack/essay.txt ~ returns lines of the file essay.txt containing the word dijkstra
chmod: CHange access MODe
USE
chmod <u/g/o/a>=<r/w/x> <file/folder>
EXPLANATION
u/g/o/a - user/group/others/all
r/w/x - read/write/execute (or all 3)
e.g. chmod o=r doc1.txt