Size of each table in a database of MySQL or MariaDB

I found something pretty useful, just a quick #MySQL / #MariaDB code snippet to show the size of each table of the currently selected database. SELECT 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 ‘mysql’ 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’re looking to get the table sizes from is ‘wordpress’ you’d have to call ‘mysql wordpress’ and then in mysql you’d have to enter the whole code snippet from above and hit enter afterwards. ...

2. Oktober 2019 · 1 Minute · utzer

How to add a swap drive to your system

How to add a swap drive to your system, in this case I did this for a virtual machine (qemu) running Arch Linux. See at the bottom for information about the virtual drive for qemu. List current available to system disks: sudo blkid List all disks: sudo lsblk Format as swap: sudo mkswap /dev/vdb gives back the UUID Now the new swap disk will be shown when executing this again: sudo blkid (also give the UUID) ...

2. Oktober 2019 · 1 Minute · utzer

rename

… 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 “sed” hack, but this tool is much easier to use, especially for beginners. You can get all information needed from “rename –help” (here from Linux Mint): rename --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'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 "perl -e"). If no -e, the first argument is used as code. -E Statement: code to act on files name, as -e but terminated by ';'. I did use this tool rename some files that contained the string “www”, which I had to replace with “web”, lets say there were files named like this: ...

29. April 2019 · 2 Minuten · utzer

SSH config, ssh via jumphost and autossh (ssh to Tor hidden service)

This will be a short post about the above mentioned parts, lets start right away. SSH config Every user can have a SSH client configuration file, it is located in ~/.ssh/config (where config ist the filename). My SSH config file, I guess as many other users file, grew over time. Lets start with some things from my file. There 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. ...

14. April 2019 · 8 Minuten · utzer

Resize qemu VM disk

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. VM starten Weiter geht es in der VM auf der Konsole. Partitioen mit parted anzeigen lassen: parted -l Ausgabe so oder ähnlich: Model: Virtio Block Device (virtblk) Disk /dev/vda: 53,7GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags: Number Start End Size Type File system Flags 1 1049kB 53,7GB 53,7GB primary btrfs boot ...

16. März 2019 · 2 Minuten · utzer

explainshell.com

Did you know explainshell.com yet? Try it, for example with that command from last time sudo 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.

16. März 2019 · 1 Minute · utzer

disable vim visual mode

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. My solution: echo "set mouse-=a" >> ~/.vimrc no more visual mode -> marking and copying text from vim by using the mouse works again.

16. März 2019 · 1 Minute · utzer

lsof - local open ports

A short one: Command lsof -i -P -n | grep LISTEN This will output all the ports the system is listing on. You might have to prepend “sudo”. So then the command will be: sudo lsof -i -P -n | grep LISTEN The list is long without the “grep”, it will filter the output and only show the lines which contain “LISTEN”. Edit: Oliver from Hubzilla (part of the Fediverse) pointed out that ...

14. März 2019 · 1 Minute · utzer

rsync

This is kind of my cheat sheet, nothing fancy, just what I need. Command: rsync -chavzP --stats 'host:~/RemotePath' ./LocalPath rsync - Befehl -c, –checksum -h, –human-readable -a, –archive -v, –verbose -z, –compress -P - equivalent to –partial –progress –stats - This tells rsync to print a verbose set of statistics on the file transfer ‘host:~/RemotePath’ - is the source path (in this case a remote path. ./LocalPath - ist the destination ...

14. März 2019 · 1 Minute · utzer

Hello World

I decided to write my notes about Linux, technology, programming, scripts, tor and other things into a blog. I 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. Please comment on a post to help me to improve it.

14. März 2019 · 1 Minute · utzer