HNHacker News
TopNewBestAskShowJobs

pixelbeat

1,141 karma · joined September 12, 2008

http://www.pixelbeat.org/ http://twitter.com/pixelbeat_
submissionscomments
pixelbeat··on Improving the integration between terminal and web
How the latest coreutils leveraged terminal hyperlinks to directly link to the full online documentation
pixelbeat··on GNU Coreutils 9.8 Released with New Features
Phoronix didn't link the full NEWS: https://savannah.gnu.org/news/?id=10816

Some extra notes...

Accurate (cgroup aware) nproc is important, as detailed in: https://danluu.com/cgroup-throttling/

The new base58 encoding performs well being around 500 times faster than arbitrary int implementation internal to cpython 3.13 for example

pixelbeat··on Default musl allocator considered harmful to performance
GNU coreutils can be built as a single binary with ./configure --enable-single-binary. One can install this variant on Fedora for example with the coreutils-single package, and this is used in some container images.
pixelbeat··on Reservoir Sampling
FWIW GNU coreutils' shuf uses reservoir sampling for larger inputs to give bounded memory operation
pixelbeat··on One quantum transition makes light at 21 cm
42/2
pixelbeat··on Bash-ini-parser: Advanced bash INI parser library
For similar functionality have a look at crudini, which is a utility designed for interacting with ini files from shell scripts:

https://github.com/pixelb/crudini

pixelbeat··on Why pipes sometimes get "stuck": buffering
Nice article. See also: https://www.pixelbeat.org/programming/stdio_buffering/

It's also worth mentioning a recent improvement we made (in coreutils 8.28) to the operation of the `tail | grep` example in the article. tail now notices if the pipe goes away, so one could wait for something to appear in a log, like:

    tail -f /log/file | grep -q match
    then_do_something
There are lots of gotchas to pipe handling really. See also: https://www.pixelbeat.org/programming/sigpipe_handling.html
pixelbeat··on A mental model for Linux file, hard and soft links
You might find my "symlinks, hardlinks and reflinks explained" article useful: https://www.pixelbeat.org/docs/unix_links.html
pixelbeat··on Entering text in the terminal is complicated
The vi vs emacs thing permeates a lot of tools. I find it useful to map all tools to be consistent with one or the other. Personally I use vi. Unfortunately setting vi mode for readline has a few caveats, but I was able to work around all of them with the settings in:

https://www.pixelbeat.org/settings/.inputrc

