Live Chat!

write a online manga downloader using bash

          0 votos

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, Text Manipulation, seq, wget | Hits: 22469 | 4 Comments »

stupid way to make mplayer repeatly play

          0 votos

November 3rd, 2007 mysurface

I am so desperately wanna make mplayer repeat a song, somehow I obtain a song in flv format. I fail to figure out how to make mplayer repeat, so here make a stupid workaround with bash for.
for (( ; ; )); do mplayer nicesong.flv; sleep 0.1; done
Kill it by hitting ctrl+c two times very fast!
heh! [...]

Posted in Bash, for, mplayer, sleep | Hits: 21413 | 12 Comments »

A Bash Completion Tip

* * * * * 1 votos

October 25th, 2007 mysurface

Bash Completion is a powerful CLI magic for bash user, it allows users to hit tabs and have auto completions on command lines. If you have no idea what is bash completion, check out CLI magic: programmable bash completion.
One of the features bash completion gives you is to hide the unknown file format from tab [...]

Posted in Bash, complete | Hits: 11099 | 3 Comments »

How to list just directories

* * *     2 votos

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 list just directories [...]

Posted in Bash, Text Manipulation, column, find, grep, ls | Hits: 24792 | 8 Comments »

Writing scripts that needs root permission

* * *     1 votos

September 2nd, 2007 mysurface

While executing commands that needs root permission, I rely on sudo. Sudo provides me a very convenient way to execute root privilege commands from my user account provided with my user account password.
Sudo and su are not the same, check out more from here.
When comes to scripting, I couldn’t use sudo directly. For examples I [...]

Posted in Admin, Bash, sudo | Hits: 22887 | 3 Comments »

extracting substring at bash

* * * * ½ 4 votos

June 28th, 2007 mysurface

Extracting sub string at Bash is very easy, let say you have a phone number 012-4567890 and you just wanna extract 4567890 out, you can do as below.

num=”016-4567890″;
echo ${num:5:7}

5 is the starting point and 7 is the string length for sub string.
Related PostsA Bash Completion TipBash Completion is a powerful CLI magic for bash user, [...]

Posted in Bash, Text Manipulation | Hits: 25490 | 12 Comments »

CLI Magic: command not found, suggest what to apt-get

* * * *   3 votos

May 5th, 2007 mysurface

I have recently upgrade my Ubuntu Edgy to Ubuntu Feisty and I discover a fantastic CLI magic packaged with Feisty, its call command-not-found. With command-not-found package, when you have type some command that doesn’t exist in your terminal, it will suggest you what to install.
Let say I type trafshow, which It is not installed, the [...]

Posted in Bash, apt-get, command-not-found, which | Hits: 25851 | 4 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: 28322 | 5 Comments »

Bash: timed read input

* * * * * 2 votos

March 13th, 2007 mysurface

For some critical task, you just can’t wait for user response forever. If the user do not respond to input after certain period of time, you will use the default value and carry on the process. The bash command read have such capability to support that.
A simple example to illustrate how it works
answer=”yes”;read -p “Are [...]

Posted in Bash, read | Hits: 12143 | No Comments »

download multiple files from a site using for loop like c in bash

* * * *   4 votos

February 7th, 2007 mysurface

Batch download using wget seems to be not working anymore, a lots of web site used to protect the particular directory from being browse. But if you know the filename of the files, you still can do a batch download by writing a custom bash script.
Recently I discover a site which allows you to [...]

Posted in Bash, for | Hits: 14268 | 6 Comments »