Tips And Tricks For Debian

Debian is one the most common and popular of Linux worldwide, today we gathered some new useful tips about it.


in your computer, installed software will display like the following text:

  • apt list --installed
  • dpkg-query -l

2)See Contents of a .deb file:

To see the contents of a .deb file, perform the following:

  1. apt-get update && apt-get install apt-file
  2. apt-file update
  3. apt-file list [deb file]


To install add-apt-repository, perform the following:

  1. apt update
  2. apt -y install software-properties-common dirmngr apt-transport-https lsb-release ca-certificates
  3. add-apt-repository ppa:PPA Name]
  4. apt update
  5. apt install [package]


Ensure dpkg-dev is installed:

apt-get install dpkg-dev



To create a local repo:

dpkg-scanpackages . /dev/null | gzip -9c > Packages.gz


To create a proper repo:

dpkg-scanpackages -m -a [arch] [dir] | gzip > [dir]/Packages.gz



cd /opt/shared/repo/apt


for arch in i386 amd64 mips armel armhf
	printf "%-10s" "${arch}:"
	dpkg-scanpackages -m -a ${arch} pool | gzip > dists/buster/main/binary-${arch}/Packages.gz


6)trust a repo:

To trust a repo, /etc/apt/sources.list:

deb [ trusted=yes ] jessie main contrib non-free

7)Upgrade Stretch to Buster

To upgrade from Stretch to Buster, perform the following:

  1. apt-key adv –keyserver –recv-keys 04EE7237B7D453EC 648ACFD622F3D138
  2. grep -rl stretch /etc/apt/ | sudo xargs sed -i ‘s/stretch/buster/g’
  3. apt update -y && apt dist-upgrade -y
  4. reboot

8)Creating a rootfs

To create a rootfs of Debian perform the following

apt-get install -y qemu-user-static debootstrap binfmt-support qemu-system-arm


mkdir $targetdir
debootstrap --arch=armhf --foreign $distro $targetdir

cp /usr/bin/qemu-arm-static $targetdir/usr/bin/
cp /etc/resolv.conf $targetdir/etc

chroot $targetdir

export LANG=C

/debootstrap/debootstrap --second-stage

cat <<EOT > /etc/apt/sources.list
deb $distro main contrib non-free
deb-src $distro main contrib non-free
deb $distro-updates main contrib non-free
deb-src $distro-updates main contrib non-free
deb $distro/updates main contrib non-free
deb-src $distro/updates main contrib non-free

apt-get update -y

apt-get install -y dialog locales lsb-release nis ntp ntpdate openssh-server rsync sshfs vim

dpkg-reconfigure locales



ping: address family not supported by protocol

  • apt-get remove -y inetutils-ping
  • apt-get install -y inetutils-ping


  • Don’t use a dnsmasq lease file: /etc/default/dnsmasqDNSMASQ_OPTS="--leasefile-ro"
  • Leases stored in /var/lib/misc/dnsmasq.leases


  • Configure
    • locale: dpkg-reconfigure locales
    • time zone: dpkg-reconfigure tzdata
  • Install LXDE: apt-get install task-lxde-desktop

12)RPM to Deb

To convert an rpm to a deb file, execute: alien --scripts [rpm file]

Example: alien --scripts bluejeans-1.37.22.x86_64.rpm

13)Generate Seed Files

Once a machine/VM is set up, you can generate a seed file containing the setup (be sure to install debconf-utils):

  • Settings from installation: debconf-get-selections --installer
  • Current settings: debconf-get-selections

14)Setup a Bridge


  • apt-get install aptitude network-manager -y
  • aptitude install bridge-utils
  • systemctl enable NetworkManager
  • The file /etc/network/interfaces.d/[bridge name] should resemble:
auto [bridge name]

# Bridge setup
 iface [bridge name] inet dhcp
    bridge_ports [ethernet]

As an example a bridge named bridge0 and ethernet enp1s0:

auto bridge0

 iface bridge0 inet dhcp
    bridge_ports enp1s0

Additionally, you must also modify your etc/network/interfaces to be:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

Enable wake-on-lan

Ensure you install ethtoolapt install ethtool

auto [bridge name]

# Bridge setup
 iface [bridge name] inet dhcp
    bridge_ports [ethernet]
    /sbin/ethtool -s [ethernet] wol g

As an example a bridge named bridge0 and ethernet enp1s0:

auto bridge0

 iface bridge0 inet dhcp
    bridge_ports enp1s0
    /sbin/ethtool -s enp1s0 wol g

15 )tftpd-hpa

If not running IPv6, /etc/default/tftpd-hpa should resemble:

# /etc/default/tftpd-hpa

TFTP_OPTIONS="--secure -4"

The  represents “use IPv4.”

all of the command that we showed you on the list above is based on Debian, but here we gathered some specific command for Linux which can come in handy every time you face a problem when your working with Linux.


The adduser and addgroup commands let you add a new user and group to a system, respectively. Here’s an example for adduser:

$ sudo adduser testuser
Adding user `testuser' ...
Adding new group `testuser' (1003) ...
Adding new user `testuser' (1003) with group `testuser' ...
Creating home directory `/home/testuser' ...
Copying files from `/etc/skel' ...
Enter new UNIX password:


The cal and ncal commands display a calendar in the output, both of this command will show you the calendar but there’s just a slight difference, which they show you the calendar differently from each other.

$ cal
March 2017 
Su Mo Tu We Th Fr Sa 
1 2 3 4 
5 6 7 8 9 10 11 
12 13 14 15 16 17 18 
19 20 21 22 23 24 25 
26 27 28 29 30 31
$ ncal
March 2017 
Su 5 12 19 26 
Mo 6 13 20 27 
Tu 7 14 21 28 
We 1 8 15 22 29 
Th 2 9 16 23 30 
Fr 3 10 17 24 31 
Sa 4 11 18 25


Leave a Reply

Your email address will not be published. Required fields are marked *