TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Explain Shell

1372 pointsby auton1over 11 years ago

72 comments

lelandbateyover 11 years ago
I totally love this, it&#x27;s already incredibly helpful! It&#x27;s super-functional, and frankly it&#x27;s very, very nice looking. To Mr. Idan Kamara, the creator of this, I have nothing but the highest praise!<p>Now, I hate to get side-tracked, but for much larger commands, like this one:<p><pre><code> ps x -o &quot;%r %c &quot; | grep &quot;someScript.sh&quot; | awk -F&#x27; &#x27; &#x27;{print $1}&#x27; | xargs -I % &#x2F;bin&#x2F;kill -TERM -- -% </code></pre> that has a lot of parts, it can be hard to connect the different options to the various explanations[0], since there are so many lines and they frequently have similar colors and you have to keep scrolling up and down the page. Being able to do something like click on a command&#x2F;option and have the page jump to the corresponding explanation would be very helpful.<p>[0] - <a href="http://explainshell.com/explain?cmd=ps+x+-o++%22%25r+%25c+%22+|+grep+%22webLauncher.sh%22+|+awk+-F%27+%27+%27{print+%241}%27+|+xargs+-I+%25+%2Fbin%2Fkill+-TERM+--+-%25" rel="nofollow">http:&#x2F;&#x2F;explainshell.com&#x2F;explain?cmd=ps+x+-o++%22%25r+%25c+%2...</a>
评论 #6836254 未加载
评论 #6835982 未加载
评论 #6836080 未加载
评论 #6837170 未加载
评论 #6836174 未加载
评论 #6836912 未加载
jfasiover 11 years ago
Gorgeous. Amazing. Absolutely fantastic. Easy the coolest and most useful thing I&#x27;ve seen on hacker news in a while.<p>Enough gushing, now some bug reports:<p>&quot;read -r random_line &lt; &lt;(sort -R file)&quot; yields &quot;syntax: expecting filename or fd (position 22)&quot;<p>&quot;nc HOST PORT | tee movie.mp4 | mplayer -&quot; I can hover over movie.mp4, but I can&#x27;t scroll down the see the description without losing the emphasis on that path. I&#x27;d suggest letting the user click on the portion, or perhaps a long-hover effect?
评论 #6835994 未加载
评论 #6836288 未加载
评论 #6835337 未加载
评论 #6835264 未加载
ivan_ahover 11 years ago
The UI with the svg &quot;wiring&quot; is awesome. You should consider abstracting away that functionality so that it can be reused by other projects.<p>Right now I&#x27;m imagining explainphys ;) where each term in a physics equation is explained e.g. The magnetic force felt by a particle of charge q moving with velocity \vec{v} in a magnetic field \vec{B} is<p><pre><code> \vec{F}_B = q \vec{v} × \vec{B} | | | | |______magnetic field magnetic force | | | | | cross charge | prod. | velocity of particle</code></pre>
评论 #6835459 未加载
评论 #6836052 未加载
staunchover 11 years ago
Very well done. Now I just wish this was a shell program!<p><pre><code> user@server:~$ explain iptables -A INPUT -i eth0 -s ip-to-block -j DROP</code></pre>
评论 #6835355 未加载
评论 #6835497 未加载
评论 #6835600 未加载
评论 #6835821 未加载
评论 #6835475 未加载
评论 #6835479 未加载
评论 #6835423 未加载
评论 #6835284 未加载
评论 #6839261 未加载
tieTYTover 11 years ago
This is pretty cool but what I found annoying was matching the snippet of code and the description together. Take this for example: <a href="http://explainshell.com/explain?cmd=true+%26%26+%7B+echo+success%3B+%7D+%7C%7C+%7B+echo+failed%3B+%7D" rel="nofollow">http:&#x2F;&#x2F;explainshell.com&#x2F;explain?cmd=true+%26%26+%7B+echo+suc...</a><p>The command is: true &amp;&amp; { echo success; } || { echo failed; }<p>But the top box description is for echo parameters. The next one is for echo. Why can&#x27;t it go from top to bottom in order of the command? EG: Start with true, then &amp;&amp;, then {, then echo, etc.<p>The way it is, I spend a lot of mental energy matching things up.
评论 #6836332 未加载
SimHackerover 11 years ago
This is a wonderful idea and an upstanding social service, in the same vein of giving heroin addicts access to free clean needles, pure heroin, and a safe place to shoot up.<p>There is no perfect solution -- in the ideal world, everyone would use safe healthy programming languages, and nobody would be addicted to shell scripting.<p>But in the real world, many people still choose to use shell scripting as a quick and easy short term solution to their problems.<p>Like the unhealthy temptation to use regexps for parsing html, shell scripting just causes more problems, which snowball out of control until you have the dire situation we&#x27;re in today, with a whole generation of urban hipsters who learned cargo-cult cut-n-paste shell scripting by typing &quot;more .&#x2F;configure&quot;.<p>So it&#x27;s much better to treat shell scripting as a health problem rather than a criminal problem.<p>My only suggestion is that you should sponsor links to &quot;recovery programs,&quot; where people can learn to solve their problems with safe healthy programming languages instead of shell scripts. For the popular rube-goldbergesque shell incantations, you could show how to accomplish the same thing more comprehensibly in Python, Ruby, JavaScript, Lisp, Forth, Mathematica, Quartz Composer, etc. ;)
noonespecialover 11 years ago
So I fed it : cat .&#x2F;trunk&#x2F;.config |awk &#x27; &#x2F;CONFIG_TARGET_BOARD&#x2F; { gsub(&#x2F;\&quot;&#x2F;,&quot;&quot;); split($0,a,&quot;=&quot;); print a[2] }&#x27;<p>A little one-liner I worked up a few days ago to quickly show me which architecture my OpenWRT trunk was last built with. I&#x27;d really like it to explain in much more detail <i>what</i> each of the terms inside the awk command do. Perhaps make &quot;explain&quot; modular so that people can add more detail to the gazillion things that can happen inside awks, seds, greps, etc?<p>Fabulous idea. This should have been in unix all along as part of the man system.
评论 #6835586 未加载
评论 #6836471 未加载
scott_karanaover 11 years ago
It unfortunately can&#x27;t decode :(){ :|:&amp; };:, a classic unintelligible forkbomb. I suppose it&#x27;s only lack of function support that&#x27;s the issue!<p>Really neat program, nonetheless!
评论 #6836604 未加载
评论 #6835976 未加载
评论 #6835915 未加载
denizozgerover 11 years ago
<a href="http://explainshell.com/explain?cmd=git" rel="nofollow">http:&#x2F;&#x2F;explainshell.com&#x2F;explain?cmd=git</a><p>Funny
评论 #6836030 未加载
JoshTriplettover 11 years ago
This is quite impressive.<p>I&#x27;d love to see the argument explanations narrow down sub-arguments. For instance, &quot;find -type f&quot; ought to just show the top-level description for -type and the description for &#x27;f&#x27;, not all the other type characters.
njharmanover 11 years ago
Source <a href="https://github.com/idank/explainshell" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;idank&#x2F;explainshell</a><p>This is truly stunning. It&#x27;s a small thing, and what it does is not stupendous. But the design, aesthetics, ease of use, in a word elegance makes the combined whole a superlative tool.
fernlyover 11 years ago
Impressive but I agree with all who said you can&#x27;t read the callouts below the 2nd or 3rd, because you have to scroll, which loses the focus on the item. I think it might work better if you just pop up one explanation box at a time, directly below the command, as the mouse sweeps across.<p>Also missing some obvious things like on this basic zip command [0]. It can&#x27;t explain -9, probably because that&#x27;s not in the man page as itself but as &quot;-n&quot;. But also has nothing to offer about the zip file target or the input folder, which are in the man page as symbolic arguments.<p>[0] <a href="http://explainshell.com/explain?cmd=zip+-vr9+foo.zip+somefolder" rel="nofollow">http:&#x2F;&#x2F;explainshell.com&#x2F;explain?cmd=zip+-vr9+foo.zip+somefol...</a>
pixelmonkeyover 11 years ago
Really cool. A suggestion. For long explains, it&#x27;d be great to be able to click on the part to jump to that part of the explanation, and then offer some way to &quot;jump back to top&quot;.<p>Alternatively, I was thinking there might be a nice &quot;swipe&quot; or &quot;carousel&quot; interface applicable here. e.g. you hit left&#x2F;right arrows and it explains every individual atom of the command-line.<p>That said, very nice as it is now. You deserve major kudos simply for bringing most manpages online in a searchable, good-looking interface! Instantly added as a &quot;dev&quot; bookmark for me.
TallboyOneover 11 years ago
Lots more where that came from (great resource btw!): <a href="http://pineapple.io/resources/tagged/bash+terminal" rel="nofollow">http:&#x2F;&#x2F;pineapple.io&#x2F;resources&#x2F;tagged&#x2F;bash+terminal</a>
b0rsukover 11 years ago
It&#x27;s surprisingly good, overall, but there are some glaring omissions. For instance:<p>sudo apt-get install tree Only sudo is explained. I understand apt-get is distro-specific, but it&#x27;s widespread enough to deserve a special case. Interestingly, apt-get install tree (without sudo) works better.<p>Common, widely known system configuration files like &#x2F;etc&#x2F;issue, &#x2F;etc&#x2F;hosts, &#x2F;etc&#x2F;hostname, &#x2F;etc&#x2F;fstab ... deserve to be special-cased, too. Many of them actually have their man pages, so it&#x27;s possible to script.
评论 #6836785 未加载
cheeseprocedureover 11 years ago
This is brilliant. (I&#x27;ve forwarded it to novices and pros alike, and everyone else&#x27;s response has been much the same.)<p>If you were to open up donations to support development, I would HAPPILY contribute.
评论 #6836896 未加载
Procrastesover 11 years ago
I agree it&#x27;s beautiful, and a really great idea. I&#x27;ll also add my vote that this would make an even better commandline tool.<p>It had difficulty with:<p>find . -name &quot;<i>.cpp&quot; | xargs -i grep -His &quot;oops&quot; &quot;{}&quot;<p><a href="http://explainshell.com/explain?cmd=find+.+-name+%22*.cpp%22+|+xargs+-i+grep+-His+%22oops%22+%22{}%22" rel="nofollow">http:&#x2F;&#x2F;explainshell.com&#x2F;explain?cmd=find+.+-name+%22*.cpp%22...</a><p>It seems to think the -His belongs to xargs rather than grep.
emeralddover 11 years ago
It&#x27;s a nice toy, but seems to break down with more interesting stuff. For instance:<p><pre><code> for FILE in `ls`; do echo $FILE ; done </code></pre> <a href="http://explainshell.com/explain?cmd=+for+FILE+in+%60ls%60%3B+do+echo+%24FILE+%3B+done" rel="nofollow">http:&#x2F;&#x2F;explainshell.com&#x2F;explain?cmd=+for+FILE+in+%60ls%60%3B...</a><p>That&#x27;s a simpler equivalent of something I cooked up which probably didn&#x27;t belong in a single line of shell anyhow.
评论 #6836979 未加载
publicfigover 11 years ago
This is amazing! It&#x27;s great for someone like me who, while knowing their way around the shell, isn&#x27;t as well versed as some of my more veteran co-workers. While it&#x27;s great to hear explanations of some of the more dense lines they give me to run, that&#x27;s not always possible and can be a bit annoying. This could help take some of the pressure off of them to drag me through. :P
jffover 11 years ago
I don&#x27;t know what I was expecting, but one of my most-used command lines, &quot;du -a | grep foo&quot; is pretty uninformative.
评论 #6835442 未加载
评论 #6836153 未加载
评论 #6835306 未加载
评论 #6835473 未加载
评论 #6835569 未加载
un1xl0serover 11 years ago
Amazing tool for beginners, but also helpful for advanced users.<p>GREAT: find &#x2F; -type f -print0 |xargs -0 grep heythere<p>I tried some sub-shells, and seemed to not work so well. $() and `` would be nice.<p>ps -fp $(pgrep -d, krb5kdc)<p>ps -fp `pgrep -d, krb5kdc`<p><a href="http://explainshell.com/explain?cmd=ps+-fp+%24%28pgrep+-d%2C+krb5kdc%29" rel="nofollow">http:&#x2F;&#x2F;explainshell.com&#x2F;explain?cmd=ps+-fp+%24%28pgrep+-d%2C...</a><p>edit: newlines
ChuckMcMover 11 years ago
Very nice. It was challenged by my go to command:<p><pre><code> tar cf - . | (cd &#x2F;dest&#x2F;dir ; tar xvf -) </code></pre> Which uses tar to copy a directory tree. It didn&#x27;t know &#x27;.&#x27; stood for the current directory, it missed out that &#x27;f -&#x27; was the file &quot;standard in&quot; &#x2F; &quot;standard out&quot;
评论 #6836452 未加载
mihokover 11 years ago
I give out this link to all my developers that are just getting a feel for the terminal. Thanks so much for this!<p>A nice to have: Having the command that was originally entered follow you down at the top of the window so when I&#x27;m looking at a long piped command, it makes it easier to follow
kfkover 11 years ago
Hey, very nice! What about allowing users to take notes and tags on the search results? I have a bunch of bash commands I run I always forget, this would help me a lot to keep track of things (like all the ssh-ing stuff that I can&#x27;t seem to fit in my memory...).
hndlover 11 years ago
Very cool! It would be great if you would provide common usages for a given command if the user didn&#x27;t provide any switches. That could be links like the ones you have in the &quot;examples&quot; section on the landing page.
dzlobinover 11 years ago
Holy moly, this might be one of the best things I&#x27;ve seen on HN in a long time.
gocha9921over 11 years ago
I am new to command line - but this is awesome! VERY helpful. Thanks and congrats!
gjarkkoover 11 years ago
vpenis.sh also has trouble explaining. It&#x27;s a bit of a challenge for anyone, though.<p>echo `uptime|grep days|sed &#x27;s&#x2F;.<i>up \([0-9]</i>\) day.*&#x2F;\1\&#x2F;10+&#x2F;&#x27;; cat \ &#x2F;proc&#x2F;cpuinfo|grep &#x27;^cpu MHz&#x27;|awk &#x27;{print $4&quot;&#x2F;30 +&quot;;}&#x27;;free|grep \ &#x27;^Mem&#x27;|awk &#x27;{print $3&quot;&#x2F;1024&#x2F;3+&quot;}&#x27;; df -P -k -x nfs | grep -v \ 1k | awk &#x27;{if ($1 ~ &quot;&#x2F;dev&#x2F;(scsi|sd|md)&quot;){ s+= $2} s+= $2;} END \ {print s&#x2F;1024&#x2F;50&quot;&#x2F;15+70&quot;;}&#x27;`|bc|sed &#x27;s&#x2F;\(.$\)&#x2F;.\1cm&#x2F;
aeykieover 11 years ago
You can use `man test` for [ ] which it currently reports no man page for.
wilaover 11 years ago
Great tool. Would have preferred to use it locally without all of those dependencies on a machine without networking. But OTOH having it online means that it is easier to centrally manage and update.
eabruzzeseover 11 years ago
This is incredible.<p>One small change request: the longer commands make me scroll down the page, and I can no longer see what each block is pointing to. Maybe you could fix the command to a top-bar as you scroll down?
Riseedover 11 years ago
This is beautiful! It will come in handy for filling in the vast holes in my knowledge. I think it would also make a great resource for those just starting to work with shell. Very well done indeed!
rbosingerover 11 years ago
Wow. I&#x27;ve only tried a few queries but they worked well! This could be great for breaking down some of the &quot;copy paste to install this&quot; commands you see from open-source projects.
trurl42over 11 years ago
It fails to parse the command if you start with a redirect.<p><a href="http://explainshell.com/explain?cmd=%3E+foo" rel="nofollow">http:&#x2F;&#x2F;explainshell.com&#x2F;explain?cmd=%3E+foo</a>
DonGateleyover 11 years ago
I&#x27;d like it if hovering on a parsed item moved it&#x27;s explanation to the top rather than just highlighting it. Not so much scrolling required if any.
Theriac25over 11 years ago
Doesn&#x27;t seem to support backquotes? For example<p><pre><code> for x in `ls ~&#x2F;foo`; do echo $x; done </code></pre> doesn&#x27;t yield anything remotely interesting.
评论 #6835713 未加载
SmileyKeithover 11 years ago
This is fantastic. Even with simple examples like `ls -la` it shows the documentation and other flag synonyms for all of the passed flags. Very impressed.
ape4over 11 years ago
Its cool and good but gets into the syntax too quickly. To explain &quot;tar xzvf archive.tar.gz&quot; I would say &quot;extract the archive&quot;.
parallelistover 11 years ago
Nothing useful said for:<p><pre><code> for word in foo bar baz; do echo $word; done </code></pre> Seems to think COLUMNS is a command in:<p><pre><code> COLUMNS=20 ls</code></pre>
TorKlingbergover 11 years ago
Very neat!<p>I did choke at the end of this little favorite:<p><pre><code> find -name &quot;*.[hc]&quot; -o -name &quot;*.[hc]pp&quot;|xargs grep -siP &#x27;apa&#x27;</code></pre>
nailerover 11 years ago
Good: it understands &amp;&gt;, which some Unix old-timers don&#x27;t get.<p>To improve: it didn&#x27;t provide any context to what $IFS is used for.
mathattackover 11 years ago
You know you&#x27;re on the right track when people are saying, &quot;But why isn&#x27;t this in there already?&quot;
willfiveashover 11 years ago
Doesn&#x27;t yield anything particularly useful for: [[ -f &#x2F;tmp&#x2F;foo ]] &amp;&amp; echo yes
ErikRognebyover 11 years ago
First of, I love the functionality and clean design.<p>Why are you using bootstrap if the site isn&#x27;t responsive?
daGrevisover 11 years ago
It says that `-h` in `shutdown` stands for help, not halt. Otherwise, seems as a useful tool! :)
D9uover 11 years ago
The site doesn&#x27;t mention the !! command.<p>The !! command is used to repeat the previously issued command.
emiliobumacharover 11 years ago
Great! This could serve as an example for help sites about other shell-like environment.
harichinnanover 11 years ago
Found a minor defect.<p>cat fil*.dat | head -100 | tail -20. Does not explain -100 in head and -20 in tail.
kinover 11 years ago
Yup, just shared with my whole office. Super useful for all levels. Thanks for this.
fennecfoxenover 11 years ago
:(){ :|:&amp; };: or GTFO :)
评论 #6836113 未加载
nish1500over 11 years ago
I started learning Shell last week. This couldn&#x27;t have been better timed :)
Arnorover 11 years ago
Awesome tool. Now can we have one that does the same thing for a regexps?
评论 #6841102 未加载
k-mcgradyover 11 years ago
Really cool project! I can already see myself using this a lot.
quickpostover 11 years ago
This is awesome. Best post I&#x27;ve seen on HN in a while.
Xelomover 11 years ago
Beautiful. Can&#x27;t describe with words...
heldridaover 11 years ago
Very interesting project, already using it!
gtallen1187over 11 years ago
this is great - i have had a hard time learning shell and this is a huge help. thank you!!!
social_monadover 11 years ago
# this command fails to explain:<p>: abc $(xclock) def
samsosinaover 11 years ago
Straight to my bookmark bar!
garrettdreyfusover 11 years ago
It&#x27;s like shellgenius.
droid_wover 11 years ago
Fantastic! I love your UI.
paulasmithover 11 years ago
Fantastic tool, kudos!!!!
NovaS1Xover 11 years ago
Haha! This is brilliant!
mmgutzover 11 years ago
Very useful. Good job.
bonemachineover 11 years ago
Really liking this.
nichocharover 11 years ago
This is super cool
deft0nesover 11 years ago
Totally awesome!
pmattosover 11 years ago
Stuff of dreams!
uonyxover 11 years ago
Nice. Very nice.
ananth99over 11 years ago
Insane stuff!
mumokshaover 11 years ago
Nice!!!!!
jbverschoorover 11 years ago
WOW!