rpm and yum rescue tips on Fedora

April 22nd, 2008 mysurface

You have to be careful when you run yum update and yum install, DON’T force kill it, kill -9 or pkill -9. Those action are consider very dangerous, may lead you to losing certain files. Seriously, I hate yum, when I really wanna cancel the process in the middle, by hitting ctrl+c doesn’t really work! […]

Posted in Admin, awk, rpm, which, yum | Hits: 95396 | 3 Comments »

Obtain some system statistics from vmstat

December 8th, 2007 mysurface

vmstat know as virtual memory statistics reporter, but it gives more information the just only virtual memory. Besides memory, it covers overall CPU usage, IO, Swap, Proc, System interupts and context switching. vmstat is pretty easy to use, ignores all other options, the normal usage will be looks like this: vmstat [delay] [counts] Let say, […]

Posted in Admin, date, tail, vmstat | Hits: 121644 | 12 Comments »

How to redirect output to a file as well as display it out

December 6th, 2007 mysurface

To redirect standard output to a file is easy, you just need to use the redirection symbol, for example: echo “hello world” > test.txt But what if I want to display it out as well as store into a file? Answer: tee echo “hello world” | tee test.txt Okay it seems very easy, how about […]

Posted in pipeline, python, tee, Text Manipulation | Hits: 367820 | 49 Comments »

write a online manga downloader using bash

November 29th, 2007 mysurface

There are plenty of site that allows you to read manga online, but you have to tolerate for the slow access and ton’s of heavy loaded ads. You can’t download the manga directly using batch download provided by wget or any download manager. but if you know how to do bash script, you could somehow […]

Posted in Bash, seq, Text Manipulation, wget | Hits: 124092 | 10 Comments »

pcregrep, grep based on perl compatible regular expressions

November 20th, 2007 mysurface

grep supposedly support perl regex by specified -P option, but somehow my grep do not support that, it complains this when I trigger with -P grep: The -P option is not supported But when you check the manpage of grep, you will see this -P, –perl-regexp Interpret PATTERN as a Perl regular expression. I found […]

Posted in pcregrep, printf, Regular Expression, Text Manipulation | Hits: 164410 | 3 Comments »

what is your 10 common linux commands?

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 […]

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

rm complains argument list too long

October 20th, 2007 mysurface

There is a limitation of rm command, where you can’t delete a large groups of files with *. For examples, rm -rf something* If there are large amount of files initiate with something, rm will fails and complains /bin/rm: Argument list too long. The solution is to make use of find, xargs and rm. find […]

Posted in Common, find, rm, xargs | Hits: 77588 | 6 Comments »

How to list just directories

September 19th, 2007 mysurface

There are no such direct ways to list only directories using the UNIX/ linux famous command ls. Anyway with command combo’s, we can achieve the goal in two ways shown as below. 1. use ls -l with grep 2. use find -type d ( The statement above is WRONG, check out the simple way to […]

Posted in Bash, column, find, grep, ls, Text Manipulation | Hits: 143519 | 14 Comments »

What is my Public IP Address?

August 22nd, 2007 mysurface

What is my public IP address? There is a lots of website can provide you the information. What if I wanna grep it for my script? We can use curl and grep for this purpose. First, lets pick few websites that provide the service to reveal my public IP. http://www.ipchicken.com/ – the chicken looks so […]

Posted in curl, egrep, grep, Misc, Text Manipulation, wget | Hits: 147750 | 20 Comments »

grep multiple lines

August 9th, 2007 mysurface

You can grep multiple lines before or after matching the keywords. Here is a simple tips, that what I discover grep capable of. A is after, B is before. Let say you have the message.txt shows as below: Aug 5 02:43:12 zion kernel: [ 0.000000] Zone PFN ranges: Aug 5 02:43:12 zion kernel: [ 0.000000] […]

Posted in grep, Text Manipulation | Hits: 158544 | 24 Comments »