Posts tonen met het label linux. Alle posts tonen
Posts tonen met het label linux. Alle posts tonen

maandag 30 juni 2008

filenames beginning with a - (dash)

If you want to (for example) cd to a file starting with a dash (some mac users tend to use weird filenames like "-folder" ). do

$cd ./-folder

removing files matching a certain pattern

from the xargs man:

delete all .svn folder

$find /somedir -name .svn -print0 | xargs -0 /bin/rm -rf

xargs comes in handy when handling great amounts of files.

donderdag 26 juni 2008

replacing text in a bunch of files matching a certain pattern

Replace comes with mysql. It's a handy tool for sed/awk n00bs. This one I used to change some static paths while excluding all .svn folders and logfiles.

~$ replace '/var/www/mydir' '/var/www/newdir/' -- `grep --exclude-dir=.svn --exclude=*.log -clr "/var/www/mydir" ./*`

Of course there are other/better ways to accomplish this, look at this
http://www.brunolinux.com/02-The_Terminal/Find_and%20Replace_with_Sed.html

donderdag 19 juni 2008

page up / page down bash

add these lines to your /etc/inputrc to search backwards through history. It searches on the string already typef


"\e[5~": history-search-backward
"\e[6~": history-search-forward