Hacker News new | ask | show | jobs
by awsanswers 848 days ago
Why write this up but not explain it? This command is a combination of several commands used in Unix-like operating systems, connected together using pipes. Let's break it down:

fd '.fi.md$':

fd is a program similar to the traditional find command but with a more user-friendly syntax and faster performance. '.fi.md$' is a regular expression. It matches files whose names end with .fi.md. The dollar sign $ in regular expressions signifies the end of a line or string, so this ensures that the command only finds files that exactly end with .fi.md. |:

This is a pipe. It takes the output of the command on its left (the list of files found by fd) and uses it as the input for the command on its right. xargs -I _ -- batcat --paging=always _:

xargs is a command used to build and execute command lines from standard input. -I _ tells xargs to replace occurrences of _ in the initial arguments with names read from standard input (the list of files provided by fd). -- is used to signify the end of command options, after which only positional arguments are accepted. batcat --paging=always _: Here, batcat is likely an alias or a symlink to bat, a command that provides syntax highlighting and Git integration for a variety of file types, and it's an improved version of the cat command. --paging=always ensures that bat always uses a pager (like less) to display the file content, regardless of the size of the file. _ is replaced by each file name from the output of fd. Putting it all together:

The command finds all files ending in .fi.md in the current directory and subdirectories. For each of these files, it then calls batcat (or bat) with the --paging=always option, effectively displaying their contents with syntax highlighting and paging, allowing you to scroll through the content if it's longer than the screen size.

2 comments

Probably because there is barely anything to explain. It's a babby's first oneliner.

Everything after the first sentence in this comment seems to be LLM generated.

Sure, but not every reader is intimately familiar with Linux command line tools. I'm pretty certain that it is human written as ChatGPT gave much more detailed clarification (actually I got the idea to try it after reading this comment, I don't use ChatGPT very extensibly). I am fairly familiar with the Linux tooling but I can understand that oneliners like these can be quite intimidating.
The detail you get is dependent on your prompt and the model you use. The LLM used might not be chatgpt. The level of detail isn't the only thing you should consider. The writing style itself is unmistakably that of an LLM. Also explaining such basic concepts such as pipes is very suspect. Any human browsing this site would assume that everyone is already familiar with them. The nature of the post is such that it mostly appeals to shell enthusiasts anyways. The style shift between the first sentence and the rest of the comment is also quite obvious. The user's other comments do seem genuinely human however.

>oneliners like these

It is literally one pipe. You can't really get simpler than this.

> You can't really get simpler than this.

ls

But thanks for taking the time to explain.

That's not a pipeline.
I find that extensive flagging of this comment represents the degradation of users on HN. Yes, this comment may sound a little dismissive when you take the most derogatory interpretation, so what? It provides very useful context and was joy to read.
It is botspam and deserves to be flagged. Go ask chatgpt for explanation yourself instead of polluting forums with generated responses.
Interesting, so now instead of telling everyone to use Google, we tell everyone to use ChatGPT and we dismiss possible human written comments as those could have been written by ChatGPT? This user usual comments don't look like botspam.