{"id":1347,"date":"2020-10-03T18:13:30","date_gmt":"2020-10-03T18:13:30","guid":{"rendered":"https:\/\/ded9.com\/?p=1347"},"modified":"2025-10-25T10:10:14","modified_gmt":"2025-10-25T10:10:14","slug":"tips-and-tricks-for-debian","status":"publish","type":"post","link":"https:\/\/ded9.com\/tr\/tips-and-tricks-for-debian\/","title":{"rendered":"Essential Debian Tips &#038; Tricks for Power Users"},"content":{"rendered":"<p><span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\"><a href=\"https:\/\/ded9.com\/tips-and-tricks-for-debian\/\" target=\"_blank\" rel=\"noopener\"><span style=\"font-size: 12pt;\">Debian<\/span><\/a><span style=\"font-size: 12pt;\"> is one of the most widespread <a href=\"https:\/\/en.wikipedia.org\/wiki\/Linux\" target=\"_blank\" rel=\"noopener\">Linux<\/a> distributions worldwide; today, we gathered some new, valuable tips about it.<\/span><\/span><\/p>\n<p><span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\"><span style=\"font-size: 12pt;\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter wp-image-258591 size-full\" src=\"https:\/\/ded9.com\/wp-content\/uploads\/2020\/10\/debian-logo.jpg\" alt=\"Essential Debian Tips &amp; Tricks for Power Users\" width=\"1280\" height=\"720\" srcset=\"https:\/\/ded9.com\/wp-content\/uploads\/2020\/10\/debian-logo.jpg 1280w, https:\/\/ded9.com\/wp-content\/uploads\/2020\/10\/debian-logo-300x169.jpg 300w, https:\/\/ded9.com\/wp-content\/uploads\/2020\/10\/debian-logo-1024x576.jpg 1024w, https:\/\/ded9.com\/wp-content\/uploads\/2020\/10\/debian-logo-768x432.jpg 768w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" \/><\/span><\/span><\/p>\n<h2>Tips And Tricks For Debian<\/h2>\n<h3>1) Install:<\/h3>\n<p>On your computer, installed software will display the following text:<\/p>\n<ul>\n<li><code>apt list --installed<\/code><\/li>\n<li><code>dpkg-query -l<\/code><\/li>\n<\/ul>\n<h3>2) See Contents of a .deb File:<\/h3>\n<p>To see the contents of a .deb File, perform the following:<\/p>\n<ol>\n<li><code>apt-get update &amp;&amp; apt-get install apt-file<\/code><\/li>\n<li><code>apt-file update<\/code><\/li>\n<li><code>apt-file list [deb file]<\/code><\/li>\n<\/ol>\n<h3>3) add-apt-repository:<\/h3>\n<p>To\u00a0install add-apt-repository, perform the following:<\/p>\n<ol>\n<li><code>apt update<\/code><\/li>\n<li><code>apt -y install software-properties-common dirmngr apt-transport-https lsb-release ca-certificates<\/code><\/li>\n<li><code>add-apt-repository ppa:PPA Name]<\/code><\/li>\n<li><code>apt update<\/code><\/li>\n<li><code>apt install [package]<\/code><\/li>\n<\/ol>\n<h3>4) Repos:<\/h3>\n<p>Ensure\u00a0<code>dpkg-dev<\/code>\u00a0is installed:<\/p>\n<p><code>apt-get install dpkg-dev<\/code><\/p>\n<h3>5) Create:<\/h3>\n<p>Local<\/p>\n<p>To\u00a0create a local repo:<\/p>\n<p><code>dpkg-scanpackages . \/dev\/null | gzip -9c &gt; Packages.gz<\/code><\/p>\n<p><a id=\"user-content-proper\" class=\"anchor\" href=\"https:\/\/gist.github.com\/sfloess\/e08619d152050d8da7f7452a1845a7f1#proper\" rel=\"nofollow noopener\" aria-hidden=\"true\" target=\"_blank\"><\/a>Proper<\/p>\n<p>To create an appropriate repo:<\/p>\n<p><code>dpkg-scanpackages -m -a [arch] [dir] | gzip &gt; [dir]\/Packages.gz<\/code><\/p>\n<p><a id=\"user-content-example\" class=\"anchor\" href=\"https:\/\/gist.github.com\/sfloess\/e08619d152050d8da7f7452a1845a7f1#example\" rel=\"nofollow noopener\" aria-hidden=\"true\" target=\"_blank\"><\/a>Example<\/p>\n<pre><span class=\"pl-c\">#!\/bin\/bash<\/span>\r\n\r\n<span class=\"pl-c1\">cd<\/span> \/opt\/shared\/repo\/apt\r\n\r\n<span class=\"pl-c1\">echo<\/span>\r\n\r\n<span class=\"pl-k\">for<\/span> <span class=\"pl-smi\">arch<\/span> <span class=\"pl-k\">in<\/span> i386 amd64 mips armel armhf\r\n<span class=\"pl-k\">do<\/span>\t\r\n\t<span class=\"pl-c1\">printf<\/span> <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>%-10s<span class=\"pl-pds\">\"<\/span><\/span> <span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span><span class=\"pl-smi\">${arch}<\/span>:<span class=\"pl-pds\">\"<\/span><\/span>\r\n\tdpkg-scanpackages -m -a <span class=\"pl-smi\">${arch}<\/span> pool <span class=\"pl-k\">|<\/span> gzip <span class=\"pl-k\">&gt;<\/span> dists\/buster\/main\/binary-<span class=\"pl-smi\">${arch}<\/span>\/Packages.gz\r\n<span class=\"pl-k\">done<\/span>\r\n\r\n<span class=\"pl-c1\">echo<\/span><\/pre>\n<h3>6) trust a repo:<\/h3>\n<p>To trust a repo,\u00a0<code>\/etc\/apt\/sources.list<\/code>:<\/p>\n<p><code>deb [ trusted=yes ] http:\/\/ftp.us.debian.org\/debian\/ jessie main contrib non-free<\/code><\/p>\n<h3>7) Upgrade Stretch to Buster:<\/h3>\n<p>To upgrade from Stretch to Buster, perform the following:<\/p>\n<ol>\n<li>apt-key adv &#8211;keyserver keyserver.ubuntu.com &#8211;recv-keys 04EE7237B7D453EC 648ACFD622F3D138<\/li>\n<li>grep -rl stretch \/etc\/apt\/ | sudo xargs sed -i &#8216;s\/stretch\/buster\/g&#8217;<\/li>\n<li>apt Update -y &amp;&amp; apt dist-upgrade -y<\/li>\n<li>reboot<\/li>\n<\/ol>\n<h3>8) Creating a rootfs:<\/h3>\n<p>To create a rootfs of Debian, perform the following<\/p>\n<p><code>apt-get install -y qemu-user-static debootstrap binfmt-support qemu-system-arm<\/code><\/p>\n<pre><code>targetdir=rootfs\r\ndistro=buster\r\n\r\nmkdir $targetdir\r\ndebootstrap --arch=armhf --foreign $distro $targetdir\r\n\r\ncp \/usr\/bin\/qemu-arm-static $targetdir\/usr\/bin\/\r\ncp \/etc\/resolv.conf $targetdir\/etc\r\n<\/code><\/pre>\n<p><code>chroot $targetdir<\/code><\/p>\n<pre><code>distro=buster\r\nexport LANG=C\r\n\r\n\/debootstrap\/debootstrap --second-stage\r\n\r\ncat &lt;&lt;EOT &gt; \/etc\/apt\/sources.list\r\ndeb http:\/\/ftp.debian.org\/debian $distro main contrib non-free\r\ndeb-src http:\/\/ftp.debian.org\/debian $distro main contrib non-free\r\ndeb http:\/\/ftp.debian.org\/debian $distro-updates main contrib non-free\r\ndeb-src http:\/\/ftp.debian.org\/debian $distro-updates main contrib non-free\r\ndeb http:\/\/security.debian.org\/debian-security $distro\/updates main contrib non-free\r\ndeb-src http:\/\/security.debian.org\/debian-security $distro\/updates main contrib non-free\r\nEOT\r\n\r\n\r\napt-get update -y\r\n\r\napt-get install -y dialog locales lsb-release nis ntp ntpdate openssh-server rsync sshfs vim\r\n\r\ndpkg-reconfigure locales\r\n\r\npasswd<\/code><\/pre>\n<h3>9) chroot:<\/h3>\n<p>ping: Address family not supported by protocol<\/p>\n<ul>\n<li><code>apt-get remove -y inetutils-ping<\/code><\/li>\n<li><code>apt-get install -y inetutils-ping<\/code><\/li>\n<\/ul>\n<h3>10) dnsmasq:<\/h3>\n<ul>\n<li>Don&#8217;t use a dnsmasq lease File: <code>\/etc\/default\/dnsmasq<\/code>:\u00a0<code>DNSMASQ_OPTS=\"--leasefile-ro\"<\/code><\/li>\n<li>Leases stored in\u00a0<code>\/var\/lib\/misc\/dnsmasq.leases<\/code><\/li>\n<\/ul>\n<h3>11) Quickies:<\/h3>\n<ul>\n<li>Configure\n<ul>\n<li>locale:\u00a0<code>dpkg-reconfigure locales<\/code><\/li>\n<li>Time zone: <code>dpkg-reconfigure tzdata<\/code><\/li>\n<\/ul>\n<\/li>\n<li>Install LXDE:\u00a0<code>apt-get install task-lxde-desktop<\/code><\/li>\n<\/ul>\n<h3>12) RPM to Deb:<\/h3>\n<p>To convert an RPM to a DEB File, execute: <code>alien --scripts [rpm file]<\/code><\/p>\n<p>Example:\u00a0<code>alien --scripts bluejeans-1.37.22.x86_64.rpm<\/code><\/p>\n<h3>13) Generate Seed Files:<\/h3>\n<p>Once a machine\/VM is set up, you can generate a seed File containing the setup (be sure to install\u00a0<code>debconf-utils<\/code>):<\/p>\n<ul>\n<li>Settings from installation:\u00a0<code>debconf-get-selections --installer<\/code><\/li>\n<li>Current settings:\u00a0<code>debconf-get-selections<\/code><\/li>\n<\/ul>\n<h3>14) Set up a Bridge:<\/h3>\n<p>Directions<\/p>\n<ul>\n<li><code>apt-get install aptitude network-manager -y<\/code><\/li>\n<li><code>aptitude install bridge-utils<\/code><\/li>\n<li><code>systemctl enable NetworkManager<\/code><\/li>\n<li>The File <code>\/etc\/network\/interfaces.d\/[bridge name]<\/code>\u00a0should resemble:<\/li>\n<\/ul>\n<pre><code>auto [bridge name]\r\n\r\n# Bridge setup\r\n iface [bridge name] inet dhcp\r\n    bridge_ports [ethernet]\r\n<\/code><\/pre>\n<p>As an example, a bridge named <code>bridge0<\/code>\u00a0and ethernet\u00a0<code>enp1s0<\/code>:<\/p>\n<pre><code>auto bridge0\r\n\r\n iface bridge0 inet dhcp\r\n    bridge_ports enp1s0\r\n<\/code><\/pre>\n<p>Additionally, it would be best if you also modify your <code>etc\/network\/interfaces<\/code>\u00a0to be:<\/p>\n<pre><code># This file describes the network interfaces available on your system\r\n# and how to activate them. For more information, see interfaces(5).\r\n\r\nsource \/etc\/network\/interfaces.d\/*\r\n\r\n# The loopback network interface\r\nauto lo\r\niface lo inet loopback\r\n<\/code><\/pre>\n<h4><a id=\"user-content-enable-wake-on-lan\" class=\"anchor\" href=\"https:\/\/gist.github.com\/sfloess\/e08619d152050d8da7f7452a1845a7f1#enable-wake-on-lan\" rel=\"nofollow noopener\" aria-hidden=\"true\" target=\"_blank\"><\/a>Enable wake-on-lan<\/h4>\n<p>Ensure you install\u00a0<code>ethtool<\/code>:\u00a0<code>apt install ethtool<\/code><\/p>\n<pre><code>auto [bridge name]\r\n\r\n# Bridge setup\r\n iface [bridge name] inet dhcp\r\n    bridge_ports [ethernet]\r\n    \/sbin\/ethtool -s [ethernet] wol g\r\n<\/code><\/pre>\n<p>As an example, a bridge named <code>bridge0<\/code>\u00a0and ethernet\u00a0<code>enp1s0<\/code>:<\/p>\n<pre><code>auto bridge0\r\n\r\n iface bridge0 inet dhcp\r\n    bridge_ports enp1s0\r\n    \/sbin\/ethtool -s enp1s0 wol g<\/code><\/pre>\n<h3>15 ) tftpd-hPa:<\/h3>\n<p>If not running IPv6,\u00a0<code>\/etc\/default\/tftpd-hpa<\/code>\u00a0should resemble:<\/p>\n<div class=\"highlight highlight-source-ini\">\n<pre><span class=\"pl-c\"># \/etc\/default\/tftpd-hpa<\/span>\r\n\r\n<span class=\"pl-k\">TFTP_USERNAME<\/span>=<span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>tftp<span class=\"pl-pds\">\"<\/span><\/span>\r\n<span class=\"pl-k\">TFTP_DIRECTORY<\/span>=<span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>\/srv\/tftp<span class=\"pl-pds\">\"<\/span><\/span>\r\n<span class=\"pl-k\">TFTP_ADDRESS<\/span>=<span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>0.0.0.0:69<span class=\"pl-pds\">\"<\/span><\/span>\r\n<span class=\"pl-k\">TFTP_OPTIONS<\/span>=<span class=\"pl-s\"><span class=\"pl-pds\">\"<\/span>--secure -4<span class=\"pl-pds\">\"<\/span><\/span><\/pre>\n<\/div>\n<p>The\u00a0<code>-\u06f4<\/code>\u00a0represents &#8220;use IPv4.&#8221;<\/p>\n<p>All of the commands we showed you on the list above are based on Debian, but here we gathered some specific commands for Linux, which can come in handy when you face a Problem working with Linux.<\/p>\n<h3>16) Add user\/Addgroup:<\/h3>\n<p>The\u00a0<em>adduser<\/em>\u00a0and\u00a0<em>addgroup<\/em> commands let you add a new user and group to a System, respectively. Here&#8217;s an example for adduser:<\/p>\n<pre class=\"command\"><code spellcheck=\"false\">$ sudo <strong>adduser<\/strong> testuser\r\nAdding user `testuser' ...\r\nAdding new group `testuser' (1003) ...\r\nAdding new user `testuser' (1003) with group `testuser' ...\r\nCreating home directory `\/home\/testuser' ...\r\nCopying files from `\/etc\/skel' ...\r\nEnter new UNIX password:<\/code><\/pre>\n<h3>17) Cal\/Local:<\/h3>\n<p>The\u00a0<em>cal<\/em>\u00a0and\u00a0<em>local<\/em> commands display a calendar in the output; both will show you the calendar, but there is a slight difference, offering the calendar in a slightly different Format from the other.<\/p>\n<pre class=\"command\"><code spellcheck=\"false\">$ <strong>cal<\/strong>\r\nMarch 2017 \r\nSu Mo Tu We Th Fr Sa \r\n1 2 3 4 \r\n5 6 <strong>7<\/strong> 8 9 10 11 \r\n12 13 14 15 16 17 18 \r\n19 20 21 22 23 24 25 \r\n26 27 28 29 30 31<\/code><\/pre>\n<pre class=\"command\"><code spellcheck=\"false\">$ <strong>ncal<\/strong>\r\nMarch 2017 \r\nSu 5 12 19 26 \r\nMo 6 13 20 27 \r\nTu <strong>7<\/strong> 14 21 28 \r\nWe 1 8 15 22 29 \r\nTh 2 9 16 23 30 \r\nFr 3 10 17 24 31 \r\nSa 4 11 18 25<\/code><\/pre>\n<h2>FAQ<\/h2>\n<div id=\"rank-math-rich-snippet-wrapper\"><div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-1\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">How to list installed packages?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Use apt list --installed or dpkg -l.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-2\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">How to check contents of a .deb package?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Use apt-file list [package_name].<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-3\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \">How to upgrade Debian from Stretch to Buster?<\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Update sources, run apt update &amp;&amp; apt dist-upgrade, then reboot.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Debian is one of the most widespread Linux distributions worldwide; today, we gathered some new, valuable tips about it. Tips And Tricks For Debian 1) Install: On your computer, installed software will display the following text: apt list &#8211;installed dpkg-query -l 2) See Contents of a .deb File: To see the contents of a .deb [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":1348,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[69],"tags":[26,31,32,33,34],"class_list":["post-1347","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-command","tag-debian","tag-linux","tag-os","tag-tips"],"acf":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/posts\/1347","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/comments?post=1347"}],"version-history":[{"count":6,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/posts\/1347\/revisions"}],"predecessor-version":[{"id":263913,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/posts\/1347\/revisions\/263913"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/media\/1348"}],"wp:attachment":[{"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/media?parent=1347"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/categories?post=1347"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ded9.com\/tr\/wp-json\/wp\/v2\/tags?post=1347"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}