Kategorie: Debian
17.01.09
ack-grep - a source-aware grep replacement (searching for content in files)
Link: http://petdance.com/ack/
ack (or ack-grep) is a nice "grep" replacement, when searching in a directory with source files.
It does not require any path to start searching and the recursive option is enabled by default. Also, it will exclude directories of version control systems (like .svn, CVS, .bzr, .git) and nicely formats hits.
E.g., "ack-grep foo" will search all (relevant) files in the current directory for "foo". And if the current directory is under source control, it will be much faster than using "grep -R foo .", since it excludes the control directories. (Ye
I haven't tinkered with its options or man page, although I'm using it since quite some time now, since the defaults are so good already and it provides a great out-of-box experience and performance boost.
The man page states when to use the "normal" grep:
WHEN TO USE GREP
ack-grep trumps grep as an everyday tool 99% of the time, but don’t throw grep away, because there are times you’ll still need it.
E.g., searching through huge files looking for regexes that can be expressed with grep syntax should be quicker with grep.
Additionally, "grep" appears to be still more useful when chaining commands, e.g. to find all references of "css" in the file list of "ack-grep" ("dpkg -L ack-grep | xargs grep css"). When using ack-grep here, it will also recursively search in all listed directories (as in "for i in $(dpkg -L ack-grep); do test -d $i && echo $i; done").
On Debian/Ubuntu, ack-grep is only a "sudo apt-get install ack-grep" away.. ![]()
(The ack homepage has some convincing Testimonials, too)
23.04.08
Track changes to /etc (configuration files) with etckeeper
I'm currently setting up my new dedicated server and one of the first packages I've installed there has been etckeeper, to keep track of any changes to files in the etc (configuration) directory.
Etckeeper supports various VCS (version control systems), namely Git, Mercurial and bzr.
Bzr support is available in Ubuntu since "Hardy".
I've chosen to use "bzr". If you want to stick to the default (git), just leave out the bzr related stuff:
# Install etckeeper and bzr:
sudo apt-get install etckeeper bzr
# Read the fine documentation:
zless /usr/share/doc/etckeeper/README.gz
Quick walkthrough:
# Edit the config, chose the VCS to use:
sudo sensible-editor /etc/etckeeper/etckeeper.conf
=> VCS=bzr
# Init the repository:
sudo etckeeper init
# Verify that the file list is OK and commit:
cd /etc
sudo bzr commit -m "Initial checkin"
Now, whenever you use "apt" to install or remove programs, it will commit any changed files before and after the action (if there are any changes - not all packages install files into /etc).
Because "/etc" is now a regular repository, you can also manually commit any changes there, e.g. when editing some configuration file.
If you don't manually commit any changes, they will get picked up during the next run of apt automatically.
This is of course highly recommended for Desktop systems, too: you can always look up what changes to the system configuration have been done (including the exact time when you or somebody else has installed a particular package).
Give it a try, it won't hurt ![]()
Update: Thierry Carrez has written some chronicle articles about etckeeper
20.12.07
Binäres Debian-Paket manipulieren
Ich hatte gerade den Fall, wo die Abhängigkeiten/Meta-Informationen zu einem Debian-Paket nicht wirklich passten (aufgrund eines Bugs).
Eine Möglichkeit, dies zu beheben wäre gewesen, sich das Quellpaket für das Paket zu holen, die Anpassungen vorzunehmen und es neu zu bauen.
Unglücklicherweise handelt es sich aber um ein ziemlich grosses Quellpaket (linux-restricted-modules-2.6.24, etwa 100MB) und es würden beim Bauen auch alle anderen binären Pakete gebaut (nicht nur nvidia-glx-new).
Also hab ich stattdessen das binäre Paket direkt editiert. Und das ging so:
dpkg-deb -x foo.deb foo-new
dpkg-deb -e foo.deb foo-new/DEBIAN
[...edit...]
dpkg-deb -b foo-new
Zuerst wird foo.deb (bzw nvidia-glx-new_100.14.19+2.6.24.2-2.7_i386.deb) ins Verzeichnis foo-new entpackt. Dann die Steuer-Informationsdateien dazu ("dpkg-deb -e"), ins Unterverzeichnis DEBIAN.
Nun habe ich foo-new/DEBIAN/control angepasst und dann ein neues Debianpaket mittels "dpkg-deb -b foo-new" erstellt und dann mittels "dpkg-deb -i foo-new.deb" installiert.
Ging insgesamt (inklusive Bloggen^WDokumentation) weitaus schneller, als alle Pakete in linux-restricted-modules neu zu bauen und dann nur das gefixte zu installieren.
05.11.07
Einmalige Eingabe der SSH-Passphrase bei Verwendung
Vor einiger Zeit habe ich ein gutes Alias für "ssh" gefunden, welches es erlaubt, eine SSH-Key-Passphrase nur einmal einzugeben - und zwar genau dann, wenn sie benötigt wird (und nicht bei jedem Login).
Setup (z.B. in ~/.bash_profile):
alias ssh='if ! ssh-add -l >/dev/null 2>&1; then ssh-add; fi; ssh'
keychain
. ~/.keychain/$HOSTNAME-sh
. ~/.keychain/$HOSTNAME-sh-gpg
keychain ist in jeder guten Distribution enthalten. Stattdessen kann man aber natürlich auch direkt ssh-agent/gpg-agent verwenden/laden.
19.07.05
Mark Shuttleworth über Ubuntu auf der debconf
Auf der Debconf5 (Debian Konferenz), hielt Mark Shuttleworth eine Rede über Ubuntu, an die sich einige Fragen anschlossen.
Ziemlich interessant, wenn auch nicht für jeden.. ![]()
update: alle Videos der 5. debconf.






