Archive for May, 2008

Sed Regular Expression Range

Print the contents of a file from a given regular expression to another


sed -n '/start/,/end/ p' file

This will print the contents of the ‘file’ from the line that matches /start/ until the line that matches /end/

Find New Files

Search files created or changed within 10 days


find /usr/bin -type f -mtime -10

Share Current Folder over the Web

Want to show something on your machine to someone over the web? Don’t copy it or upload it somewhere. Just run “webshare” and the current directory and everything beneath it will be served from a new web server listening on port 8000. When your pal is finished, hit control-c.


python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"

For a slightly more advanced version of this server, see this article(Warning: German Article – but code is self explaining)

Display a Small Notification Dialog

This command shows a notice in GUI and disappears after a few seconds…


notify-send "Hello There"

Convent Ico to Gif

This will convert all the ico files in the folder to gif. It uses the final frame of the ico file to create the gif.


for i in *.ico; do convert `mogrify -identify $i|awk '{print $1}'|tail -n1` $i.gif;  done   

Using Rar in Linux

Create an archive rar called ‘file.rar’


rar a file.rar test_file

Perl Joke

Just a joke – no offense intended…


perl -e '$a="etbjxntqrdke";$a=~s/(.)/chr(ord($1)+1)/eg;print $a'

Create a config file for DosBox in Linux

If you are using dosbox to play old games in linux, you can use this command to create a config file. First open the dosbox console by typing ‘dosbox’ in your terminal. Then type in this command…


CONFIG -writeconf dosbox.conf

The file ‘dosbox.conf’ will be created in your home folder

Original Source

Find Duplicate Lines

Sort contents of two files by viewing only duplicate line


sort file1 file2 | uniq -d

Copy all Txt Files

Find and copy all files with ‘.txt’ extention from a directory to another


find /home/binnyva -name '*.txt' | xargs cp -av --target-directory=/home/backup/ --parents