Showing posts with label Terminal. Show all posts
Showing posts with label Terminal. Show all posts

Wednesday, September 30, 2009

Diff List with Files Names Only

diff -r -q directory1/ directory2/

List Files by Time

ls -lt -c -R

Compress / Extract Directories to Tar.bz2

Compress
tar -jcvf filename.tar.bz2 directory/ -R

Extract
tar jxvf filename.tar.bz2

Secure Copy Files with SSH

scp -r /pathtofolder/ name@host:/targethetfolder/

Wednesday, July 15, 2009

Ubuntu Read line from file

Cool command of the week... "head"

Head reads part of a file, this an be done by lines, or by bytes. It's faster by bytes, for obvious disk IO reasons, but line numbers will probably be more useful in most cases anyway.

Here's a sample....

head -n 99000000 mozdl.tsv | tail -n 1;

-n 99000000 tells the machine to read from the 99 millionth line of mozdl.tsv

| tail -n 1 tells the machine how many lines to output from where it began... one

I find myself using this command a lot, especially with bytes to jump around a file to sample data without having to expend cycles processing \n characters.