Originally posted by: Loco3KGT
Originally posted by: Electrode
Alright then, I suppose I will begin things:
Q: How do I unpack a .tar.gz or .tar.bz2 file?
A. tar xzvf filename (it it's a .tar.gz)
tar xjvf filename (it it's a .tar.bz2)
that's actually wrong. it depends on the version of tar that you're using.
Recent versions of GNU tar will do this just fine. Sun's tar will not unzip anything though.
EDIT: Ive been working on this a little bit (and still have plenty of work to do on it). Sorry Electrode
Getting help:
man command - Almost always shows you the manual for the specified program. When told to 'RTFM', this is what you must do.
man -k word - Kind of like a search engine for man.
Moving around the file system:
Navigating the Unix file system is very similar to DOS. Some of the commands are a little different, but they generally behave the same.
cd dirname - Changes to the specified directory.
cd .. - Changes to the parent of the current directory.
pwd - Prints the current directory. Usefull if, for whatever reason, your prompt doesn't give this info.
ls - Directory listing. use the -lh switch to get a detailed listing. Use the -a switch to show hidden files.
Archives:
tar xzf file.tar.gz - Unpack a .tar.gz file. Doesn't work in all systems. I believe this is a feature of GNU tar and the tar on Solaris will not have this functionality. Use gtar if you want this feature. BSD's tar should have this functionality also.
tar xf file.tar - Unpack an uncompressed .tar file.
gunzip file.gz - Uncompress any .gz file, tar or otherwise. If the file you are decompressing is a .tar.gz, it will not be unpacked, it will simply become a normal .tar file.
uncompress file.Z - Uncompress any standard .Z (compressed using the compress command) file.
bunzip2 file.bz2 - Uncompress any .bz2 file.
tar cf file.tar dirname - Put the contents of a directory into a .tar file.
gzip file - GZip compress a file.
bzip2 file - BZip2 compress a file. This is a pretty good compression method, it would be the suggested method if it was more standard on various Unix and Unix-like systems.
Viewing and editing files:
cat - Outputs the contents of a text file to stdout. Only useful on small files or simple manipulation.
more - A somewhat simple text file reader. The SPACE bar moves you one page forward, the ENTER key moves you one line forward, and many times the "b" key will move you one page backwards.
vi file - A really nice text editor, albeit a bit tricky to use.
Environment variables:
PATH - Tells the shell where to look for programs if you don't tell it exactly where it is. It works like the DOS PATH variable, but with colons ) instead of semicolons ( to seperate the entries. For example: /bin:/usr/bin:/usr/local/bin:/opt/bin:/usr/X11R6/bin:/opt/mozilla
ie. (for Bourne based shells)
PATH="$PATH:/usr/local/bin"
export PATH
DISPLAY - Tells the machine where to display graphical applications
ie. (for Bourne based shells)
DISPLAY="name_of_machine:0.0"
export DISPLAY
export - In Bourne based shells (ksh appears to be default on Solaris), this command is used to set an environment variable.
setenv - csh based shells use the setenv command to set environment variables. ie.
setenv PATH "$PATH:/usr/local/bin"