Posts by Karl Knechtel
which only tells you about a path that would be found in PATH. Often, people who think they have this question have a more general question - i.e., what will be used when the named command is reque...
Suppose for example I install a .deb package that has no dependencies, and the corresponding program includes some self-update feature (or the documentation asks users to do something like sudo foo...
Suppose, in a UTF-8 locale, I do something like: touch $'\u200d.txt' The resulting file's name starts with a zero-width joiner character, which is apparently considered "printable" but is invis...
By memory If you installed Linux yourself, then you were almost certainly informed about this at some point in the process. Generally, you're either expected to choose a separate installer accordi...
Suppose I have a binary file with some "readable" content in it that I want to display and inspect in the terminal. It's not a problem if cat produces a mess of strange symbols, but it could be a p...
In a Bash script and/or at the command line, given that $file is the path to an executable text file with a shebang, and $env is a valid shebang, I want to replace the existing shebang in the file ...
My understanding is that one of the key advantages of Linux is modularity: the actual Linux kernel is quite small, and then what we call Linux is that plus the "rest of the system" - hence "operati...
Overview A "useless use" or "abuse" of cat occurs when a Unix pipeline (sequence of commands that feed into each other, using the shell | or "pipe" operator) includes a call to cat that is unneces...
I'm using the Gnome System Monitor in Linux Mint. Whenever I attempt to "End" or "Kill" a process, I am given this warning via a modal dialog (emphasis mine): Killing a process may destroy data,...
(Inspired by: https://discuss.python.org/t/_/107345) It was brought to my attention that it actually works to do something like: $ spam=$(printf '%1000s') $ spam=${spam// /abcdefg} $ echo $spam...
xxd xxd produces a hex dump of the input fed to it. For each byte of input, this includes two hex digits and a symbol which is either an ASCII representation (if the byte corresponds to a printabl...
I have a script that should be run using sudo, with the goal of "promoting" a script from a user-level installation to a system installation. Reproduced here: Existing code #!/bin/bash if [[ $...
This question is motivated by several threads and posts on the Linux Mint forums in which people encounter this sort of problem. On Debian-derived distributions of Linux, it's possible that th...
A Desktop entry (.desktop file) is an executable plain text file, which lacks a shebang. Its contents typically look like: [Desktop Entry] Name=Fancy Example Exec=/usr/bin/example --enable-fancy...
I know I can write a function at a Bash command line like so: $ test() { echo 'test' ; } I also found that I can write the } on a separate line, and omit ;: $ test () { echo 'test' > } ...
Typically, one has /boot or /boot/efi on a separate partition, using some simple filesystem like FAT32 that the bootloader can handle. At startup, Linux needs to be able to set up the entire / file...
I'd like to be able to send simple commands on the standard input of a running program that plays simple audio (even a sine wave), and have it alter its output in response (e.g. change pitch or vol...
What goes wrong Depending on your system's history of installations and upgrades, it may not have a python command set up even though Python is installed. This is basically for historical reasons....
I discovered that the -s flag for read is a Bash-ism: $ bash -c 'read -s -n 1' # waits until I press a key $ sh -c 'read -s -n 1' sh: 1: read: Illegal option -s Vanilla sh does offer read: ...
Upon further investigation, .desktop files don't actually work by executing them. Attemping to run them in a terminal will fail as expected: ./fancy.desktop: line 1: [Desktop: command not found ....
Suppose I am the author of a shell utility called bar. One common use case is in pipelines like foo | bar, where foo sometimes runs interactively. I want to distinguish situations where interaction...
I've noticed that the default kernel selection for Ubuntu 22.04, for example, is Linux 5.15.0. Ubuntu 22.04 is a LTS release, which is supposed to have standard support until April 2027, and Linux ...
I understand that "mounting" in Linux refers to associating some "device" (usually some storage drive or a partition thereof, but it could be a region of RAM, some memory-mapped hardware, etc.) wit...
Motivating example: my Mint 20.3 distribution offers long-term support until April 2025, which matches the "standard support" offered for the upstream Ubuntu (20.04 "Jammy Jellyfish"). However, the...
I've been persistently advocating for an analogous effort in the Software community, and generally think that any Codidact community could likely benefit from doing something similar. As a practica...
