Live Chat!

what is your 10 common linux commands?

* * * * * 2 votos

October 27th, 2007 mysurface

Dear command line ninjas, Mr CLI and keyboard pianist:
What is your regular command you use? I am sure you must thinking of ls and cd. Yeah, they are common for every users, but how about the rest of them? I have construct a combos of commands to help you identify your top ten linux command. [...]

Posted in Common, awk, column, grep, head, history, nl, sort | Hits: 23129 | 21 Comments »

CLI magic: programable bash completion

* * * * * 3 votos

May 4th, 2007 mysurface

Ubuntu, a Linux distribution that is getting popular because it has successfully improves it’s user friendliness with simple User interface. You can install any applications with few clicks, configuration under GUI dialogs etc. People usually have the thinking of maybe one day, Ubuntu will become another new operating system like Microsoft Windows.
Never! The concept of [...]

Posted in Bash, apt-cache, apt-get, complete, pipeline, sort, svn | Hits: 29476 | 5 Comments »

Sort grep -c results

          0 votos

April 17th, 2007 toydi

grep -c “TODO:” *.c

foo.c:1
bar.c:0
spam.c:44
egg.c:32
matrix.c:0
grep -c displays the total count of matching lines for each input file, just like above.
Now, to sort the results by total count:
grep -c “TODO:” *.c | sort -nt: -k2

bar.c:0
matrix.c:0
foo.c:1
egg.c:32
spam.c:44
It sorts the list by total count or the 2nd field (-k2) by comparing them as numbers (-n). Don’t forget to [...]

Posted in Text Manipulation, grep, sort | Hits: 15297 | No Comments »

Uniq and basic set theory

* * * * * 1 votos

October 25th, 2006 toydi

Imagine that I have two files:
aquatic - contains a list of aquatic animals
starfish
whale
nemo
crab
dolphin
mammal - contains a list of mammals
whale
RMS
batman
dolphin
scooby-doo
Given aquatic and mammal are two different sets, let’s use sort and uniq to play with a few basic set theory operations:
Union ( A U B - members in either A or B )
aquatic U mamal= {batman, [...]

Posted in Text Manipulation, sort, uniq | Hits: 5541 | 1 Comment »