Browsed by
Tag: linux

Bash Environment Variable Functions

Bash Environment Variable Functions

A set of useful (Linux) Bash environment variable functions, taken / adapted, and added some information (not a plain copy) from blog post: https://hackaday.com/2022/01/26/linux-fu-bash-strings/ The examples below start with a $ if it is the command line, and without if it is the output (or input) of the command. Shell script command line arguments Numeric Substrings Remove leading or trailing parts Search / Replace Default values Changing case Bash built-in if tests Related external programs

Vikeying

Vikeying

Description Enable special functions on the CAPS-LOCK key, to support VI users 😉 This script was created by me as a sort of “study” object, not for any serious use. A colleague of mine has created a Linux kernel module to modify his keyboard behaviour to what is described in this document. I was just wondering if it would be possible to create the complex logic he needed, without having to make a kernel module. As maintaining a kernel module…

Read More Read More

Linux Emergency Reset / Shutdown

Linux Emergency Reset / Shutdown

I was always convinced that a Linux server would not easily break down or get stuck. However, after running an on-premise Kubernetes cluster for a couple of years, on non-optimal kernels or with non-optimal OS-packages on it, I have seen some quite severe issues. In some cases, a machine started logging lot’s of kernel panics, and then became slow and only partially functioning. In that state, typing sudo reboot often did not work. It would just time out on it,…

Read More Read More

Linux Sync Buffer Progress Monitoring (e.g. For Copy To USB)

Linux Sync Buffer Progress Monitoring (e.g. For Copy To USB)

On my Linux system (Linux Mint), if I copy a huge file to an USB stick, then I always type “sync” in a shell command line to make sure all buffers are flushed to the USB stick before I eject the USB stick. This writing of the buffers can take quite a while (perhaps due to the huge amount of cache memory in the laptop). To monitor progress, you can type the following in a shell: It will show something…

Read More Read More

Curl Command To Measure DNS And Network Timing

Curl Command To Measure DNS And Network Timing

The curl command line tool has a reporting option which you can use to measure different bits of timing in the network handling. This can be useful to monitor or investigate network issues: Example output: You can also insert \n’s in the option to put the result on multiple lines: