foxfirefey: Fox stealing an egg. (Default)
[personal profile] foxfirefey posting in [community profile] command_liners
UNIX tips: Learn 10 good UNIX usage habits, as follows:

  • Make directory trees in a single swipe.
  • Change the path; do not move the archive.
  • Combine your commands with control operators.
  • Quote variables with caution.
  • Use escape sequences to manage long input.
  • Group your commands together in a list.
  • Use xargs outside of find .
  • Know when grep should do the counting -- and when it should step aside.
  • Match certain fields in output, not just lines.
  • Stop piping cats.


I learned a couple of things from this one!

Date: 2011-11-24 06:50 am (UTC)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
From: [personal profile] afuna
Ooooh interesting, thanks! *bookmarks to read later*

Date: 2011-11-24 10:27 am (UTC)
floatboth: (Default)
From: [personal profile] floatboth
Also, $(command) instead of `command`.
And ack is better than grep.
Get moreutils and pipetk.

Thank you for this! :-)

Date: 2011-11-25 07:19 pm (UTC)
From: [personal profile] babysprite

It's always good to pick tips and tricks, wherever they can be found.

The point with me is that I can always learn more to be a better UNIX user.

Date: 2011-11-26 04:16 am (UTC)
vaxhacker: (Default)
From: [personal profile] vaxhacker
I never understood why so many people got in the habit of doing "cat file | ...". These are good for people to know. :)

Date: 2011-11-28 10:15 am (UTC)
From: [personal profile] tara_hanoi
Yeah, it always gets me when I see people do "cat $file | more" in work.

That said, while I'll always do "$cmd $file | ..." there is one thing to be said for the "cat $file | ..." style: when you're working on your super-huge command-line and you're still fine-tuning all the commands you're piping through, it's easier to leave the "cat $file" bit untouched, and then chop and change your filter commands ("Hmmm, maybe I want to swap the first grep and awk"), and tidy it up when you're done. If you're just testing how you're going to order your commands, then an extra fork/exec and pipe isn't going to kill you. :)

Date: 2012-02-09 11:28 pm (UTC)
tcpip: (Rats)
From: [personal profile] tcpip
Listing #4 is a very good habit which I should cultivate.

And nobody should pipe a cat. Cats are perfectly capable of getting into pipes themselves.

Profile

command_liners: A command line prompt with a blinking cursor after it, green against black. (Default)
Command Liners

September 2014

S M T W T F S
 123456
78910111213
1415 1617181920
21222324252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 20th, 2017 10:04 pm
Powered by Dreamwidth Studios