[{"content":"I had some problems to get my Bluetooth headset working with my Debian, the fault was kind of non informative.\nIn the end I found in some forum that it needs the following lib.\nlibspa-0.2-bluetooth I found this here.\nConnection Failed: br-connection-profile-unavailable\nThis was the only fault shown in the GUI.\n","permalink":"https://newblog.utzer.de/2023/12/08/debian-bluetooth-headset-problem/","summary":"\u003cp\u003eI had some problems to get my Bluetooth headset working with my Debian, the fault was kind of non informative.\u003c/p\u003e\n\u003cp\u003eIn the end I found in some forum that it needs the following lib.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003elibspa-0.2-bluetooth\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eI found this \u003ca href=\"https://forums.debian.net/viewtopic.php?t=155520\"\u003ehere\u003c/a\u003e.\u003c/p\u003e\n\u003cblockquote\u003e\n\u003cp\u003eConnection Failed: br-connection-profile-unavailable\u003c/p\u003e\n\u003cp\u003eThis was the only fault shown in the GUI.\u003c/p\u003e\n\u003c/blockquote\u003e","title":"Debian Bluetooth headset problem"},{"content":"cp -pRv --reflink=auto /source/folder /destination/folder copy files and directories\n-p same as \u0026ndash;preserve=mode,ownership,timestamps\n-R, -r, \u0026ndash;recursive\ncopy directories recursively\n-v verbose, show what is going on.\n\u0026ndash;reflink[=WHEN]\ncontrol clone/CoW copies.\nThis just copied 169GB of files in 20 seconds. This only works on supported filesystems, so for example by \u0026ldquo;#Btrfs, #CIFS, #NFS 4.2, #OCFS2, #overlayfs, and #XFS\u0026rdquo;. See here.\nExplainshell tells you this.\n","permalink":"https://newblog.utzer.de/2023/07/11/linux-cp-command-with-reflink/","summary":"\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ecp -pRv --reflink=auto /source/folder /destination/folder\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003ecopy files and directories\u003cbr\u003e\n-p same as \u0026ndash;preserve=mode,ownership,timestamps\u003cbr\u003e\n-R, -r, \u0026ndash;recursive\u003cbr\u003e\ncopy directories recursively\u003cbr\u003e\n-v verbose, show what is going on.\u003c/p\u003e\n\u003cp\u003e\u0026ndash;reflink[=WHEN]\u003cbr\u003e\ncontrol clone/CoW copies.\u003c/p\u003e\n\u003cp\u003eThis just copied 169GB of files in 20 seconds. This only works on supported filesystems, so for example by \u0026ldquo;#Btrfs, #CIFS, #NFS 4.2, #OCFS2, #overlayfs, and #XFS\u0026rdquo;. See \u003ca href=\"https://unix.stackexchange.com/a/631238\"\u003ehere\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eExplainshell tells you \u003ca href=\"https://explainshell.com/explain?cmd=cp+-pRv+--reflink%3Dauto+%2Fsource%2Ffolder%2Ffile+%2Fdestination%2Ffolder%2Ffile\"\u003ethis\u003c/a\u003e.\u003c/p\u003e","title":"Linux cp command with reflink"},{"content":"I will not write a long explanation, just this short one.\nThe cronjob looks like this:\n* * * * * sh -c \u0026#39;flock -n /tmp/my.lockfile /home/user/scripts/ocr_pdf_scan.sh\u0026#39; This will start sh (a shell, just like bash) and run the command after -c. The command flock will create a lock-file, to prevent that this cron job is started while there is still the previous cron jobs running.\nThe cron job runs every minute, so in crontab it has * * * * * (five stars in front of the command).\nIn the ocr_pdf_scan.sh I have this:\n#!/bin/bash find /home/user/scans/ocr -type f \\( -iname \u0026#34;*.pdf\u0026#34; -and -not -iname \u0026#34;*_ocr.pdf\u0026#34; \\) | while read file ; do OLDTimestamp=$(stat -c \u0026#34;%Y\u0026#34; \u0026#34;$file\u0026#34;) \u0026amp;\u0026amp; ocrmypdf -q -l deu+eng --rotate-pages --rotate-pages-threshold 8 -c -s \u0026#34;$file\u0026#34; /home/user/scans/ocr_ready/\u0026#34;$(basename \u0026#34;$file\u0026#34; \u0026#34;.pdf\u0026#34;)_ocr.pdf\u0026#34; \u0026amp;\u0026amp; touch -d @$OLDTimestamp /home/user/scans/ocr_ready/\u0026#34;$(basename \u0026#34;$file\u0026#34; \u0026#34;.pdf\u0026#34;)_ocr.pdf\u0026#34; \u0026amp;\u0026amp; rm \u0026#34;$file\u0026#34; ; done exit 0 Edit 31.07.2023: Added the stat/touch part to reset the modification time after ocrmypdf processed the file.\nThis will search for all files ending in \u0026ldquo;*.pdf\u0026rdquo; but not \u0026ldquo;*_ocr.pdf\u0026rdquo;, it will pipe these path and filenames through to the while read, which will execute for each found file the ocrmypdf for the path and file stored in $file and output to another folder, it will strip the .pdf from the filename and append \u0026ldquo;_ocr.pdf\u0026rdquo; to the filename again.\nI tried this with output to the same folder as well, it also works, but for some reason I set it up like this.\n","permalink":"https://newblog.utzer.de/2023/07/03/ocr-all-pdfs-in-a-folder-by-cron/","summary":"\u003cp\u003eI will not write a long explanation, just this short one.\u003c/p\u003e\n\u003cp\u003eThe cronjob looks like this:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e* * * * * sh -c \u0026#39;flock -n /tmp/my.lockfile /home/user/scripts/ocr_pdf_scan.sh\u0026#39;\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eThis will start sh (a shell, just like bash) and run the command after -c. The command flock will create a lock-file, to prevent that this cron job is started while there is still the previous cron jobs running.\u003c/p\u003e\n\u003cp\u003eThe cron job runs every minute, so in crontab it has * * * * * (five stars in front of the command).\u003c/p\u003e","title":"OCR all PDFs in a folder by cron"},{"content":"Important\nThis fix can be applied before the reboot after the upgrade from Buster to Bullseye, if you missed it you need a MicroSD card reader and some Linux computer (another RaspberryPI would do) to edit the file.\nIn the file\n/etc/systemd/system/dhcpcd.service.d/wait.conf there is a wrong path for the dhcpd, it has to be changed.\nwrong (from buster):\n/usr/lib/dhcpcd5/dhcpcd correct and new on Bullseye:\n/usr/sbin/dhcpcd So you need to do this before the reboot, otherwise the RaspberryPi will not have a working WIFI or Ethernet connection after the reboot and will not allow you to login from remote by SSH.\nIf you still have the RaspberryPi running you can use the command from this Stackexchange comment as well.\n","permalink":"https://newblog.utzer.de/2023/06/04/fix-error-failed-to-start-dhcp-client-daemon-after-upgrade-to-bullseye-on-raspberrypi/","summary":"\u003cp\u003e\u003cstrong\u003eImportant\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThis fix can be applied before the reboot after the upgrade from Buster to Bullseye, if you missed it you need a MicroSD card reader and some Linux computer (another RaspberryPI would do) to edit the file.\u003c/p\u003e\n\u003cp\u003eIn the file\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e/etc/systemd/system/dhcpcd.service.d/wait.conf\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003ethere is a wrong path for the dhcpd, it has to be changed.\u003c/p\u003e\n\u003cp\u003ewrong (from buster):\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e/usr/lib/dhcpcd5/dhcpcd\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003ecorrect and new on Bullseye:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e/usr/sbin/dhcpcd\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eSo you need to do this before the reboot, otherwise the RaspberryPi will not have a working WIFI or Ethernet connection after the reboot and will not allow you to login from remote by SSH.\u003c/p\u003e","title":"Fix error \"Failed to start DHCP Client Daemon\" after upgrade to \"Bullseye\" on RaspberryPI"},{"content":"So to upgrade Raspbian, as it was previously called, from Buster to Bullseye went smooth an easy, I tried this with some Pi2B (armhf 32Bit) and with a Pi4. These two are headless systems, so I don\u0026rsquo;t know if this works well for any systems with window managers.\nBetter run these commands in screen, so when the SSH connection is interrupted you can reconnect and resume your work.\nEdit: For the update there is a culprit, it will cause a problem with dhcpd, so before the reboot 13. (was point 12. before I added the remark below) please check this post.\nSteps to update:\nsudo apt update sudo apt dist-upgrade -y sudo rpi-update sudo reboot sudo apt remove libc6-dev Edit the file /etc/apt/sources.list, change all occurrences of buster to bullseye. Edit the file /etc/apt/sources.list.d/raspi.list, change all occurrences of buster to bullseye. sudo apt update sudo apt install libgcc-8-dev gcc-8-base Instead of sudo apt install better use my update script, just run ~/up \u0026ldquo;libgcc-8-dev gcc-8-base\u0026rdquo; (incl. the \u0026ldquo;quotation marks\u0026rdquo;) and skip steps 8., 9., 10. and 11. It doesn\u0026rsquo;t matter when you already executed step 8.. sudo apt dist-upgrade sudo apt autoclean Please edit the file /etc/systemd/system/dhcpcd.service.d/wait.conf, change the path in there from /usr/lib/dhcpcd5/dhcpcd to /usr/sbin/dhcpcd, see here for long version. sudo reboot Somewhere along the way there will be a warning that \u0026ldquo;libc6-dev\u0026rdquo; can not be upgrade (or so) as it breaks \u0026ldquo;libgcc-8-dev\u0026rdquo;, this is the reason for step 5. and 9..\nEdit: On the Pi4 I got:\nThe following packages have unmet dependencies: libgcc1 : Depends: gcc-8-base (= 8.3.0-6+rpi1) but 8.4.0-7+rpi1 is to be installed Which I solved by \u0026ldquo;sudo apt-get remove libgcc1\u0026rdquo; and then I just restarted with either point 8. from above, but in my case with \u0026ldquo;~/up libgcc-8-dev\u0026rdquo;.\nI prefer to update or install packages with this script.\nfirst inspiration from here.\n","permalink":"https://newblog.utzer.de/2023/05/11/upgrade-raspberry-pi-raspbian-from-buster-to-bullseye/","summary":"\u003cp\u003eSo to upgrade Raspbian, as it was previously called, from Buster to Bullseye went smooth an easy, I tried this with some Pi2B (armhf 32Bit) and with a Pi4. These two are headless systems, so I don\u0026rsquo;t know if this works well for any systems with window managers.\u003c/p\u003e\n\u003cp\u003eBetter run these commands in screen, so when the SSH connection is interrupted you can reconnect and resume your work.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eEdit: For the update there is a culprit, it will cause a problem with dhcpd, so before the reboot 13. (was point 12. before I added the remark below) please \u003ca href=\"/?p=141\"\u003echeck this post\u003c/a\u003e.\u003c/strong\u003e\u003c/p\u003e","title":"Upgrade Raspberry Pi OS from Buster to Bullseye"},{"content":"Converts a PDF to DIN A4 paper size and centers the content of the input file on the new page without resizing it.\npdfjam --outfile file_a4.pdf --frame true --scale 1.0 --noautoscale true --paper a4paper file.pdf Needs package \u0026ldquo;texlive-extra-utils\u0026rdquo; on Debian.\n","permalink":"https://newblog.utzer.de/2023/01/04/resize-a-pdf-to-din-a4-on-cli/","summary":"\u003cp\u003eConverts a PDF to DIN A4 paper size and centers the content of the input file on the new page without resizing it.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003epdfjam --outfile file_a4.pdf --frame true --scale 1.0 --noautoscale true --paper a4paper file.pdf\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eNeeds package \u0026ldquo;texlive-extra-utils\u0026rdquo; on Debian.\u003c/p\u003e","title":"Resize a PDF to DIN A4 on CLI"},{"content":" Add key curl https://ftp-master.debian.org/keys/archive-key-10.asc | gpg --import gpg --export DC30D7C23CBBABEE | apt-key add - The fingerprint (DC30D7C23CBBABEE) given is the one that the first command outputs, which is the fingerprint of the key downloaded by curl.\n2. Add repo\necho \u0026#34;deb http://deb.debian.org/debian buster-backports main\u0026#34; |sudo tee /etc/apt/sources.list.d/deb_buster_backports.list run apt update/upgrade Install tor, I did this by: apt-get install -o Dpkg::Options::=\u0026#34;--force-confold\u0026#34; -y tor ","permalink":"https://newblog.utzer.de/2021/02/05/adding-debian-buster-backports-repo-to-raspberrypi-for-tor/","summary":"\u003col\u003e\n\u003cli\u003eAdd key\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-gdscript3\" data-lang=\"gdscript3\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ecurl https:\u003cspan style=\"color:#f92672\"\u003e//\u003c/span\u003eftp\u003cspan style=\"color:#f92672\"\u003e-\u003c/span\u003emaster\u003cspan style=\"color:#f92672\"\u003e.\u003c/span\u003edebian\u003cspan style=\"color:#f92672\"\u003e.\u003c/span\u003eorg\u003cspan style=\"color:#f92672\"\u003e/\u003c/span\u003ekeys\u003cspan style=\"color:#f92672\"\u003e/\u003c/span\u003earchive\u003cspan style=\"color:#f92672\"\u003e-\u003c/span\u003ekey\u003cspan style=\"color:#f92672\"\u003e-\u003c/span\u003e\u003cspan style=\"color:#ae81ff\"\u003e10.\u003c/span\u003easc \u003cspan style=\"color:#f92672\"\u003e|\u003c/span\u003e gpg \u003cspan style=\"color:#f92672\"\u003e--\u003c/span\u003eimport\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003egpg \u003cspan style=\"color:#f92672\"\u003e--\u003c/span\u003e\u003cspan style=\"color:#66d9ef\"\u003eexport\u003c/span\u003e DC30D7C23CBBABEE \u003cspan style=\"color:#f92672\"\u003e|\u003c/span\u003e apt\u003cspan style=\"color:#f92672\"\u003e-\u003c/span\u003ekey add \u003cspan style=\"color:#f92672\"\u003e-\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eThe fingerprint (DC30D7C23CBBABEE) given is the one that the first command outputs, which is the fingerprint of the key downloaded by curl.\u003c/p\u003e\n\u003cp\u003e2. Add repo\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eecho \u0026#34;deb http://deb.debian.org/debian buster-backports main\u0026#34; |sudo tee /etc/apt/sources.list.d/deb_buster_backports.list\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003col\u003e\n\u003cli\u003erun apt update/upgrade\u003c/li\u003e\n\u003cli\u003eInstall tor, I did this by:\u003c/li\u003e\n\u003c/ol\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eapt-get install -o Dpkg::Options::=\u0026#34;--force-confold\u0026#34; -y tor\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e","title":"Adding Debian Buster Backports repo to RaspberryPi for tor"},{"content":"Just some info, because the last time when I flashed an SD card I took #Raspbian only because I could not find the #Debian images as quick.\nInfos about Debian for #Pi are here:\nhttps://wiki.debian.org/RaspberryPi\nImages:\nhttps://raspi.debian.net/tested-images/\nSome tips for settings, like #SSH on first boot (you need to add a key):\nhttps://raspi.debian.net/defaults-and-settings/\n","permalink":"https://newblog.utzer.de/2021/02/05/debian-for-raspberry-pi/","summary":"\u003cp\u003eJust some info, because the last time when I flashed an SD card I took #Raspbian only because I could not find the #Debian images as quick.\u003c/p\u003e\n\u003cp\u003eInfos about Debian for #Pi are here:\u003cbr\u003e\n\u003ca href=\"https://wiki.debian.org/RaspberryPi\"\u003ehttps://wiki.debian.org/RaspberryPi\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eImages:\u003cbr\u003e\n\u003ca href=\"https://raspi.debian.net/tested-images/\"\u003ehttps://raspi.debian.net/tested-images/\u003c/a\u003e\u003c/p\u003e\n\u003cp\u003eSome tips for settings, like #SSH on first boot (you need to add a key):\u003cbr\u003e\n\u003ca href=\"https://raspi.debian.net/defaults-and-settings/\"\u003ehttps://raspi.debian.net/defaults-and-settings/\u003c/a\u003e\u003c/p\u003e","title":"Debian for Raspberry Pi"},{"content":"This is a solution for a #RaspberryPi, some #VPS without swap of some machine setup without swap where you need swap for something without wanting to fiddle with the drive partitions or so.\nThis is a quick and dirty \u0026ldquo;short manual\u0026rdquo; for #Debian based #Systemd environments (such as #Ubuntu, #Mint or #Raspbian).\nFirst run this:\ncat \u0026gt; dphys-swap.sh \u0026lt;\u0026lt; EOF #!/bin/bash #~/up apt-get install dphys-swapfile echo \u0026#34;CONF_SWAPSIZE=2048\u0026#34;|tee -a /etc/dphys-swapfile dphys-swapfile setup dphys-swapfile swapon systemctl restart dphys-swapfile.service systemctl status dphys-swapfile.service free -h EOF This will just create a short #bash #script with the needed commands to run to get #dphys setup and running. Please alter the number 2048 to your need, it is the size of the swap memory that will be setup. The size of the swap should most likely by equal to the real memory installed, sometimes twice the size seems to be a good choice too.\nIf you don\u0026rsquo;t know your memory size you can find it out by running the command \u0026ldquo;free -h\u0026rdquo;, which will print the size of the physical memory installed and the below this the swap size(s).\nAfter pasting the above code into your shell, which will create a file called \u0026ldquo;dphys-swap.sh\u0026rdquo; in the current folder (you should be in your home folder!!), you need to make the shell script \u0026ldquo;dphys-swap.sh\u0026rdquo; executable by running:\nchmod +x dphys-swap.sh Then you need to run the script like this:\nsudo ~/dphys-swap.sh It will ask for some confirmation(s) to install certain packages.\nThe last commands will output the status of the systemd service \u0026ldquo;dphys-swapfile.service\u0026rdquo; and the last line will show you the memory and swap size again.\nRemark:\nIn the script above I use \u0026ldquo;up\u0026rdquo;, my full update of the system. I just blogged that one too, have a look here.\n","permalink":"https://newblog.utzer.de/2020/04/20/linux-swap-with-dphys-swapfile/","summary":"\u003cp\u003eThis is a solution for a #RaspberryPi, some #VPS without swap of some machine setup without swap where you need swap for something without wanting to fiddle with the drive partitions or so.\u003c/p\u003e\n\u003cp\u003eThis is a quick and dirty \u0026ldquo;short manual\u0026rdquo; for #Debian based #Systemd environments (such as #Ubuntu, #Mint or #Raspbian).\u003c/p\u003e\n\u003cp\u003eFirst run this:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ecat \u0026gt; dphys-swap.sh \u003cspan style=\"color:#e6db74\"\u003e\u0026lt;\u0026lt; EOF\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#e6db74\"\u003e#!/bin/bash\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#e6db74\"\u003e#~/up\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#e6db74\"\u003eapt-get install dphys-swapfile\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#e6db74\"\u003eecho \u0026#34;CONF_SWAPSIZE=2048\u0026#34;|tee -a /etc/dphys-swapfile\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#e6db74\"\u003edphys-swapfile setup\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#e6db74\"\u003edphys-swapfile swapon\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#e6db74\"\u003esystemctl restart dphys-swapfile.service\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#e6db74\"\u003esystemctl status dphys-swapfile.service\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#e6db74\"\u003efree -h\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#e6db74\"\u003eEOF\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eThis will just create a short #bash #script with the needed commands to run to get #dphys setup and running. Please alter the number 2048 to your need, it is the size of the swap memory that will be setup. The size of the swap should most likely by equal to the real memory installed, sometimes twice the size seems to be a good choice too.\u003c/p\u003e","title":"Linux swap with dphys-swapfile"},{"content":"I have this small script deployed on any of my #Debian based systems, it just does all the update, upgrade, dist-upgrade, autoremove and autoclean in one run.\n#!/bin/sh if [ $# -eq 0 ]; then sudo sh -c \u0026#34;apt-get update \u0026amp;\u0026amp; apt-get upgrade \u0026amp;\u0026amp; apt-get dist-upgrade \u0026amp;\u0026amp; apt-get update \u0026amp;\u0026amp; apt-get autoremove \u0026amp;\u0026amp; apt-get autoclean\u0026#34; else sudo sh -c \u0026#34;apt-get update \u0026amp;\u0026amp; apt-get upgrade \u0026amp;\u0026amp; apt-get dist-upgrade \u0026amp;\u0026amp; apt-get update \u0026amp;\u0026amp; apt-get install $@ \u0026amp;\u0026amp; apt-get autoremove \u0026amp;\u0026amp; apt-get autoclean\u0026#34; fi I have this script deployed in a lazy manner, I just have it sitting in my users home folder and called it \u0026ldquo;up\u0026rdquo;, I did do a \u0026ldquo;chmod +x up\u0026rdquo; and just start it like this:\n~/up It also accepts one several package names as an arguments and that be called like this:\nsudo ~/up package1,package2 This will then install \u0026ldquo;package1\u0026rdquo; and \u0026ldquo;package2\u0026rdquo;.\nI am not sure where I found this, but I surely did find this somewhere in the internet and just took it from there, you thanks to who ever put this together.\n","permalink":"https://newblog.utzer.de/2020/04/20/debian-based-full-updates-in-one-command/","summary":"\u003cp\u003eI have this small script deployed on any of my #Debian based systems, it just does all the update, upgrade, dist-upgrade, autoremove and autoclean in one run.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-bash\" data-lang=\"bash\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#75715e\"\u003e#!/bin/sh\n\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003eif\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e[\u003c/span\u003e $# -eq \u003cspan style=\"color:#ae81ff\"\u003e0\u003c/span\u003e \u003cspan style=\"color:#f92672\"\u003e]\u003c/span\u003e; \u003cspan style=\"color:#66d9ef\"\u003ethen\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  sudo sh -c \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;apt-get update \u0026amp;\u0026amp; apt-get upgrade \u0026amp;\u0026amp; apt-get dist-upgrade \u0026amp;\u0026amp; apt-get update \u0026amp;\u0026amp; apt-get autoremove \u0026amp;\u0026amp; apt-get autoclean\u0026#34;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003eelse\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  sudo sh -c \u003cspan style=\"color:#e6db74\"\u003e\u0026#34;apt-get update \u0026amp;\u0026amp; apt-get upgrade \u0026amp;\u0026amp; apt-get dist-upgrade \u0026amp;\u0026amp; apt-get update \u0026amp;\u0026amp; apt-get install \u003c/span\u003e$@\u003cspan style=\"color:#e6db74\"\u003e \u0026amp;\u0026amp; apt-get autoremove \u0026amp;\u0026amp; apt-get autoclean\u0026#34;\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\u003cspan style=\"color:#66d9ef\"\u003efi\u003c/span\u003e\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eI have this script deployed in a lazy manner, I just have it sitting in my users home folder and called it \u0026ldquo;up\u0026rdquo;, I did do a \u0026ldquo;chmod +x up\u0026rdquo; and just start it like this:\u003c/p\u003e","title":"Debian based full updates in one command"},{"content":"To do this you need two empty drives, with the guide below all data on the drive will be lost if it is not empty!\n1. Install cryptsetup apt-get install cryptsetup 2. Create the dm-crypt cryptsetup -y -v luksFormat /dev/sdb cryptsetup -y -v luksFormat /dev/sdc (Make sure to use the correct device. To show available devices use \u0026ldquo;lsblk\u0026rdquo;.)\n3. Mount the cryptsetup disk cryptsetup luksOpen /dev/sdb disk1 cryptsetup luksOpen /dev/sdc disk2 4. Check if this was successful ls -l /dev/mapper/disk* or sudo cryptsetup -v status disk1 sudo cryptsetup -v status disk2 5. Create BTRFS volume RAID 1, this means all data and meta-data is mirrored, which means if you use 2 drives with i.e. 4TB each you can only use 4TG over all in the BTRFS mounted volume. mkfs.btrfs -m raid1 -d raid1 /dev/mapper/disk1 /dev/mapper/disk2 You could list more than two drive, for example to increase redundancy, but if you want to use more drive to increase storage you would have to use a different Raid level.\n6. Once you created a multi-device file system, you can use any device in the FS for the mount command mount -t btrfs -o noatime,compress=zstd /dev/mapper/disk1 /mnt/btrfs 7. Creat a subvolume for each purpose/for each data storage folder you want to use the RAID 1 for btrfs subvolume create /mnt/btrfs/subvolume1_data For example if you want to store you /srv/http and your /var/lib/mysql on the BTRFS RAID drive you should create one subvolume for each, of them, i.e.\nbtrfs subvolume create /mnt/btrfs/subvolume_http btrfs subvolume create /mnt/btrfs/subvolume_mysql Those subvolumes can than be mounted in the respective folders. Before you mount them you should set the permissions/ownership of the folder as same as their mount folder (in this case check permissions of /srv/www and /var/lib/mysql), then move all files and folders from the current folder to the subvolume (see how to mount it below) and then mount the subvolume to the folder).\n8. Mount the subvolume mount -t btrfs -o subvolume=subvolume1_data,noatime,compress=zstd /dev/mapper/disk1 /mnt/data This uses zstd compression for the mount, this is invoked only by setting the mount parameter. For details on compression see here.\nYou can mount this subvolume, also the main btrfs volume, to any folder you want, lets assume you want to mount it to /home/$USER/data, so instead of the last command you want to do this (if already mounted before, just do \u0026ldquo;umount /mnt/data\u0026rdquo; if you already mounted it)\nmount -t btrfs -o subvolume=subvolume1_data,noatime,compress=zstd /dev/mapper/disk1 /home/$USER/data (folder must exists, \u0026ldquo;mkdir /home/$USER/data\u0026rdquo; if you want to create it)\nNow the subvolume is available in /home/$USER/data, see \u0026ldquo;df -h\u0026rdquo; to check.\nThe output will contain a line like this:\n/dev/mapper/disk1 3.7T 17M 3.7T 1% /home/YOUR_USER_NAME/data\n9. Change permission of the subvolume chown -R $USER:$USER ~/data Now you can write and read from the folder, you have full access to it, which also means you have full access to the subvolume content and the permissions are inherited by folders and files you create in the folder \u0026ldquo;data\u0026rdquo;.\n10. Show BTRFS filesystem sudo btrfs filesystem show The output will look like this\nLabel: none uuid: 690fbca6-f764-4873-9f2c-f60c40197a14 Total devices 2 FS bytes used 656.00KiB devid 1 size 3.64TiB used 2.03GiB path /dev/mapper/disk2 devid 2 size 3.64TiB used 2.03GiB path /dev/mapper/disk1 There is a great cheat sheet for BTRFS here.\nPlease leave a comment if you have a suggestion.\n","permalink":"https://newblog.utzer.de/2020/02/12/create-linux-dm-crypt-btrfs-raid-1/","summary":"\u003cp\u003eTo do this you need two empty drives, with the guide below all data on the drive will be lost if it is not empty!\u003c/p\u003e\n\u003ch4 id=\"1-install-cryptsetup\"\u003e1. Install cryptsetup\u003c/h4\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eapt-get install cryptsetup\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch4 id=\"2-create-the-dm-crypt\"\u003e2. Create the dm-crypt\u003c/h4\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ecryptsetup -y -v luksFormat /dev/sdb\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ecryptsetup -y -v luksFormat /dev/sdc\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003e(Make sure to use the correct device. To show available devices use \u0026ldquo;lsblk\u0026rdquo;.)\u003c/p\u003e\n\u003ch4 id=\"3-mount-the-cryptsetup-disk\"\u003e3. Mount the cryptsetup disk\u003c/h4\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ecryptsetup luksOpen /dev/sdb disk1\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ecryptsetup luksOpen /dev/sdc disk2\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch4 id=\"4-check-if-this-was-successful\"\u003e4. Check if this was successful\u003c/h4\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003els -l /dev/mapper/disk*\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eor\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo cryptsetup -v status disk1\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo cryptsetup -v status disk2\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003ch4 id=\"5-create-btrfs-volume-raid-1-this-means-all-data-and-meta-data-is-mirrored-which-means-if-you-use-2-drives-with-ie-4tb-each-you-can-only-use-4tg-over-all-in-the-btrfs-mounted-volume\"\u003e5. Create BTRFS volume RAID 1, this means all data and meta-data is mirrored, which means if you use 2 drives with i.e. 4TB each you can only use 4TG over all in the BTRFS mounted volume.\u003c/h4\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003emkfs.btrfs -m raid1 -d raid1 /dev/mapper/disk1 /dev/mapper/disk2\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eYou could list more than two drive, for example to increase redundancy, but if you want to use more drive to increase storage you would have to use a different Raid level.\u003c/p\u003e","title":"Create Linux dm-crypt BTRFS RAID 1"},{"content":"I found something pretty useful, just a quick #MySQL / #MariaDB code snippet to show the size of each table of the currently selected database.\nSELECT table_name , round(((data_length + index_length) / 1024 / 1024), 2) as SIZE_MB FROM information_schema.TABLES WHERE table_schema = DATABASE() ORDER BY SIZE_MB DESC; You have to start \u0026lsquo;mysql\u0026rsquo; from CLI, in any terminal emulator of you choice, by adding the database name it should select when started, so lets say the database you\u0026rsquo;re looking to get the table sizes from is \u0026lsquo;wordpress\u0026rsquo; you\u0026rsquo;d have to call \u0026lsquo;mysql wordpress\u0026rsquo; and then in mysql you\u0026rsquo;d have to enter the whole code snippet from above and hit enter afterwards.\nYou\u0026rsquo;ll get a list of all tables ordered by their size, looking like this:\n+---------------------------+---------+ | table_name | SIZE_MB | +---------------------------+---------+ | item | 1656.30 | | item-body | 1166.86 | | terms | 1029.72 | | item-url | 11.89 | | conv | 1.17 | +---------------------------+---------+ Source\n","permalink":"https://newblog.utzer.de/2019/10/02/size-of-each-table-in-a-database-of-mysql-or-mariadb/","summary":"\u003cp\u003eI found something pretty useful, just a quick #MySQL / #MariaDB code snippet to show the size of each table of the currently selected database.\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eSELECT table_name ,\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e  round(((data_length + index_length) / 1024 / 1024), 2) as SIZE_MB\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eFROM information_schema.TABLES\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eWHERE table_schema = DATABASE() ORDER BY SIZE_MB DESC;\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eYou have to start \u0026lsquo;mysql\u0026rsquo; from CLI, in any terminal emulator of you choice, by adding the database name it should select when started, so lets say the database you\u0026rsquo;re looking to get the table sizes from is \u0026lsquo;wordpress\u0026rsquo; you\u0026rsquo;d have to call \u0026lsquo;mysql wordpress\u0026rsquo; and then in mysql you\u0026rsquo;d have to enter the whole code snippet from above and hit enter afterwards.\u003c/p\u003e","title":"Size of each table in a database of MySQL or MariaDB"},{"content":"How to add a swap drive to your system, in this case I did this for a virtual machine (qemu) running Arch Linux.\nSee at the bottom for information about the virtual drive for qemu.\nList current available to system disks:\nsudo blkid List all disks:\nsudo lsblk Format as swap:\nsudo mkswap /dev/vdb gives back the UUID\nNow the new swap disk will be shown when executing this again:\nsudo blkid (also give the UUID)\nTake the UUID from above and add an entry in /etc/fstab like this:\necho \u0026#34;UUID=56445300-90f5-40b4-860b-99037d0e8aad none swap sw 0 0\u0026#34; |sudo tee -a /etc/fstab Actiate available swap disks, ie. from fstab or on GPT volume.\nsudo swapon -a Check the swap is available now:\nsudo swapon --show The qemu image I created as \u0026ldquo;raw\u0026rdquo;, VirtIO and set the cache mode to \u0026ldquo;writeback\u0026rdquo;, this should be fine for swap while being fast too. See explanation here and here.\nI also looked at this information about how to add a swap disk.\nAs always, give me your feedback, I will add information that can help in the future.\n","permalink":"https://newblog.utzer.de/2019/10/02/how-to-add-a-swap-drive-to-your-system/","summary":"\u003cp\u003eHow to add a swap drive to your system, in this case I did this for a virtual machine (qemu) running \u003ca href=\"https://wiki.archlinux.org/index.php/Swap\"\u003eArch Linux\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eSee at the bottom for information about the virtual drive for qemu.\u003c/p\u003e\n\u003cp\u003eList current available to system disks:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo blkid\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eList all disks:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo lsblk\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eFormat as swap:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo mkswap /dev/vdb\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003egives back the UUID\u003c/p\u003e\n\u003cp\u003eNow the new swap disk will be shown when executing this again:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo blkid\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003e(also give the UUID)\u003c/p\u003e","title":"How to add a swap drive to your system"},{"content":"\u0026hellip; is an easy to use and powerful tool, it can be used to replace part of file name (string1) with some other string. Something one can also do with some \u0026ldquo;sed\u0026rdquo; hack, but this tool is much easier to use, especially for beginners.\nYou can get all information needed from \u0026ldquo;rename \u0026ndash;help\u0026rdquo; (here from Linux Mint):\nrename --help Usage: rename [ -h|-m|-V ] [ -v ] [ -n ] [ -f ] [ -e|-E perlexpr]*|perlexpr [ files ] Options: -v, -verbose Verbose: print names of files successfully renamed. -n, -nono No action: print names of files to be renamed, but don\u0026#39;t rename. -f, -force Over write: allow existing files to be over-written. -h, -help Help: print SYNOPSIS and OPTIONS. -m, -man Manual: print manual page. -V, -version Version: show version number. -e Expression: code to act on files name. May be repeated to build up code (like \u0026#34;perl -e\u0026#34;). If no -e, the first argument is used as code. -E Statement: code to act on files name, as -e but terminated by \u0026#39;;\u0026#39;. I did use this tool rename some files that contained the string \u0026ldquo;www\u0026rdquo;, which I had to replace with \u0026ldquo;web\u0026rdquo;, lets say there were files named like this:\nwww.example.com-97126.ccd\nwww.example.com-54852.ccd\nwww.example.com-87430.ccd\nwww.example.com-75413.ccd\nFor Ubuntu, maybe also Debian, based systems I use the following command to rename all above files:\nrename -e \u0026#39;s/www/web/\u0026#39; *.ccd After this the files are now called\nweb.example.com-\u0026hellip;.\n\u0026hellip;.\nThe only problem is, the syntax varies from one Linux distribution to another, so check the syntax before you use rename.\nFor Arch Linux I found that something like this would work:\nrename www web *.ccd The expression \u0026ldquo;*.ccd\u0026rdquo; defines which files to act on, so this will act on all files that match \u0026ldquo;*.ccd*, in the example above you could also use \u0026ldquo;www.example.com-*.ccd\u0026rdquo; or something similar.\nMain thing I wanted to get out there is, there is an easy tool to batch rename files instead of some complex if-for bash code. Which I tried to use before but failed at.\n","permalink":"https://newblog.utzer.de/2019/04/29/rename/","summary":"\u003cp\u003e\u0026hellip; is an easy to use and powerful tool, it can be used to replace part of file name (string1) with some other string. Something one can also do with some \u0026ldquo;sed\u0026rdquo; hack, but this tool is much easier to use, especially for beginners.\u003c/p\u003e\n\u003cp\u003eYou can get all information needed from \u0026ldquo;rename \u0026ndash;help\u0026rdquo; (here from Linux Mint):\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003erename --help\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eUsage:\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    rename [ -h|-m|-V ] [ -v ] [ -n ] [ -f ] [ -e|-E perlexpr]*|perlexpr\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    [ files ]\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eOptions:\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    -v, -verbose\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e            Verbose: print names of files successfully renamed.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    -n, -nono\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e            No action: print names of files to be renamed, but don\u0026#39;t rename.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    -f, -force\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e            Over write: allow existing files to be over-written.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    -h, -help\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e            Help: print SYNOPSIS and OPTIONS.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    -m, -man\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e            Manual: print manual page.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    -V, -version\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e            Version: show version number.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    -e      Expression: code to act on files name.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e            May be repeated to build up code (like \u0026#34;perl -e\u0026#34;). If no -e, the\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e            first argument is used as code.\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e    -E      Statement: code to act on files name, as -e but terminated by\n\u003c/span\u003e\u003c/span\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003e            \u0026#39;;\u0026#39;.\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eI did use this tool rename some files that contained the string \u0026ldquo;www\u0026rdquo;, which I had to replace with \u0026ldquo;web\u0026rdquo;, lets say there were files named like this:\u003c/p\u003e","title":"rename"},{"content":"This will be a short post about the above mentioned parts, lets start right away.\nSSH config Every user can have a SSH client configuration file, it is located in ~/.ssh/config (where config ist the filename).\nMy SSH config file, I guess as many other users file, grew over time. Lets start with some things from my file.\nThere is the Host part, it usually contains the name you want to assign to the host to use it later on. Tipp, use some short and of course unique name.\nHost myserver The Host part can be wildcard, then the following parameters are valid for any Host. It then looks like this:\nHost * ServerAliveInterval 15 ControlMaster auto ControlPath /tmp/ssh-%r@%h:%p ServerAliveInterval\nSets a timeout interval in seconds after which if no data has been received from the server, ssh(1) will send a message through the encrypted channel to request a response from the server. The default is 0, indicating that these messages will not be sent to the server. This option applies to protocol version 2 only.\nThis is copied from the man page of \u0026ldquo;ssh_config\u0026rdquo;.\nIn the case above it means the client will keep the connection alive by sending some packet every 15 seconds at least. The packet is send and the client will wait for a reply for 3 times the interval (2 packet can get lost) by default. I use this setting to be sure the connection is kept alive and it is still alive. I work on a mobile connection quite often.\nControlMaster auto ControlPath /tmp/ssh-%r@%h:%p These two options might be helpful in particular cases when you use multiple SSH connection to one host and want to save some time to build up the connection. The option is explained here and the options \u0026ldquo;/tmp/ssh-%r@%h:%p\u0026rdquo; are explained very well here. Basically it will use a socket to connect to the host and the socket will be in \u0026ldquo;/tmp/ssh-%r@%h:%p\u0026rdquo;, where \u0026ldquo;r\u0026rdquo; is the remote user name, \u0026ldquo;h\u0026rdquo; is the host name and \u0026ldquo;p\u0026rdquo; is the port number. The use of all this ensures that the socket name is unique.\nHost myserver HostName example.org User username Port 22 #\tIdentityFile ~/.ssh/id_rsa ForwardAgent yes Compression yes #CompressionLevel 9 HostName contains the remote IP or host name (domain name) you want to connect to, like in \u0026ldquo;ssh username@example.org\u0026rdquo; the example.org.\nUser contains the remote username.\nThis two are the minimum configuration parameters you want to use. When you want to connect to example.org via SSH you now just have to type the command \u0026ldquo;ssh myserver\u0026rdquo; and it will connect you as you are used to, but with much less typing.\nPort is not needed if you want to use 22 (standard SSH port), so it is useless in the example above, but if you want to connect to some host that runs the SSH service on some non standard port, lets say 6022 you can use \u0026ldquo;Port 6022\u0026rdquo; to provide the port.\nIdentityFile contains the identity file specific to the host. I commented this out some time ago because I now use a SSH-Agent, which you can do as well, there is \u0026ldquo;ssh-add\u0026rdquo; on any standard Linux system. So when I start a session I just do \u0026ldquo;ssh-add .ssh/id_rsa .ssh/id2_rsa\u0026rdquo; and so on to add all my needed ssh keys to the SSH-Agent.\nWith ForwardAgent your available keys from you local ssh-agent can be used on the remote host too, this is helpful when from the remote host you want to ssh to another server. I would suggest to use this option on any host, so you could move it to the \u0026ldquo;Host *\u0026rdquo; section.\nUsing this parameter will be handy if you want to rsync from one server to another.\nYou can use Compression if you are using a slow connection of if you transfer big amounts of data via SSH, it can be a bottle neck if your CPUs (local and remote) are not that fast. So it may be better to use Compression only in special cases or on really slow connections.\nWith CompressionLevel you can set the compression level, it is like with most other compressions and I came to the conclusion to comment it out with the #, so it is not used in my configuration anymore. Check the man page of gzip or similar to see the compression levels explanation from 1-9.\nSo if you want you can use the \u0026ldquo;Host *\u0026rdquo; section like this:\nHost * ServerAliveInterval 15 ControlMaster auto ControlPath /tmp/ssh-%r@%h:%p ForwardAgent yes Jump hosts In some cases I want to connect to some host that is not reachable from the outside world (aka. the Internet), in this cases I use a jump host that is connected to that internal network.\nI had to work some years the usual way, the usual way being to connect to the jump host by \u0026ldquo;ssh jumphost\u0026rdquo; and then open another ssh connection from its local command line interface. Instead you can add the following to your ssh configuration for the host in the internal network.\nssh -q -W %h:%p myserver Explanation from explainshell.com:\nssh(1) -q -W %h:%p myserver\nOpenSSH SSH client (remote login program)-q Quiet mode. Causes most warning and diagnostic messages to be suppressed.-W host:port Requests that standard input and output on the client be forwarded to host on port over the secure channel. Implies -N, -T, ExitOnForwardFailure and ClearAllForwardings and works with Protocol version 2 only.ssh connects and logs into the specified hostname (with optional user name). The user must prove his/her identity to the remote machine using one of several methods depending on the protocol version used (see below).\nIf command is specified, it is executed on the remote host instead of a login shell.\nSo when you add that to another Host configuration like this:\nHost machine2 HostName 192.168.0.42 User username ssh -q -W %h:%p myserver This would mean that your ssh connection to 192.168.0.42 as user username would be made via myserver and all data would be forwarded via myserver. This can also be used to connect via a particular server all the time if it is added to the \u0026ldquo;Host *\u0026rdquo; section of you ssh config.\nSSH config for hidden Tor service SSH server Something else I like to use ssh config for, is to connect to SSH via a tor Onion service, which I like to use for headless small computers (portable computer without a screen) like a Raspberry Pi that I connect to some network and want to SSH into them without knowing their IP address in the LAN. The setup of a Tor hidden service can be found online, the basic way it works is that your raspberry pi will tunnel to the Internet and be reachable via a hidden service.\nHost raspberrypi HostName ap37csfkkmkksmkktllhjkcqd.onion User Pi Port 22 VerifyHostKeyDNS no ProxyCommand /bin/nc -xlocalhost:9050 -X5 %h %p HostName now contains the .Onion domain of the hidden service.\nI use VerifyHostKeyDNS to avoid warning about changed DNS for that host. I am not sure if it is actually needed, but at some point I added it.\nThe ProxyCommand parameter now is the important thing. I requires you to have Tor running as a client, this should be possible by \u0026quot; sudo apt-get install tor \u0026amp;\u0026amp; sudo systemctl enable tor.service \u0026ndash;now\u0026quot; Probably have to run it in two commands.\nThis uses netcat (nc) to forward all packets from ssh to nc to the local port 9050 (standard Tor Socks port).\nI never noted what exactly the parameters for nc do. :-) if anyone know please let me know. I tried a quick search but it did not bring up any helpful results.\nPort must contain the port the hidden service ssh is available at, this can be different from the clients ssh daemon/server but is defined by the hidden service configuration in the torrc config file.\nHave a look in the manpage of ssh by typing \u0026ldquo;man ssh\u0026rdquo; in your command line or open the manpage online. The ssh_config manpage is also very helpful.\nautossh I lately started to use autossh in combination with remote screen sessions, screen is the tool to use if you work remotely and do something that you want to continue after a possible connection interruption. There is tmux as well, but I prefer screen. Please have a look at both and choose which you prefer and use it.\nQuote from the manpage of autossh:\nautossh is a program to start a copy of ssh and monitor it, restarting it as necessary should it die or stop passing traffic.\nIt basically improves the interruption resistivity of ssh by wrapping some other things around the connection and by using some special parameters. As I said I work remotely often and also I use mobile connections often on trains as well, I uses mosh (MObile SHell) before, but it is not working with screen that well, also it had some other downsides and to I ended up with autossh.\nLet me know if there is any faults in this summary about my ssh use and setup.\nEdit:\nI figured something else out, I always wanted to keep my ssh config in sync between some computers. The problem was the synced folder is not ~/.ssh but ~/some/other/folder and in there I have a \u0026ldquo;ssh_config\u0026rdquo; file. So I tried to symlink that to my ~/.ssh which did not work (ln -s ~/some/other/folder/ssh_config ~/.ssh/config did not work) because auf some permission issue I think. Host in the file were just not found.\nToday I figured out that I can include another file in my ~/.ssh/config by adding the following line in my ssh config file:\nInclude ~/some/other/folder/ssh_config This now allows me to sync ~/some/other/folder/ssh_config between computers and include that file in my ssh config files on any computer I like to.\n","permalink":"https://newblog.utzer.de/2019/04/14/ssh-config-ssh-via-jumphost-and-autossh-ssh-to-tor-hidden-service/","summary":"\u003cp\u003eThis will be a short post about the above mentioned parts, lets start right away.\u003c/p\u003e\n\u003ch3 id=\"ssh-config\"\u003eSSH config\u003c/h3\u003e\n\u003cp\u003eEvery user can have a SSH client configuration file, it is located in ~/.ssh/config (where \u003cstrong\u003econfig\u003c/strong\u003e ist the filename).\u003cbr\u003e\nMy SSH config file, I guess as many other users file, grew over time. Lets start with some things from my file.\u003c/p\u003e\n\u003cp\u003eThere is the \u003cstrong\u003eHost\u003c/strong\u003e part, it usually contains the name you want to assign to the host to use it later on. Tipp, use some short and of course unique name.\u003c/p\u003e","title":"SSH config, ssh via jumphost and autossh (ssh to Tor hidden service)"},{"content":"VM runterfahren Image der VM vergrössern: sudo qemu-img resize /var/lib/libvirt/images/vm_disk.img +15GB Je nach Setup ist sudo nicht nötig, durch den Befehl wird die Diskimagedatei um 15 GB vergrößert.\nVM starten Weiter geht es in der VM auf der Konsole.\nPartitioen mit parted anzeigen lassen: parted -l Ausgabe so oder ähnlich:\nModel: Virtio Block Device (virtblk)\nDisk /dev/vda: 53,7GB\nSector size (logical/physical): 512B/512B\nPartition Table: msdos\nDisk Flags:\nNumber Start End Size Type File system Flags\n1 1049kB 53,7GB 53,7GB primary btrfs boot\nIch habe, bevor ich angefangen habe, die VM heruntergefahren und eine Kopie des Diskimage erstellt. Deswegen habe ich mich dann entschieden die Partition in der laufenden VM anzupassen, grundsätzlich sollte das bei Linux gehen. Auflösung, es hat geklappt. Also weiter.\nDisk auswählen bei Start von Parted: sudo parted /dev/vda In parted the Partitionen nochmal anzeigen: print Ausgabe so oder ähnlich:\nModel: Virtio Block Device (virtblk)\nDisk /dev/vda: 69,8GB\nSector size (logical/physical): 512B/512B\nPartition Table: msdos\nDisk Flags:\nNumber Start End Size Type File system Flags\n1 1049kB 53,7GB 53,7GB primary btrfs boot\nIn parted die Partition (1) vergrößern: resizepart 1 Dann die Abfragen bestätigen, maximale Größe eingeben (max oder 100% scheinen nicht mehr zu funktionieren) und bestätigen das der Vorgang durchgeführt werden soll trotz das die Partition gemountet ist.\nZu guter Letzt noch Dateisystem (btrfs) vergrössern: sudo btrfs filesystem resize max / Anmerkung: Bei anderen Dateisystemen ist der Befehl ein anderer. Im Beispiel ist der Mountpoint \u0026ldquo;/\u0026rdquo;, ggf. muss die auch angepasst werden.\n","permalink":"https://newblog.utzer.de/2019/03/16/resize-qemu-vm-disk/","summary":"\u003ch4 id=\"vm-runterfahren\"\u003eVM runterfahren\u003c/h4\u003e\n\u003ch4 id=\"image-der-vm-vergrössern\"\u003eImage der VM vergrössern:\u003c/h4\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-gdscript3\" data-lang=\"gdscript3\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo qemu\u003cspan style=\"color:#f92672\"\u003e-\u003c/span\u003eimg resize \u003cspan style=\"color:#f92672\"\u003e/\u003c/span\u003e\u003cspan style=\"color:#66d9ef\"\u003evar\u003c/span\u003e\u003cspan style=\"color:#f92672\"\u003e/\u003c/span\u003elib\u003cspan style=\"color:#f92672\"\u003e/\u003c/span\u003elibvirt\u003cspan style=\"color:#f92672\"\u003e/\u003c/span\u003eimages\u003cspan style=\"color:#f92672\"\u003e/\u003c/span\u003evm_disk\u003cspan style=\"color:#f92672\"\u003e.\u003c/span\u003eimg \u003cspan style=\"color:#f92672\"\u003e+\u003c/span\u003e\u003cspan style=\"color:#ae81ff\"\u003e15\u003c/span\u003eGB\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eJe nach Setup ist sudo nicht nötig, durch den Befehl wird die Diskimagedatei um 15 GB vergrößert.\u003c/p\u003e\n\u003ch4 id=\"vm-starten\"\u003eVM starten\u003c/h4\u003e\n\u003cp\u003eWeiter geht es in der VM auf der Konsole.\u003c/p\u003e\n\u003ch4 id=\"partitioen-mit-parted-anzeigen-lassen\"\u003ePartitioen mit parted anzeigen lassen:\u003c/h4\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eparted -l\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eAusgabe so oder ähnlich:\u003cbr\u003e\n\u003cem\u003eModel: Virtio Block Device (virtblk)\u003cbr\u003e\nDisk /dev/vda: 53,7GB\u003cbr\u003e\nSector size (logical/physical): 512B/512B\u003cbr\u003e\nPartition Table: msdos\u003cbr\u003e\nDisk Flags:\u003c/em\u003e\u003c/p\u003e\n\u003cp\u003e\u003cem\u003eNumber Start End Size Type File system Flags\u003cbr\u003e\n1 1049kB 53,7GB 53,7GB primary btrfs boot\u003c/em\u003e\u003c/p\u003e","title":"Resize qemu VM disk"},{"content":"Did you know explainshell.com yet? Try it, for example with that command from last time\nsudo lsof -i -P -n | grep LISTEN this is an amazing web site I use often so see what commands do that I find somewhere. Try it.\n","permalink":"https://newblog.utzer.de/2019/03/16/explainshell/","summary":"\u003cp\u003eDid you know \u003ca href=\"https://explainshell.com/\"\u003eexplainshell.com\u003c/a\u003e yet? Try it, for example with that command from \u003ca href=\"/2019/03/15/lsof-local-open-ports/\"\u003elast time\u003c/a\u003e\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo lsof -i -P -n | grep LISTEN\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003ethis is an amazing web site I use often so see what commands do that I find somewhere. Try it.\u003c/p\u003e","title":"explainshell.com"},{"content":"It drives me nuts that I cannot copy something from a ssh terminal when I use vim. I have no clue what this visual mode is meant to do besides anoying my.\nMy solution:\necho \u0026#34;set mouse-=a\u0026#34; \u0026gt;\u0026gt; ~/.vimrc no more visual mode -\u0026gt; marking and copying text from vim by using the mouse works again.\n","permalink":"https://newblog.utzer.de/2019/03/16/disable-vim-visual-mode/","summary":"\u003cp\u003eIt drives me nuts that I cannot copy something from a ssh terminal when I use vim. I have no clue what this visual mode is meant to do besides anoying my.\u003c/p\u003e\n\u003cp\u003eMy solution:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003eecho \u0026#34;set mouse-=a\u0026#34; \u0026gt;\u0026gt; ~/.vimrc\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eno more visual mode -\u0026gt; marking and copying text from vim by using the mouse works again.\u003c/p\u003e","title":"disable vim visual mode"},{"content":"A short one:\nCommand lsof -i -P -n | grep LISTEN This will output all the ports the system is listing on. You might have to prepend \u0026ldquo;sudo\u0026rdquo;.\nSo then the command will be:\nsudo lsof -i -P -n | grep LISTEN The list is long without the \u0026ldquo;grep\u0026rdquo;, it will filter the output and only show the lines which contain \u0026ldquo;LISTEN\u0026rdquo;.\nEdit:\nOliver from Hubzilla (part of the Fediverse) pointed out that\nnetstat -anpl might be helpful too. The command shows all the listing sockets of the Linux machine it is run on. (I added the \u0026ldquo;l\u0026rdquo; parameter to just show listing sockets.\n","permalink":"https://newblog.utzer.de/2019/03/15/lsof-local-open-ports/","summary":"\u003cp\u003eA short one:\u003c/p\u003e\n\u003ch3 id=\"command\"\u003eCommand\u003c/h3\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003elsof -i -P -n | grep LISTEN\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eThis will output all the ports the system is listing on. You might have to prepend \u0026ldquo;sudo\u0026rdquo;.\u003c/p\u003e\n\u003cp\u003eSo then the command will be:\u003c/p\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003esudo lsof -i -P -n | grep LISTEN\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003eThe list is long without the \u0026ldquo;grep\u0026rdquo;, it will filter the output and only show the lines which contain \u0026ldquo;LISTEN\u0026rdquo;.\u003c/p\u003e\n\u003cp\u003eEdit:\u003cbr\u003e\nOliver from \u003ca href=\"https://fediverse.party/en/hubzilla/\"\u003eHubzilla\u003c/a\u003e (part of the \u003ca href=\"https://fediverse.party/en/fediverse/\"\u003eFediverse\u003c/a\u003e) pointed out that\u003c/p\u003e","title":"lsof - local open ports"},{"content":"Für diese Seite gilt das Impressum und der Datenschutzhinweis auf blog.utzer.de.\nKontaktdaten sind ebenfalls unter dem obigen Link zu finden.\n","permalink":"https://newblog.utzer.de/impressum-und-datenschutz/","summary":"\u003cp\u003eFür diese Seite gilt das Impressum und der Datenschutzhinweis auf \u003ca href=\"https://blog.utzer.de/kontakt/\"\u003eblog.utzer.de\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eKontaktdaten sind ebenfalls unter dem obigen Link zu finden.\u003c/p\u003e","title":"Impressum und Datenschutz"},{"content":"This is kind of my cheat sheet, nothing fancy, just what I need.\nCommand: rsync -chavzP --stats \u0026#39;host:~/RemotePath\u0026#39; ./LocalPath rsync - Befehl\n-c, \u0026ndash;checksum\n-h, \u0026ndash;human-readable\n-a, \u0026ndash;archive\n-v, \u0026ndash;verbose\n-z, \u0026ndash;compress\n-P - equivalent to \u0026ndash;partial \u0026ndash;progress\n\u0026ndash;stats - This tells rsync to print a verbose set of statistics on the file transfer\n\u0026lsquo;host:~/RemotePath\u0026rsquo; - is the source path (in this case a remote path.\n./LocalPath - ist the destination\nSome more variants: from local to remote\nrsync -chavzP --stats ~/FileName.file \u0026#39;host:~/path/\u0026#39; Leave the z if compression does not matter (in most cases it does not matter).\nrsync -chavP --stats ~/FileName.file \u0026#39;host:~/path/\u0026#39; Rsync to MOVE a folder from A to B. Source will be deleted!!\nrsync -hcavP --stats --remove-source-files ./source ./destination_folder Rsync can be used from local to local to copy files. It can be used from \u0026lsquo;remote\u0026rsquo; to local or vom local to \u0026lsquo;remote\u0026rsquo;, unfortunately it can not copy from remote to remote.\nDon\u0026rsquo;t forget to include the ticks around the remote (host) part.\nI this \u0026ldquo;rsync -chavzP \u0026ndash;stats /FileName.file \u0026lsquo;host:/path/\u0026rsquo;\u0026rdquo; the \u0026ldquo;host\u0026rdquo; is defined in my ~/.ssh/config, but you can also do something like this:\n\u0026ldquo;rsync -chavzP \u0026ndash;stats /FileName.file \u0026lsquo;user@example.org:/path/\u0026rsquo;\u0026rdquo;\nThis even work via ssh jump hosts. I will write something about that soon.\n","permalink":"https://newblog.utzer.de/2019/03/15/rsync/","summary":"\u003cp\u003eThis is kind of my cheat sheet, nothing fancy, just what I need.\u003c/p\u003e\n\u003ch4 id=\"command\"\u003eCommand:\u003c/h4\u003e\n\u003cdiv class=\"highlight\"\u003e\u003cpre tabindex=\"0\" style=\"color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;\"\u003e\u003ccode class=\"language-fallback\" data-lang=\"fallback\"\u003e\u003cspan style=\"display:flex;\"\u003e\u003cspan\u003ersync -chavzP --stats \u0026#39;host:~/RemotePath\u0026#39; ./LocalPath\n\u003c/span\u003e\u003c/span\u003e\u003c/code\u003e\u003c/pre\u003e\u003c/div\u003e\u003cp\u003ersync - Befehl\u003cbr\u003e\n-c, \u0026ndash;checksum\u003cbr\u003e\n-h, \u0026ndash;human-readable\u003cbr\u003e\n-a, \u0026ndash;archive\u003cbr\u003e\n-v, \u0026ndash;verbose\u003cbr\u003e\n-z, \u0026ndash;compress\u003cbr\u003e\n-P - equivalent to \u0026ndash;partial \u0026ndash;progress\u003cbr\u003e\n\u0026ndash;stats - This tells rsync to print a verbose set of statistics on the file transfer\u003cbr\u003e\n\u0026lsquo;host:~/RemotePath\u0026rsquo; - is the source path (in this case a remote path.\u003cbr\u003e\n./LocalPath - ist the destination\u003c/p\u003e","title":"rsync"},{"content":"I decided to write my notes about Linux, technology, programming, scripts, tor and other things into a blog.\nI do not think these are best solutions, neither to I think this are good solutions, but I hope to help some people and after all I hope to get feedback and lern something from those reading my notes.\nPlease comment on a post to help me to improve it.\n","permalink":"https://newblog.utzer.de/2019/03/14/hello-world/","summary":"\u003cp\u003eI decided to write my notes about Linux, technology, programming, scripts, tor and other things into a blog.\u003c/p\u003e\n\u003cp\u003eI do not think these are best solutions, neither to I think this are good solutions, but I hope to help some people and after all I hope to get feedback and lern something from those reading my notes.\u003c/p\u003e\n\u003cp\u003ePlease comment on a post to help me to improve it.\u003c/p\u003e","title":"Hello World"}]