pixelbeat··on Why is /usr/bin/test 4kiB smaller than /usr/bin/[?
One might be wondering why 'test' and '[' are separate binaries at all. This is to give maximum flexibility wrt copying binaries etc. Note one can build coreutils like busybox as a single binary, by just `./configure --enable-single-binary` at build time. This is already available as an option on Fedora at least through the coreutils-single (1.2MB) package.
pixelbeat··on Swapping GNU coreutils for uutils coreutils on Gentoo Linux
Sounds like a case of: https://www.pixelbeat.org/programming/sigpipe_handling.html

uutils uses the coreutils test suite, so it makes sense to add a test case for that, which uutils will eventually get to. I'll do that now.

pixelbeat··on Backdoor in upstream xz/liblzma leading to SSH server compromise
yes(1) is the standard unix way of generating repeated data. It's good to do this as quickly as possible. I really don't understand why so many get annoyed with this code. 130 lines isn't that complicated in the scheme of things.
pixelbeat··on Ftfy – fix Unicode that's broken in various ways
Nice. This handles the mangled example I discussed at:

http://www.pixelbeat.org/docs/unicode_utils/

pixelbeat··on How to Print Integers Really Fast
GNU seq uses this trick:

slow path:

    seq -f '%.1f' inf | pv > /dev/null
     ...[  12MiB/s]
fast path:

    seq inf | pv > /dev/null
     ...[ 491MiB/s]
pixelbeat··on A Little Story About the `yes` Unix Command
The GNU variant was discussed recently at: https://news.ycombinator.com/item?id=14542938

The commit that sped up GNU yes has a summary of the perf measurements: https://github.com/coreutils/coreutils/commit/3521722

yes can be used to generate arbitrary repeated data for testing or whatever, so it is useful to be fast

pixelbeat··on Parallel processing with Unix tools
Very good point. I added a whole section to the article, implementing the counting lines example with `make -j`, which performs just as well as `xargs -P`
pixelbeat··on Diaspora-common: does 'rm -rf /' on purge
That really is a bash bug IMHO I've discussed this with upstream bash at http://lists.gnu.org/archive/html/bug-bash/2015-02/msg00052....

I've some general notes on SIGPIPE mishandling at http://www.pixelbeat.org/programming/sigpipe_handling.html

pixelbeat··on Dd is not a disk writing tool (2015)
Yes this is true. Note BSD supports this better with Ctrl-T to generate SIGINFO, which one can send to any command even if not supported, in which case it's ignored. Using kill on linux, and having that kill processes by default is decidedly more awkward.

It's also worth noting the separate "progress" project which can be used to give the progress of running file based utilities.

We generally have pushed back on adding progress to each of the coreutils for these reasons, but the low overhead of implementation and high overlap with existing options was deemed enough to warrant adding this to dd

pixelbeat··on Dd is not a disk writing tool (2015)
Yes "D" is not for disk/drive/device/...

It comes from the DD (data definition) statement of OS/360 JCL, and hence why dd has the unusual option syntax compared to other unix utils

BTW if you are using dd to write usb drives etc. it's useful to bypass the Linux VM as much as possible to avoid systems stalls, especially with slow devices. You can do that with O_DIRECT. Also dd recently got a progress option, so...

    dd bs=2M if=disk.img of=/dev/sda... status=progress iflag=direct oflag=direct
Note dd is a lower level tool, which is why there are some gotchas when using for higher level operations. I've noted a few at:

http://www.pixelbeat.org/docs/coreutils-gotchas.html#dd

pixelbeat··on ThinkPad X1 Carbon
This machine isn't available yet :) But since Lenovo is the Red Hat corp laptop vendor, support is generally excellent. I've used Fedora 23+ on the Third gen X1 carbon with zero issues.
pixelbeat··on Ripgrep – A new command line search tool
Yes ignoring .gitignore contents is a very useful feature. That could be added quite easily to findrepo though would probably have to be an opt as it is often useful to search intermediate build files etc. that aren't checked in. Whereas `git grep` handles the other use case of only searching checked in files.

Interesting info wrt efficient unicode processing for \w and -i.

cheers

pixelbeat··on Ripgrep – A new command line search tool
Thanks for the detailed comparisons and writeup.

I find this simple wrapper around grep(1) very fast and useful:

http://www.pixelbeat.org/scripts/findrepo

pixelbeat··on Common shell script mistakes
Note the #status anchor is best removed from the url
pixelbeat··on What typing ^D does on Unix (2009)
Yes some of these useful functions should be bound by default IMHO. Here are my settings to bind ctrl-{left,right} and {up,down} to more useful defaults. I.E. jump as the shell tokenizes the line, and search history for what's already typed respectively
pixelbeat··on Mosh: the mobile shell
mosh is fantastic for me when working remotely over vpn. I don't have to worry about reconnections, disconnections, packet lag (due to local echo feature). mosh in combination with screen (or tmux) gives scrollback support + other features
pixelbeat··on Colorized man pages
I use vim to get colorized pages and drill down to other referenced man pages. Search for MANPAGER in:

http://www.pixelbeat.org/settings/.bashrc

pixelbeat··on Germany offers up to €30k for 6 months of working on OSS
FSF collects money for infrastructure etc.

Generally the GNU project maintainers are not paid by the FSF. Mostly they're paid through the likes of Red Hat etc., with varying overlap between day job and maintainership

pixelbeat··on Don't use -Werror
Yes exactly. For example GNU coreutils auto enables -Werror for devs when running from a git repo, whereas tarball releases do not add that option. See:

http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=blob;f=confi...

pixelbeat··on APFS in Detail
Note mv tries reflink by default (when moving files across BTRFS subvols) since doesn't need a separate copy of the data. Now as storage systems evolve there are less guarantees that one does get multiple copies, with deduplicating at lower layers etc., and therefore cp may change at some stage to reflinking by default, especially as clone_file_range() moves to the VFS level. Actual data redundancy would then achieved at a higher level with separate file systems, devices, data centers, ... where arguably it needs to happen now anyway.
pixelbeat··on Why it's hard to write a dupefinder
The approach that http://www.pixelbeat.org/fslint takes is to md5 and sha1 the files to avoid false positives.

The core of the duplicate detection is the shell script here:

https://github.com/pixelb/fslint/blob/ffcd3b85/fslint/findup...

Page 1 of 4Next →