Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Activity for r~~‭

Type On... Excerpt Status Date
Answer A: How do you generate arbitrary random numbers from /dev/random?
You want `shuf`. ```sh shuf -n1 -i 534-876874 ```
(more)
about 2 months ago
Answer A: What is cat abuse/useless use of cat?
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 necessary. It isn't. Using one program instead of two isn't about saving kilobytes of computer memo...
(more)
about 2 months ago
Answer A: How to use the gitignore file without git(1).
You can fake out `git` as long as you have some empty Git repository available somewhere. ``` git --git-dir=path-to-empty-repo/.git \ ls-files --others --exclude-standard ```
(more)
3 months ago
Answer A: How to change resolution of virtual terminal?
This isn't exactly what you asked, but the letters-too-small problem could also be solved by using a larger console font. Here is a decent overview of how to change console fonts, though I don't know which of the `console-setup` and the `vconsole.conf` approaches is correct for your distribution.
(more)
6 months ago
Answer A: Rename multiple files which have a variable suffix
An easy one-liner in POSIX-compatible shells: ``` for f in -min.jpg-; do mv -- "$f" "${f%-}"; done ``` The only (mildly) tricky concept here is `${f%-}`, which expands to `$f` minus the shortest suffix matching the glob pattern `-`.
(more)
7 months ago
Answer A: How to overwrite each line of STDOUT with the next one?
In Bash, you could use the `$COLUMNS` environment variable to detect the width of your terminal and truncate each line to that length in your sed script. Something like this should work: ``` sed "s/^\(.\{,$COLUMNS\}\).$/\1/;2,\$s/^/\x1B[1A\x1B[K/" ``` For a sh-compatible alternative, replace ...
(more)
7 months ago
Answer A: How to list the first x files in each directory
Is this what you want? Edit: Credit to Kamil Maciorowski‭ for catching an unsafe interpolation in the previous draft; it will work for non-adversarial inputs but this newer version is safer and a better example to learn from. ```sh find l1 -mindepth 2 -maxdepth 2 \ -type d \! -empty \ -...
(more)
7 months ago
Answer A: How does the root user locate executables?
> but it clearly does see that change. Nope. Your environment is being reloaded in the `sudo` process. `sudo echo $PATH` gives the same result as `echo $PATH` because `$PATH` is expanded by your shell first thing, before `sudo` gets spawned. If you want to see the value of `PATH` from inside `s...
(more)
8 months ago
Answer A: Why does $XDG_DATA_HOME default to ~/.local/share?
I wasn't there two decades ago when the spec was first being developed, but based on other parts of the spec they're clearly attempting to establish a parallel with `/usr/local`. The intended minimal `PATH=/.local/bin:/usr/local/bin:/usr/bin:/bin`; `XDGDATAHOME` and `XDGDATADIRS` form a similar order...
(more)
8 months ago
Answer A: Are NixOS and Guix analogous projects?
They are broadly analogous; there's a lot of cross-pollination of ideas between the projects. Some terminology first, because you'll notice that both columns have duplicate entries and this often confuses the conversation. | Component | in Nix | in Guix | | - | - | - | | package expression la...
(more)
8 months ago
Answer A: Documentation for double asterisk glob expansion
The pattern is an extension to, not a part of, the POSIX glob syntax. While it has emerged as an informal standard, AFAIK there is no single standard to reference to describe what it does. This means you'll need to consult the documentation for each application that uses it. For .gitignore fi...
(more)
8 months ago
Answer A: Run a command *later*
Using systemd timers is too much work? Not with `systemd-run`! ``` systemd-run --user --on-active=10min somecmd ```
(more)
9 months ago
Answer A: Ergonomic way to search man pages
Unix systems are made out of many small tools that focus on specific tasks but are general enough that the investment made in learning their specific switches and hotkeys pays off over many applications. In that spirit, I would encourage you to get to know `less` better. It's not a tool specifical...
(more)
9 months ago
Answer A: Treat underscores as word boundaries in terminal using vim mode
You can't, without patching `readline`. What counts as a word character is hard-coded in the `readline` library, as of this writing. See: https://git.savannah.gnu.org/cgit/readline.git/tree/vimode.c#n620 https://git.savannah.gnu.org/cgit/readline.git/tree/chardefs.h#n115
(more)
9 months ago
Answer A: Highlight regions in an image with CLI
This is an ideal case for ImageMagick. Given input.png: A random image Running this command: ``` convert input.png -draw 'fill yellow fill-opacity 0.5 polygon 50,50 100,30 150,50 100,150' output.png ``` Produces output.png: The same image with a semitransparent yellow kite drawn o...
(more)
9 months ago
Answer A: How to securely erase data from a thumb (solid state) drive
Answering your question as written, this is a hardware-specific question. Since solid-state storage chips typically keep the details of which cells are being used to write data hidden from the OS, never mind the user, in order to be sure you've erased any unit of data beyond recovery, your hardware v...
(more)
9 months ago
Answer A: Increase incorrect login attempts before locking account
Authentication events such as logging in are ultimately handled by PAM, the Linux Pluggable Authentication Modules project. PAM is very flexible and different Linux distributions will ship with different PAM configurations. The Arch documentation describes how PAM is set up for Arch. In 2020, Arch...
(more)
9 months ago
Answer A: Why does a reverse hexdump truncate the message?
From `man xxd`, the section on the `-r` flag (emphasis added): > -r | -revert > > reverse operation: convert (or patch) hexdump into binary. If not writing to stdout, xxd writes into its output file without truncating it. Use the combination -r -p to read plain hexadecimal dumps without line ...
(more)
10 months ago
Answer A: What are the correct permissions for `~/.ssh/config`?
From `man sshconfig`: > This file is used by the SSH client. Because of the potential for abuse, this file must have strict permissions: read/write for the user, and not writable by others.
(more)
10 months ago
Answer A: How do I view fonts?
In GNOME, `gnome-font-viewer` does this.
(more)
11 months ago
Answer A: How do you troubleshoot bwrap/wine sandboxes for Windows games?
I've done this exact thing with these same tools, as recently as this morning. I use strace to measure file access sometimes; trouble is, a lot of programs/libraries will attempt to look for a lot of files that don't need to exist, so combing through the strace logs can be a long slog too. In theo...
(more)
11 months ago
Answer A: how to manipulate Gnome's "Top Bar"/"Activities Bar"/"Top Panel" using GDK
That bar is part of GNOME Shell, and user applications don't get to mess around with the shell. You need to look into writing shell extensions to modify that in a general way. One common thing for an application to want is to show a status icon, in which case you could use an extension like this o...
(more)
over 1 year ago
Answer A: Desktop Multiplexer for Linux? (GNU Screen for GUI apps)
Have a look at Xpra. I only use it locally but it's intended to forward from remote hosts as well.
(more)
about 2 years ago
Answer A: Should we merge with Power Users?
I vote against the merger. It's true that any LS question is likely to be on topic for PU, at least as I understand the scope of the latter, not being a participant in that community. However, I have no interest in any questions about Windows, Microsoft Office, Random Smartphone Model XYZ, or most...
(more)
over 2 years ago
Answer A: In a bash shell script, how to filter the command line argument list to unique entries only, for processing each?
Here's an alternative that is a one-liner drop-in for your existing script: ```bash eval set -- $(printf "%q\n" "$@" | sort -u) ``` It works by escaping the initial arguments, piping the escaped arguments through `sort -u` which discards any duplicates, and then unescaping them with `eval` (w...
(more)
over 2 years ago