Activity for Karl Knechtel
| Type | On... | Excerpt | Status | Date |
|---|---|---|---|---|
| Edit | Post #296246 | Initial revision | — | 3 months ago |
| Answer | — |
A: Safe handling and display of untrusted data in the terminal `cat -v` > It's not a problem if `cat` produces a mess of strange symbols, but it could be a problem (or even a security risk) if the output contains, in particular, ANSI control codes. `cat` generally already offers a flag to deal with this: ``` -v, --show-nonprinting ... (more) |
— | 3 months ago |
| Comment | Post #296153 |
Ah! So when there *isn't* a pipeline, the shell is implicitly piping that `/dev/tty` device to stdin instead. (Of course it isn't Linux itself doing that, since the system calls are lower-level, on the order of creating "pipe" objects and explicitly hooking them up.) And then `less` can check whe... (more) |
— | 4 months ago |
| Edit | Post #296150 |
Post edited: |
— | 4 months ago |
| Edit | Post #296150 | Initial revision | — | 4 months ago |
| Question | — |
How do programs like `less` receive keyboard input as well as from a pipe? (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 | less ``` (There are other TUI programs I use where this doesn't work; whatever is rec... (more) |
— | 4 months ago |
| Edit | Post #295894 | Initial revision | — | 5 months ago |
| Question | — |
How is the filesystem bootstrapped, given that we start on a different partition? 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 `/` filesystem, across multiple partitions. Of course, booting can use a temporary in-memory filesy... (more) |
— | 5 months ago |
| Edit | Post #295689 | Initial revision | — | 6 months ago |
| Answer | — |
A: Safe handling and display of untrusted data in the terminal `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 printable character) or a `.` character (proxy for non-ASCII bytes). This means it can't understand Un... (more) |
— | 6 months ago |
| Edit | Post #295688 | Initial revision | — | 6 months ago |
| Question | — |
Safe handling and display of untrusted data in the terminal 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 problem (or even a security risk) if the output contains, in particular, ANSI control codes. Maybe ... (more) |
— | 6 months ago |
| Edit | Post #295625 | Initial revision | — | 6 months ago |
| Question | — |
Is there anything like an interactive version of aplay or speaker-test? 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 volume). Is there anything standard for that, or would I have to program it myself? I'm not interested ... (more) |
— | 6 months ago |
| Comment | Post #295505 |
Ah, I think that satisfies my use case quite well, in fact. But the general question still seems worth investigation. Maybe it can be edited into something more compelling? (more) |
— | 7 months ago |
| Comment | Post #295505 |
The idea is, if I use `share-command foo`, I have already decided that I will install `foo` into `/usr/local/bin`, but I don't know where `foo` is located. I want to search the user's $PATH for it (because it's an executable so it ought to be on there somewhere), instead of requiring the user to ... (more) |
— | 7 months ago |
| Comment | Post #295505 |
The problem is finding where to install *from* without troubling the user any more than necessary; the destination is assumed (sibling to the installation script, by default). I'm not interested in aliases; I'm looking specifically for a file with the given name, that happens to be an executable ... (more) |
— | 7 months ago |
| Edit | Post #295505 | Initial revision | — | 7 months ago |
| Question | — |
As root, how do I read another user's environment variables? 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 [[ $EUID -gt 0 ]]; then echo "This script must run as root" exit 1 fi if [[ -z "$... (more) |
— | 7 months ago |
| Edit | Post #295452 | Initial revision | — | 7 months ago |
| Question | — |
Replacing the shebang in a script 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 with the new one. Is there a standard or well-known way? I thought of `echo`ing the new sheba... (more) |
— | 7 months ago |
| Comment | Post #295418 |
But what about those extensions, then, in the VSCode example?
That is, if I uninstall the program, is cleanup of the extensions just manual? In general are you expected to learn about this from the program documentation, or just what? (more) |
— | 7 months ago |
| Comment | Post #293018 |
A question like this on its face seems more appropriate to Power Users, as it seems like most of any answer will boil down to choosing software to perform the task. Asking it here suggests that you are specifically interested in Linux-compatible software, but I think the question is better asked ... (more) |
— | 8 months ago |
| Edit | Post #295157 | Initial revision | — | 9 months ago |
| Question | — |
How do package managers track the installed files? 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-prog self update` periodically). Later I want to uninstall the package. How does the system kno... (more) |
— | 9 months ago |
| Comment | Post #288556 |
From Python documentation:
> **Warning**: `make install` can overwrite or masquerade the `python3` binary. `make altinstall` is therefore recommended instead of `make install` since it only installs `{exec_prefix}/bin/python{version}`. (more) |
— | 9 months ago |
| Edit | Post #293006 |
Post edited: fix formatting, rm noise, improve clarity (e.g. remove references to an irrelevant/unclear "we"), ask a question explicitly |
— | 10 months ago |
| Edit | Post #294903 | Initial revision | — | 11 months ago |
| Answer | — |
A: What is system Python and why does it matter? Overview Modern Linux distributions generally come with Python pre-installed; but fundamentally this copy of Python is not provided for experimentation or general software development, but rather to support other applications and tools in the distro. As a developer, it won't meet your needs... (more) |
— | 11 months ago |
| Edit | Post #294388 |
Post edited: Fix typo |
— | about 1 year ago |
| Edit | Post #294388 | Initial revision | — | about 1 year ago |
| Answer | — |
A: Why is "'python' not found" on Debian/Ubuntu/Mint/etc. ? 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. From late 2008 (with the release of Python 3.0) until 2020 (with the sunset of the Python 2.... (more) |
— | about 1 year ago |
| Edit | Post #294386 | Initial revision | — | about 1 year ago |
| Question | — |
Why is "'python' not found" on Debian/Ubuntu/Mint/etc. ? 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 the `python` command described in tutorials may not work out of box: ``` $ python /path/to/tut... (more) |
— | about 1 year ago |
| Edit | Post #294238 | Initial revision | — | about 1 year ago |
| Question | — |
Displaying tricky UTF-8 filenames with sane escape sequences 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 invisible and non-spacing (as its name would suggest) in a terminal window. It's rather diffi... (more) |
— | about 1 year ago |
| Edit | Post #294196 | Initial revision | — | about 1 year ago |
| Question | — |
How can I get "help" with vanilla sh builtins? 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`: ``` $ sh -c 'type read' read is a shell builtin ``` But I can't read `h... (more) |
— | about 1 year ago |
| Edit | Post #294194 | Initial revision | — | about 1 year ago |
| Answer | — |
A: How does Linux recognize and process .desktop files? 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 ./fancy.desktop: line 2: Example: command not found ./fancy.desktop: line 3: --enable-fancy: ... (more) |
— | about 1 year ago |
| Edit | Post #294188 | Initial revision | — | about 1 year ago |
| Question | — |
How does Linux recognize and process .desktop files? 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 ``` (with more possible lines after that). This is clearly not valid as a shell script... (more) |
— | about 1 year ago |
| Comment | Post #294057 |
It seems that you're right, but I'm frustrated that I can't find any authoritative reference for the character encoding that Bash will use in interpreting `\u` escape sequences, or whether it can be changed. `man bash` simply describes the entire escape sequence system as coming from ANSI C; C99 ... (more) |
— | over 1 year ago |
| Edit | Post #294050 | Initial revision | — | over 1 year ago |
| Question | — |
Temporarily making \u escapes use a different encoding on the command line For debugging purposes, I made a little utility that can show the exact bytes (as a hex dump) of each command line argument fed to it: ``` $ cat cmdline #!/bin/bash mapfile -d '' array < /proc/$$/cmdline for arg in "${array[@]:2}"; do printf '%s' "$arg" | xxd -; echo; done ``` Now I ca... (more) |
— | over 1 year ago |
| Edit | Post #293881 |
Post edited: The question has nothing to do with Pipewire (presumably auto-completed from "pipe"), and "plumb" makes no sense as a tag. |
— | over 1 year ago |
| Suggested Edit | Post #293881 |
Suggested edit: The question has nothing to do with Pipewire (presumably auto-completed from "pipe"), and "plumb" makes no sense as a tag. (more) |
helpful | over 1 year ago |
| Edit | Post #292293 |
Post edited: Add another technique |
— | over 1 year ago |
| Edit | Post #293000 |
Post edited: improve clarity and conciseness |
— | over 1 year ago |
| Edit | Post #293296 | Initial revision | — | over 1 year ago |
