Debian
List all (installed) packages
export COLUMNS=10
dpkg -l "*"
dpkg -l "*" | grep ^ii
dpkg -l "*"
dpkg -l "*" | grep ^ii
Download Source Package and Build It:
apt-get -b source foo
Build Source Package:
dpkg-source -x foo.dsc
Build Sources:
dpkg-buildpackage -rfakeroot
Search Package:
apt-cache search foo
Reinstall Packages with Missing Files:
for i in /var/lib/dpkg/info/*.list;
do
while read line ;
do
if [ ! -e "$line" ]; then echo "Reinstall $(basename $i) ($line)"; break; fi;
done < "$i" ;
done
do
while read line ;
do
if [ ! -e "$line" ]; then echo "Reinstall $(basename $i) ($line)"; break; fi;
done < "$i" ;
done
Which Is the Largest Package that would Be Upgraded:
apt-get upgrade --print-uris -y | awk '{ print $3" "$1" "$2 }' | grep '.*' | sort -n | tail -10
Build the Packages File:
dpkg-scanpackages ./ /dev/null | gzip > Packages.gz
apt-ftparchive ./ | gzip > Packages.gz
apt-ftparchive ./ | gzip > Packages.gz
Build Kernel:
make-kpkg clean
make-kpkg kernel_image --revision=Configname.Version
make-kpkg --initrd kernel_image
make-kpkg kernel_image --revision=Configname.Version
make-kpkg --initrd kernel_image
Poweroff after Shutdown:
echo "apm" >> /etc/modules
(search for realmode_power_off)
(search for realmode_power_off)
Build a Debian Package from the files of an already installed one:
dpkg-repack NAME
Remove a Package despite existing Dependencies:
dpkg -r --force-depends NAME
List Packages sorted by their origin:
Install and Remove init.d Links
Insert links for foobar using the defaults:
update-rc.d foobar defaults
Insert links for foobar at position 20 in runlevel 2,3,4,5,0,1,6
update-rc.d foobar start 20 2 3 4 5 . stop 20 0 1 6 .
Remove links for foobar
update-rc.d foobar remove
Choose your favourite application via the alternatives system
/usr/sbin/update-alternatives --list editor
/usr/sbin/update-alternatives --set editor /usr/bin/vim
/usr/sbin/update-alternatives --set editor /usr/bin/emacs21
/usr/sbin/update-alternatives --set editor /usr/bin/vim
/usr/sbin/update-alternatives --set editor /usr/bin/emacs21
Build Nvidia Kernel Modul
module-assistant auto-install nvidia
Debian add GPG key
Recently, Debian started to use secure apt. You might notice this with messages like this one
W: GPG error: http://... ... Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY A080A41350959092
W: You may want to run apt-get update to correct these problems
W: You may want to run apt-get update to correct these problems
You can then import the missing key, check it and add it with apt-key
# gpg --keyserver pgpkeys.mit.edu --recv-key A080A41350959092
gpg: requesting key 50959092 from hkp server pgpkeys.mit.edu
gpg: key 50959092: ... imported
# gpg -a --export 50959092 | apt-key add -
OK
gpg: requesting key 50959092 from hkp server pgpkeys.mit.edu
gpg: key 50959092: ... imported
# gpg -a --export 50959092 | apt-key add -
OK