Archive for the ‘*nix-tools’ Category
Posted by jpluimers on 2024/06/25
Every once in a while, b0rk (Julia Evans, of [Wayback/Archive] wizard zines fame) asks interesting questions like below that results in lot of cool links.
I have blogged assemblies of them before (see for instance Lots of interesting git links via b0rk on Twitter) and this one is no different:
[Wayback/Archive] Julia Evans on Twitter: “what are some helpful programming learning games? thinking of things like mystery.knightlab.com for SQL, and flexboxfroggy.com, and ohmygit.org especially interested in games that have helped you learn something”
The response was overwhelmingly good (I tried to indicate when games are not free or not playable from a web browser). I summarised it below.
Read the rest of this entry »
Posted in *nix, *nix-tools, Conference Topics, Conferences, CSS, Database Development, Development, DVCS - Distributed Version Control, Event, Games, git, Multi-Threading / Concurrency, Power User, RegEx, Scripting, sh, Sh Shell, Software Development, Source Code Management, SQL, Web Development | Leave a Comment »
Posted by jpluimers on 2024/04/26
Ctrl-Alt-Del will not safely reboot all systems under all circumstances.
If you run Linux, your keyboard has a magic RysRq key (sometimes not marked, but its the same key as the Print-Scrn key) and the Linux kernel is still running not all is lost.
Due to link rot, the archived links are the most recent that have all the comments for [Wayback/Archive] Fix a Frozen System with the Magic SysRq Keys | FOSSwire which amend
You finally got your Linux environment to crash. Ctrl+Alt+Backspace does nothing, nor do the F-keys. You know you shouldn’t have installed that bad driver, but you did it anyway.
So you reach for the power button.
Stop.
Mashing in the power button to reboot could cause a problem if your hard drive is still being written to, and usually causes more problems than it solves. The Linux kernel includes a secret method of restarting your PC should it ever stop doing its job.
- Hold down the Alt and SysRq (Print Screen) keys.
- While holding those down, type the following in order. Nothing will appear to happen until the last letter is pressed: REISUB
- Watch your computer reboot magically.
This 2007 comment makes it easier to remember: REISUB is the reverse of BUSIER:
R E I S U B – is just the word busier in reverse.
Read the rest of this entry »
Posted in *nix, *nix-tools, Hardware, Keyboards and Keyboard Shortcuts, KVM keyboard/video/mouse, LifeHacker, Linux, Power User | Leave a Comment »
Posted by jpluimers on 2024/02/22
Cool: [Wayback] ShellCheck – shell script analysis tool
ShellCheck finds bugs in your shell scripts
It needs a shebang at the start of a script (like #!/usr/bin/env bash) to recognise the kind of shell, then does amazing analysis.
It is open source at [Wayback/Archive.is] koalaman/shellcheck: ShellCheck, a static analysis tool for shell scripts with excellent documentation including explaining screenshots like

It’s not just available on-line or on the command-line, but also integrates with many code editors (like [Wayback/Archive.is] ShellCheck – Visual Studio Marketplace: Integrates ShellCheck into VS Code, a linter for Shell scripts.) and CI/CD pipelines.
Via: [Wayback] bash – error conditional binary operator expected in compound branch – Unix & Linux Stack Exchange (thanks [Wayback] Cyrus!)
–jeroen
Posted in *nix, *nix-tools, ash/dash, ash/dash development, bash, bash, Development, Power User, Scripting, Software Development | Leave a Comment »
Posted by jpluimers on 2024/02/01
Not long after Figuring out which processes are preventing to eject/unmount my MacOS Time Machine backup USB drive, I wanted to do the opposite: prevent /Volumes/Sandisk1TB from being ejected, as this is the “built-in” MicroSD card I use to store large or infrequently used files on (ISO and other disk images, drivers, hardware and software documentation, stuff to be installed on a fresh machine).
The opposite is straightforward: have a process keep at least one handle open on the Volume as per [Wayback] macos – How do I not accidentally eject external drives? – Ask Different (thanks [Wayback] kLy, [Wayback] dan and [Wayback] gerlos):
If your important external drive is mounted on the following mount point:
/Volumes/important_disk
Then you can protect it against an accidental removal by locking this mount point as opened. For this one very simple method consists in opening Terminal and doing this basic command:
$ cd /Volumes/important_disk
To get rid of this locking, you might type within the same Terminal window:
$ cd /
or you might as well just close this Terminal window ($ exit, or ⌃+D, or ⌘+W).
…
An even more elegant way to do it is open a screen session (just type screen in Terminal) and open the mount point from that session. This way you can even close Terminal, since the session will keep running in the background, until you reattach it and stop it (so there’s no need to keep a window open if you don’t need it). I guess you can even create an Automator action for it. For tips on screen see: [Wayback] kinnetica.com/2011/05/29/using-screen-on-mac-os-x
–jeroen
Posted in *nix, *nix-tools, Apple, Mac OS X / OS X / MacOS, Power User, screen, Terminal | Leave a Comment »
Posted by jpluimers on 2024/01/10
I bumped into [Wayback/Archive] Script to rename a virtual machine in ESXi 6: gist.github.com/Gremgoll/8bd91258d71fe895c0d416e2543ca2dc.
Then I forked it with the intent to make usage more clear, as the current usage on my ESXi rig (which has mos VMs not in the root of data stores) is like the bold italic portion here:
[root@X9SRI3F-ESXi:/vmfs/volumes/608be754-f21556ad-1082-0025907d9d5c/VM] vm-rename.sh NVMe980PRO_1TB/VM X9SRI-3F-W10P-NL-OFFICE X9SRI-3F-W10P-NL X9SRI-3F-W10P-NL-OFFICE
VOLNAME=NVMe980PRO_1TB/VM
DIRNAME=X9SRI-3F-W10P-NL-OFFICE
OLDNAME=X9SRI-3F-W10P-NL
NEWNAME=X9SRI-3F-W10P-NL-OFFICE
VM_DIRPATH=/vmfs/volumes/NVMe980PRO_1TB/VM/X9SRI-3F-W10P-NL-OFFICE
NW_DIRPATH=/vmfs/volumes/NVMe980PRO_1TB/VM/X9SRI-3F-W10P-NL-OFFICE
Failed to rename './X9SRI-3F-W10P-NL-flat.vmdk' to './X9SRI-3F-W10P-NL-OFFICE-flat.vmdk': The file specified is not a virtual disk (15)
renaming ./X9SRI-3F-W10P-NL-41260b40.vmem to ./X9SRI-3F-W10P-NL-OFFICE-41260b40.vmem
renaming ./X9SRI-3F-W10P-NL-41260b40.vmss to ./X9SRI-3F-W10P-NL-OFFICE-41260b40.vmss
renaming ./X9SRI-3F-W10P-NL-6a4b8f29.hlog to ./X9SRI-3F-W10P-NL-OFFICE-6a4b8f29.hlog
renaming ./X9SRI-3F-W10P-NL.nvram to ./X9SRI-3F-W10P-NL-OFFICE.nvram
renaming ./X9SRI-3F-W10P-NL.vmsd to ./X9SRI-3F-W10P-NL-OFFICE.vmsd
renaming ./X9SRI-3F-W10P-NL.vmx to ./X9SRI-3F-W10P-NL-OFFICE.vmx
renaming ./X9SRI-3F-W10P-NL.vmx.backup to ./X9SRI-3F-W10P-NL-OFFICE.vmx.backup
renaming ./X9SRI-3F-W10P-NL.vmxf to ./X9SRI-3F-W10P-NL-OFFICE.vmxf
renaming ./vmx-X9SRI-3F-W10P-NL-1093012288-1.vswp to ./vmx-X9SRI-3F-W10P-NL-OFFICE-1093012288-1.vswp
All Done. You now need to register X9SRI-3F-W10P-NL-OFFICE to the inventory.
There also was a renaming bug (see the italic line).
I managed to fix both that and added more documentation plus output.
Repositories and code
- Original:
- Fork with added VSAN functionality (see [Wayback/Archive] Revisions · Script to rename a virtual machine in ESXi 6):
- My fork of 2:
- My fix:
Code before modifying: [Wayback/Archive] gist.githubusercontent.com/jpluimers/fcc601dd41ac89f601a5174be92c841c/raw/e3683fbb6bdf1e73d65d2b784027c70cf42a5512/vm-rename
Code after modifying: [Wayback/Archive] raw.githubusercontent.com/jpluimers/vm-rename/master/vm-rename.sh.
Yes, that is not in a gist any more (see below why), it is now part of [Wayback/Archive] jpluimers/vm-rename: Script to rename a virtual machine in ESXi 6; fork from https://gist.github.com/jpluimers/fcc601dd41ac89f601a5174be92c841c as [Wayback/Archive] vm-rename/vm-rename.sh at master · jpluimers/vm-rename.
The reason was
Yesterday I described the workaround in Fork Gist to Repo on GitHub – Stack Overflow.
Queries
I found the original via [Wayback/Archive] script esxi rename vmx vmxf and related files – Google Search.
My start was [Wayback/Archive] script esxi duplicate vm and rename vmdk – Google Search which found:
- [Wayback/Archive] Renaming a virtual machine and its files in VMware ESXi (1029513) which has a PowerCLI script (that requires Windows to run PowerCLI on)
- [Wayback/Archive] Solved: How to clone a VM on a ESXI 6.5 server? – VMware Technology Network VMTN which pointed me to the next Google Search result :
- [Wayback/Archive] VMware esxi – Script to clone a VM without vSphere or vCenter. | GrangerX which I put in this gist:
- [Wayback/Archive] Script to create Linked Clones on ESXi | RedNectar’s Blog which is great, but way to complicate for my use case. It references a few other cool scripts though, and shows how to use Resource Pools in ESXi (which the Web-UI does not seem to support):
- [Wayback/Archive] [script] Cloning VMs using ESXi shell/admin console – Virtualizing Unraid – Unraid
- [Wayback/Archive] Script to clone a VM with free VMware ESXi – Rob Pomeroy (again: PowerCLI)
–jeroen
Posted in *nix, *nix-tools, ash/dash, ash/dash development, Development, ESXi6, ESXi6.5, ESXi6.7, Power User, PowerCLI, Scripting, Software Development, Virtualization, VMware, VMware ESXi | Leave a Comment »
Posted by jpluimers on 2023/12/28
This is a sort of follow-up on ESXi: listing virtual machines with their IP addresses where we ended with this:
I modified the above script to become this:
#!/bin/sh
vmids=`vim-cmd vmsvc/getallvms | sed -n -E -e "s/^([[:digit:]]+)s+((S.+S)?)s+([S+])s+(.+.vmx)s+(S+)s+(vmx-[[:digit:]]+)s*?((S.+)?)$/1/p"`
for vmid in ${vmids} ; do
# powerState values:
# Powered off
# Powered on
# Suspended
powerState=`vim-cmd vmsvc/power.getstate ${vmid} | sed '1d'`
name=`vim-cmd vmsvc/get.config ${vmid} | sed -n -E -e '/(vim.vm.ConfigInfo) {/,/files = (vim.vm.FileInfo) {/ s/^ +name = "(.*)",.*?/1/p'`
vmPathName=`vim-cmd vmsvc/get.config ${vmid} | sed -n -E -e '/files = (vim.vm.FileInfo) {/,/tools = (vim.vm.ToolsConfigInfo) {/ s/^ +vmPathName = "(.*)",.*?/1/p'`
# For now, I choose to use only the IPv4 main address from ipAddress, which is in between (vim.vm.GuestInfo) { and net = (vim.vm.GuestInfo.NicInfo) [.
ipAddress=`vim-cmd vmsvc/get.guest ${vmid} | sed -n -E -e '/(vim.vm.GuestInfo) {/,/net = (vim.vm.GuestInfo.NicInfo) [/ s/^ +ipAddress = "(.*)",.*?/1/p'`
printf "VM with id %3s has power state %-11s and IPv4=%-15s (name = ${name}; vmPathName = ${vmPathName}).n" "${vmid}" "${powerState}" "${ipAddress}"
done
Now the script grew even larger in to vim-cmd-list-all-VMs-with-IPv4-MAC-uuid.sh:
Read the rest of this entry »
Posted in *nix, *nix-tools, ash/dash, ash/dash development, Development, ESXi6, ESXi6.5, ESXi6.7, Power User, Scripting, Software Development, Virtualization, VMware, VMware ESXi | Leave a Comment »
Posted by jpluimers on 2023/12/26
Every once in a while Jan Schaumann writes a long Twitter thread and saves it in a blog post. Always good ways to learn. This time it was no different: [Wayback/Archive] DNS Response Size started with
Read the rest of this entry »
Posted in Communications Development, Development, DNS, Internet, Internet protocol suite, IPv4, IPv6, Power User, TCP, tcpdump, UDP, Wireshark | Leave a Comment »
Posted by jpluimers on 2023/12/24
Jan Wildeboer was mad for good reasons, though the open source projects didn’t yet seem to publicly have show their real madness, just bits like [Wayback/Archive] oss-security – Re: Re: New SMTP smuggling attack:
I'm a little confused by sec-consult's process here. They identify a
problem affecting various pieces of software including some very widely
deployed open source software, go to the trouble of doing a coordinated
disclosure, but only do that with...looking at their timeline... gmx,
microsoft and cisco?
“SMTP Smuggling” is bad, and big open source SMTP server projects like exim, postfix and sendmail needed to assess and fix/prevent the issue on very short notice: effectively confronting them with a zero-day less than a week between the information got released and the Holiday season.
That gives “deploy on Fridays” a totally different dimension.
How bad? Well, it already managed to reach this Newline – Wikipedia entry:
The standard Internet Message Format[26] for email states: “CR and LF MUST only occur together as CRLF; they MUST NOT appear independently in the body”. Differences between SMTP implementations in how they treat bare LF and/or bare CF characters have led to so-called SMTP smuggling attacks[27].
The crux of the problem is very well described by the “Postfix: SMTP Smuggling” link below: recommended reading, and the middle of [Wayback/Archive] SMTP Smuggling – Spoofing Emails Worldwide | Hacker News
…
TLDR: In the SMTP protocol, the end of the payload (email message) is indicated by a line consisting of a single dot. The line endings normally have to be CRLF, but some MTAs also accept just LF before and/or after the dot. This allows SMTP commands that follow an LF-delimited dot line to be “tunneled” through a first MTA (which requires CRLF and thus considers the commands to be part of the email message) to a second MTA (which accepts LF and thus processes the commands as real commands). For the second MTA, the commands appear to come from the first MTA, hence this allows sending any email that the first MTA is authorized to send. That is, emails from arbitrary senders under the domains associated with the first MTA can be spoofed.
…
Here are some links to keep you busy the next hours/days/weeks:
And the toots linking to background information:
Read the rest of this entry »
Posted in *nix, *nix-tools, Communications Development, Development, exim mail, Internet protocol suite, postfix, Power User, Python, Scripting, sendmail, SMTP, Software Development | Leave a Comment »
Posted by jpluimers on 2023/11/10
A while ago, Jilles found out why not to use VirtualBox: [Wayback/Archive] Jilles🏳️🌈 on Twitter: “@jpluimers Ik wil op basis van wat de Arch community schreeuwt; “Virtualbox is stom, als je geen hyper-v gebruikt vraag je om problemen”, HYPER-V maar gaan proberen.” / Twitter
The biggest problem is that VirtualBox seems to be developed ant tested for the happy path, not the failing path.
Which means that when you use it for less common scenarios, it will often fail in mysterious ways.
Back in Running ArchiveTeam Warrior version 3.2 on ESXi, I already mentioned this:
Totally agreeing with Kristian Kohntopp, I do not understand why people use VirtualBox at all: I just run in too much issues like [Archive.is] Kristian Köhntopp on Twitter: “Hint: Wenn die Installation einer Linux-Distro in Virtualbox mit wechselnden, unbekannten Fehlern scheitert, hilft es, stattdessen einmal VMware Workstation oder kvm zu probieren. In meinem Fall hat es dann *jedes* *einzelne* *Mal* mit *demselben* Iso geklappt.”.
Read the rest of this entry »
Posted in *nix, *nix-tools, ArchiveTeamWarrior, Hyper-V, InternetArchive, Linux, Power User, VirtualBox, Virtualization, VMware, WayBack machine, Windows, Windows 10, Windows 11 | 1 Comment »