Live data from Hacker News

Explain shell

explainshell.com

31–40 of 56 posts

Re: Explain shell

#31

Explain shell is something that has helped me a lot, but the situation of needing it left me baffled for so long... Why can't I search by command + flag? For example, I know what command A does, but I'm not sure what flag C means. I can search for man A, but why can't I search man A --flag C to get only the relevan portion of the manpage? This has baffled me for years. I'd have guessed that discoverability and docume…

What about: man foo | grep bar

Then you only get the line with "bar" in it. (append -C 1 at the end to get 1 line before and 1 after the term you grepped for).

And of course you can pimp your terminal experience by using fish (https://fishshell.com/) as it ships with autosuggestions and other really nice features. (Beware that it will not provide 100% POSIX compliance but if that's an issue you can use ZSH or pimp your bash as well).

Then there is other kind of man pages like TLDR (https://github.com/tldr-pages/tldr) which is curated by community and quite awesome ;-)

Re: Explain shell

#32

Welp, I still don't know what :(){ :|:& };: exactly does, but it sure borked my WSL. Error: 0x80070040 after forking too many processes. I know comment moderation sucks, but it would be great to have some kind of wiki/comment system/human generated notes on popular commands.

Its also known as a fork bomb! I have one tattooed on my arm.

Re: Explain shell

#35

Welp, I still don't know what :(){ :|:& };: exactly does, but it sure borked my WSL. Error: 0x80070040 after forking too many processes. I know comment moderation sucks, but it would be great to have some kind of wiki/comment system/human generated notes on popular commands.

You define a function named :, which calls iself and goes in the background. Then you call : at the end and start the neverending chain of :-calls till your memory bleeds.

Not really: the function `:` calls itself and _pipes_ into itself.

The difference is - from what I can deduce - that if it were to only call itself, there would be up to 2 `:` processes running at a time, while the bash call stack would grow indefinitely. Using all your RAM but not an actual fork bomb.

Adding the pipe makes the number of `:` processes grow exponentially, and very quickly you reach the limit of 16384 active processes (PIDs, actually) on a Linux box.

Re: Explain shell

#36
Inspired by this site, I made a handy shell script[0] for use from cli - good enough to lookup documentation for options from man/help pages. Doesn't cover all the features offered by explainshell, there are issues with some corner cases and tested only on Ubuntu

[0]https://github.com/learnbyexample/command_help

Re: Explain shell

#39
post #26

Explain shell is something that has helped me a lot, but the situation of needing it left me baffled for so long... Why can't I search by command + flag? For example, I know what command A does, but I'm not sure what flag C means. I can search for man A, but why can't I search man A --flag C to get only the relevan portion of the manpage? This has baffled me for years. I'd have guessed that discoverability and docume…

The terminal was not built for that kind of automatic lookup, and I often find that options are only interesting in their contexts, so while it might in many cases be possible to show the docs for one option only I think you would have to write a man pages in a different style to make that really usefull. The best place for you to create a PR is against the original program, it says on Explainshell that everything is…

It's not the terminal's fault, it's because man lacks semantic markup.

Re: Explain shell

#40

Explain shell is something that has helped me a lot, but the situation of needing it left me baffled for so long... Why can't I search by command + flag? For example, I know what command A does, but I'm not sure what flag C means. I can search for man A, but why can't I search man A --flag C to get only the relevan portion of the manpage? This has baffled me for years. I'd have guessed that discoverability and docume…

As far as missing command flags, this explains what to do: https://github.com/idank/explainshell/issues/1
Post reply on HN