Most active questions
423 questions from the last 30 days
12
votes
7
answers
3k
views
Idiomatic way of generating a unique filename?
In a script I'm writing, I want to create something temporary on my filesystem, but - it's not in /tmp but elsewhere, and may not be a file nor a directory (e.g. maybe it's a named pipe or a symbolic ...
15
votes
3
answers
3k
views
Why Linux read() avoids using full 2 GiB in one call
Reading the manual page (man 2 read) on my Debian system, I see the following note:
NOTES
[...]
On Linux, read() (and similar system calls) will transfer at most
0x7ffff000 (2,147,479,552) bytes, ...
8
votes
4
answers
2k
views
Why do my UTF-8 filenames always match against a regex bracket expression in Perl?
Here is a script to fix broken Cyrillic filenames if the files were moved to Mac from Windows (based on an answer to Revert filenames after they were garbled by using different encoding)
#!/bin/zsh
# ...
14
votes
1
answer
3k
views
Why does cd '' succeed in bash?
Maybe I'm missing it, but I don't find it documented that cd '' should succeed. Since there is no directory with the name '', it seems obvious that it should fail. For example,
mydir=
cd -- "$...
5
votes
6
answers
1k
views
Why can't I merge folders by renaming one of them?
Try to run this
mv -- "foldername...__" "foldername..."
This will move folder foldername...__ under the folder foldername... instead of renaming it. Why?
Note that foldername... ...
6
votes
4
answers
732
views
Using curly braces to process colon-separated variables
If we do:
VAR=100:200:300:400
We can do:
echo ${VAR%%:*}
100
and
echo ${VAR##*:}
400
Are there any equivalents I could use to get the values of 200 and 300?
For instance, a way to get only what's ...
6
votes
3
answers
740
views
How to read a line from a file and output the line to a file
A file like this: ExampleFile.txt
line1TextHere
line2TextHere
line3TextHere
I would like to read a line one by one from the file and output it to different files, so there will be one file for each ...
6
votes
2
answers
2k
views
Unreal Engine games supporting Linux
Unreal Engine and other engines support making games for multiple platforms like iOS, Android, Windows, MacOS and Linux. The games are distributed as pre-compiled executables and they all need ...
4
votes
4
answers
775
views
Is mkswap hw dependent?
I'm setting up Home Assistant, on a Raspberry Pi, to use Network Boot with a Ubuntu x86 server.
The initial bootup seems to be working. The systemd process is now creating a swapfile on the NFS mount. ...
3
votes
3
answers
852
views
How to determine, with certainty, the filesystem type of a partition from the outputs of the Linux "file -s" command?
My problem is to decode the output of the command file -s /dev/sdX on my system (where /dev/sdX is the device file associated to a USB key).
Below I'll show the output of the command file -s /dev/sdX ...
9
votes
3
answers
805
views
How to delete buffered text written to terminal during script execution
Let's say hypothetically I'm executing a long-running bash script, and while it's running, I accidentally right click on the terminal and paste a sensitive password (freshly copied out of a password ...
9
votes
2
answers
1k
views
What is this icon (dots over a gray curving line) that momentarily appears in my GNOME status bar?
The leftmost icon () is the one in question.
For context, I have a pair of multipoint Bluetooth earbuds simultaneously connected to both my iPhone and Linux laptop. When I'm listening to music on my ...
8
votes
2
answers
585
views
fork() Causes DMA Buffer in Physical Memory to Retain Stale Data on Subsequent Writes
I'm working on a C++ application on Ubuntu 20.04 that uses PCIe DMA to transfer data from a user-space buffer to hardware. The buffer is mapped to a fixed 1K physical memory region via a custom ...
11
votes
1
answer
611
views
How to get zip to treat any missing file as an error?
To reproduce:
❯ cd "$(mktemp --directory)"
❯ zip result.zip foo no-such-file
zip warning: name not matched: no-such-file
adding: foo (stored 0%)
❯ echo $?
0
zip should return a non-...
12
votes
1
answer
994
views
Why doesn’t `sudo -E` preserve `PERL5LIB`?
I’m experiencing a strange behavior related to environment variable preservation with sudo on macOS(15.2): sudo -E doesn't preserve the environment variable PERL5LIB.
Reproduction Steps
Set an ...