Wednesday, February 27, 2008

Some UNIX CLI tips

# Make complex directory stucture with one command
mkdir -p project/{lib/ext,bin,src,doc/{html,info,pdf},demo/stat/a}

# Extract to a particular directory that you're not currently in
tar xvf -C tmp/a/b/c newarc.tar.gz

# Use 'grep -c' instead of 'wc -l' to count lines
grep -c blah

# Matching a pattern in a particular field in a file
ls -l | awk '{print $6}' | grep Dec # BAD
ls -l | awk '$6 == "Dec"' # GOOD



0 Comments:

Post a Comment

<< Home