In Debian every package depends on others and thus every package has generally at least another one which depends on it. Every once in a while you could need to know why a given package is present in your Debian machine. Here is how:
Method 1: apt-cache
$ apt-cache rdepends package
Shows all the packages, no matter whether they are installed or not, which depends on package.
Method 2: aptitude
If you, like me, don’t use aptitude very often (i.e. never) you should first update its package db:
# aptitude update
Then:
$ aptitude search '~i~Dpackage'
This command shows all the installed packages which depend on package.
Imbattutomi nell’arduo problema di trovare un modo per configurare un autorisponditore sul server di posta di un cliente che usa account virtuali e non di sistema, ho finalmente risolto l’arcano ricordandomi della mitica funzione “pipe” di Postfix, ecco come fare:
Se avete Postfix configurato su mysql dovrete inanzitutto aggiungere un “transport” nella tabella appropriata del tipo:
Dominio: “autoreply.domain.tld” -> Transport: “autoreply:”
La stessa cosa puo’ essere fatta se usate i file invece del db:
/etc/postfix/transport:
autoreply.domain.tld autoreply:
Have you ever wanted to write a bunch of words just in the same line over and over again?
Many applications, like encoders or converters, do that in order to show dynamic information to the user without filling up the screen (and thus the terminal buffer).
Here is how you can do it easily in bash.
The code is quite simple:
while :; do
echo -n -e "\r$(date)"
sleep 1
done
The trick consists of three parts:
Let’s suppose we have a number expressed in given base (i.e. “E0″ in hexadecimal). How can we convert it to decimal using bash or other common Unix tools? And what if we need to perform an any-to-any base conversion?
First way: printf + hexdump
We can tell bash that a given string is just a disguised hexadecimal number by adding “\x” at the top of it and then using the built-in printf function to recover the number:
$ foo="6F"
$foo2="\x"$foo
$ printf "%b" $foo2 | hexdump -e '1/1 "%d" "\n"'
111
$ printf "%b" $foo2 | hexdump -e '1/1 "%o" "\n"'
157
Please notice that %d makes hexdumo to return a signed integer; if you need an unsigned integer just replace it with %u:
This is a quickie: we just have an array like this
(alpha,beta,gamma)
and we want it reversed:
(gamma,beta,alpha)
Here is the code in bash:
a=(alpha beta gamma delta epsilon);
len=${#a[@]};
echo ${a[@]};
i=0;
while (($i < $len/2 )); do
tmp=${a[i]};
a[i]=${a[$len-$i-1]};
a[$len-$i-1]=$tmp;
((i++));
done
echo ${a[@]};