Search
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...
On my current setup (running Linux Mint 20.3 Cinnamon), I have an administrative user and several ordinary users. I intend for all of these users to be in the same group, which happens to have the ...
You want shuf. shuf -n1 -i 534-876874
Especially in a pedagogical context, the issue with something like cat /dev/random | head -c 20 versus the more straightforward head -c 20 /dev/random is that it communicates that extra ceremony is...
From the average user's perspective: Back in the day when people were figuring out how to do shells, there were as many shell syntaxes as shells. Everyone made up their own little language to go w...
I've been learning some Linux and I finally feel like I can find my way around the command line. But now I hear people say there are other, "non-POSIX" kinds of shell, with different semantics. Wha...
Suppose I want to get random numbers from /dev/random with basic CLI tools. Is there a way to do it, that's easier to type and read than python -c 'import random; print(100 + 200*random.random())'?...
UUOC is an ancient Unix yarn. I can't find the original essay (I believe from Usenet, where else...) but if memory serves it's either from early 90s or before. cat is actually a program for concat...
Sometimes I share Unix commands online, and people chastise me for "useless use of cat" (UUOC) or "cat abuse". My cat is quite comfy and doing very well, thank you. What are they talking about?
/dev/random is a stream of every possible value. You're supposed to filter it to take the ones you want. This is efficient, although if the values you want are such that only, say, 1% of what comes...
Of course every language has some kind of random library... But can you generate custom random strings with just basic CLI tools? For example, we have /dev/random which provides a stream of random...
Most Linuxes are small, and I would consider them for experts by default. This is because you won't be able to just Google problems and copy the solution from some blog. You'll have to actually tro...
Wayland, ideally If you are on Wayland, the blessed way is to use the configuration for your desktop environment (DE) to map mouse keys and other input devices, except for a couple well-known opti...
No wonder it's hard to find good programs - it's no longer necessary! At some point this became a built in part of Xorg via xinput. The process is something like this: xinput list and find the ...
xmllint from xmllib2 can do this: $ output-dirty-xml | xmllint --format - The dash in the end tells xmllint to read from stdin instead of a file. Source: manpage
How to pretty print XML in a shell? I have command-line tool which outputs XML in a single line, totally unreadable. I would like something to pipe this into, to turn it into human readable XML wi...
If all else fails, you could create a wrapper shell function to check the output of unrar l (probably by piping to wc -l) and proceed accordingly.
I use unrar to extract rar archives sometimes: UNRAR 6.24 freeware Copyright (c) 1993-2023 Alexander Roshal Sometimes the archive root has several files, so if I do unrar x foo.rar it will...
I upgraded to WSL 2 because I discovered several instances online where people had run into issues with WSL and Solr together. This fixed the problem of Solr not starting. However, it triggered a n...
Add a new drive with the device command: # btrfs device add /dev/new-device /path/to/the/filesystem/youre/adding/to Then you probably want to balance the filesystem so that some data will actua...
BTRFS is capable of spanning over multiple drives. How to add one more to an existing filesystem?
I am trying to run Solr 9.5.0 on Windows Subsystem For Linux 2. It crashes with a Segmentation Fault and does not start. I can run it on Windows without an issue. Java version on WSL2: 17 Java ve...
I want to connect to my university network via OpenVPN under Fedora GNOME. I imported the openvpn configuration provided by the university in the Network Manager GUI and specified the user certifi...
They are defined in the Desktop Entry Specification. In fact there are also %f and %F options. They tell the desktop manager how the program handles multiple files. Like if I select a bunch of fil...
Desktop files always have either %u or %U as an argument for the program being launched. E.g. here's a line from my firefox.desktop: Exec=/usr/lib/firefox/firefox %u What does it mean?