17 ms·
Explain Shell
- The_Hoff 10y agoI would love it if the site was encrypted so that I could input raw commands at work without modifying sensitive information. (Yes I understand the host can still record this sensitive information, and no I have not looked through the source code yet to see that this doesn't occur).
- boramalper 10y ago> and no I have not looked through the source code yet to see that this doesn't occur Still, the website might be running on a modified version.
- idank 10y agoIt doesn't. And I'm not just saying that because there's an agent pointing a gun at me as I type this. Having said that, please don't send sensitive information to a random service on the internet. :)
- boramalper 10y agoNo offense, I was just pointing a general fact. =)
- Ajedi32 10y agoWell, it's open-source so I guess you could always self-host.
- mabynogy 10y agoOptenum to enrich the database of arguments: https://github.com/mattboyer/optenum https://github.com/mattboyer/optenum
- electricEmu 10y agoThere's no PowerShell support. That's not any command. http://explainshell.com/explain?cmd=Get-ChildItem http://explainshell.com/explain?cmd=Get-ChildItem
- ldd 10y agoI'm confused. Is PowerShell 'recognized' as a shell? I thought only unix and unix-like shells would be covered. I wonder what the technical definition of a shell is though. (genuinely curious, not trying to be snarky)
- hoov 10y agoIt clearly doesn't cover "unix and unix-like" shells, since fish shell syntax isn't supported. It seems to be trying to be bash-compatible since it uses bashlex under the hood, but as another commented noticed, the bash parsing isn't perfect.
- deleted 10y ago[deleted]
- arca_vorago 10y ago>I'm confused. Is PowerShell 'recognized' as a shell? Yes, given the definiton of shell being a user interface to an operating system, typically command line, powershell is considered a shell and can function as one. For example, while many think of windows servers as being all gui, newer versions of windows (server) can be run entirely in cli mode with no gui via powershell, in which supposedly any management technique normally done through gui can be done through the ps cli. The main difference between nix shells and powershell is that the nix shells are text based, while powershell is object based due to it's .NET core. As a sysadmin who uses both bash and powershell, I have to say the more recent versions of powershell are quite powerful and a fresh breath of air to use in the normally stale windows world. Of course, I tend to use pywinrm to remotely run ps commands so I don't too dirty touching the tainted MS ecosystem. (That's my way of saying that while powershell is nice and a large improvement over batch command line files, bash is still the better one due to the underlying unix philosophy and the GNU ecosystem)
- zufallsheld 10y agoBest used in combination with shellcheck (https://www.shellcheck.net/ https://www.shellcheck.net/), which checks your shell scripts for bugs.
- cheeze 10y agoPretty awesome, but broke on the first command I tried (granted, it is bash specific IIRC) echo $(( 1 + 2 ))
- cat199 10y agonot at all a bashism $ uname -sr OpenBSD 6.0 $ ps T PID TT STAT TIME COMMAND 85828 pc Ssp 0:00.01 -ksh (ksh) 34802 pc R+p 0:00.00 ps -T $ echo $(( 1 + 2 )) 3
- mcnaughtonrules 10y agoResident bsd hero
- contras1970 10y ago% /bin/sh $ echo $((1 + 2)) 3 $ uname -srm DragonFly 4.7-DEVELOPMENT x86_64
- phaemon 10y agoIt's actually POSIX standard. See http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_04 http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3...
- deleted 10y ago[deleted]
- kps 10y agoHowever, the site does interpret input as bash and not a Posix-compliant shell.
- sjrd 10y agoVery nice! I fed it one of my favorite commands: git branch --merged | grep -v master | xargs -n 1 git branch -d and it dealt with it reasonably well. The only part it couldn't understand was `branch -d` at the end. In other words, it was not capable of recognizing that the non-option arguments to `xargs` should actually be recursively interpreted as a command-line.
- tsneed290 10y agoTIL that git calls itself "the stupid content tracker"
- nonsince 10y agoPretty funny seeing as the main complaint about git is that it's too complex
- elevensies 10y agoI also tried a command with xargs, it seemed to do a pretty good job: http://explainshell.com/explain?cmd=find+.+-type+f+-print0+%7C+xargs+-0+grep+-i+%22PATTERN%22 http://explainshell.com/explain?cmd=find+.+-type+f+-print0+%...
- tuxxy 10y agoIt doesn't quite get dd, as well. http://explainshell.com/explain?cmd=dd+if%3D%2Fdev%2Furandom+of%3Dtest.iso+bs%3D10M+count%3D10 http://explainshell.com/explain?cmd=dd+if%3D%2Fdev%2Furandom...
- cat199 10y agoDidn't you hear? dd is a 'cult', and you should use 'standard' commands like pv instead, so this is totally okay, in fact good. https://news.ycombinator.com/item?id=13896675 https://news.ycombinator.com/item?id=13896675
- bigbugbag 10y agoFirst comment from your link debunks the whole ordeal. pv is for monitoring the progress of data going through a pipe, hardly related to dd.
- holtalanm 10y agoi discovered this site about two years ago. I still use it for explaining commands that I run across on StackOverflow before I run them in my own terminal.
- deleted 10y ago[deleted]
- TeMPOraL 10y agoLovely! Bookmarking for future use! Some quick notes on my way back from work: 1. Broken on mobile :(. Default layout is a mess, and "request desktop site" has the lines going to the edge of the screen, making them invisible. S7, Android, Firefox. 2. Totally neeeds to be done as an Emacs mode (preferably offline). Both for checking a particular command and during writing shell scripts.
- finnh 10y agoit does a pretty good job with "sudo make me a sandwich" =) http://explainshell.com/explain?cmd=sudo+make+me+a+sandwich http://explainshell.com/explain?cmd=sudo+make+me+a+sandwich
- abraves10001 10y agoAs a relatively new programmer and one who went to one of those mediocre bootcamps, resources like this are invaluable. Thanks!
- bradbeattie 10y agoI fed it the most recent command posted on commandlinefu.com: grep -i s2enc /etc/vcac/server.xml | sed -e 's/.* password=\"\([^\"]*\)\".*/\1/' | xargs -n 1 vcac-config prop-util -d --p 2>/dev/null; echo Given the height of the result, scrolling up and down became a real pain. Maybe collapsable sections or position:fixed for the command or something like that?
- IE6 10y agoThe "navigate:" part lets you cycle through 'chunks' of explanations
- IAmGraydon 10y agoEven though I'm fairly experienced in bash, this is the ultimate cheat sheet we all need. Thank you!
- elmigranto 10y agoPretty neat! Though it would be nice if it brought into the view the part you highlight when it doesn't fit on screen, otherwise you have to scroll (and highlight is lost).
- twistedpair 10y agoToo bad, I hoped this was a shell util like EXPLAIN in SQL. e.g. explain cat foo.txt > out.txt
- Ajedi32 10y agoAll it needs is an API and you could easily build a tool which does just that. Though if you wanted it to actually explain `cat foo.txt > out.txt` and not just output the explanation for `cat foo.txt` to `out.txt` you'd probably have to put that in quotes.
- rena-anju 10y agoNot really need an API to quickly build a tool for this. Could as well just send a proper request and parse the response, not too much of extra work for this service.
- deleted 10y ago[deleted]
- dang 10y agoTwo big threads from 2013: https://news.ycombinator.com/item?id=6296634 https://news.ycombinator.com/item?id=6296634 https://news.ycombinator.com/item?id=6834791 https://news.ycombinator.com/item?id=6834791
- idank 10y agoWow it's been 4 years? Would you believe it if I told you it's running on the smallest digital ocean instance, backed by MongoDB (!), and the only time I had to do any maintenance on it was when DO turned down the machine I happened to run on? The service doesn't exactly scream complexity, but it's nice when you put something out there and it just runs!
- mullethunter 10y agoA quick shout out that I use explain shell in my teaching kids how unix and piping functions work. Cheers man!
- zoidb 10y agoI wrote a little shell challenge/tutorial project a little bit ago and was thinking about adapting it to teaching beginners. would love to hear your thoughts -https://cmdchallenge.com https://cmdchallenge.com
- kreetx 10y agoDidn't know about this, thanks for reposting!
- frankhorrigan 10y agoI'm not saying that this _is_ a phishing scam. But if it is, hoo boy it's a clever one.
- umanwizard 10y agoHow so?
- alpb 10y agoHas anyone been able to get [ or [[ to work here?
- idank 10y ago[[ seems broken but this works http://explainshell.com/explain?cmd=%5B+-f+foo http://explainshell.com/explain?cmd=%5B+-f+foo
- danellis 10y agoIf you hover over something that points to a description that's not currently in view, you can't scroll to the description without unhovering and hence unhighlighting the line pointing to the right description.
- tambourine_man 10y agoNice work, could have a better mobile layout, though
- captaincrunch 10y agoPretty sweet! It's not explaining the 'u' in: netstat -tulpn though :O
- btschaegg 10y agoVery impressive. It seems to rely strongly on common *NIX CLI patterns though. It really doesn't like dd, for example[1]. [1]: http://explainshell.com/explain?cmd=dd+if%3D%2Fdev%2Fsda+of%3D%2Fdev%2Fsdb http://explainshell.com/explain?cmd=dd+if%3D%2Fdev%2Fsda+of%... Edit: Also, it doesn't understand that the token after `-p` for netcat is actually the port argument[2]. I guess it is parsing manpages internally? [2]: http://explainshell.com/explain?cmd=nc+127.0.0.1+-p+80 http://explainshell.com/explain?cmd=nc+127.0.0.1+-p+80
- idank 10y agoIt boils down to a bunch of heuristics so there are gaps if the man page is slightly off of what it expects.
- augustt 10y agoVery cool! Although it has some problems if there isn't a space between a flag and its value: http://explainshell.com/explain?cmd=gcc+-I%2Fusr%2Flocal%2Finclude+-L%2Fusers%2Fblah%2Flibs+test.c+-o+bin%2Fprogram http://explainshell.com/explain?cmd=gcc+-I%2Fusr%2Flocal%2Fi...
- israrkhan 10y agoVery nice. However I find myself trying to decipher regular expressions more often than shell commands. A tool like this for regular expressions would have been more useful.
- zamalek 10y agoRegex101[1] does a pretty good job. [1]: https://regex101.com/ https://regex101.com/
- tmerr 10y agoThis works well, but the web interface seems like an unnecessary layer on top of what could just be a terminal based tool. I'm trying to resist the urge to fork this, putting another project on my todo list I will never finish
- tomjakubowski 10y agoThe lines connecting each explanation to the relevant part of the command line could be tricky to squeeze into a terminal window. You'd could instead create an interface with a movable "cursor", which highlights a single "chunk" of the command line, and presents the explanation for that "chunk" beneath the entire command line string.
- LostCharacter 10y agoI have a little bash script I picked up somewhere that uses mankier.com to a similar effect: explain () { if [ "$#" -eq 0 ] then while read -p "Command: " cmd do curl -Gs "https://www.mankier.com/api/explain/?cols="$(tput cols) --data-urlencode "q=$cmd" done echo "Bye!" elif [ "$#" -eq 1 ] then curl -Gs "https://www.mankier.com/api/explain/?cols="$(tput cols) --data-urlencode "q=$1" else echo "Usage" echo "explain interactive mode." echo "explain 'cmd -o | ...' one quoted command to explain it." fi }
- kevincox 10y agoCool tool. I think what would really be the icing on the cake is if it substitued the actual command into the documentation. Removing that one layer of indirection would make it that much easier to understand. For example: foo() { bar } > This defines a function named "foo". Also that example fails to parse. Even though :() { :|: };: works so it seems like there is a certian amount of special casing.
- idank 10y agoThat's an awesome idea. I'd love to try that one day. Your command isn't valid because it's missing a control character after 'bar', such as ';'. Bash rejects it as well: $ bash -c "foo() { bar }" bash: -c: line 1: syntax error: unexpected end of file
- kevincox 10y agoOops, you are right, that's what I get for testing on zsh :(
- rohit33 10y agoDoes well, but goes only so far. I fed the command sudo chown -R $USER:$USER /var/www/example.com/html and the tool wasn't capable of recognizing what $USER:$USER is doing.
- nevster 10y agoHandy tip for those on a mac using terminal - type a command and press cmd-ctrl-shift-? to get a man page pop-up. (People with touch bars can just tap on the man page icon.)
- dwpdwpdwpdwpdwp 10y agoQuite Nice. Just FYI, the very first command, :(){ :|:& };: is a fork bomb and you probably shouldn't run it in your shell
- mih 10y agoWish I'd read your comment beforehand. Tried it blindly and and lost about 10 min trying to figure out what was happening ...
- moxious 10y ago:) Well I'm tempted to chide you for running arbitrary code from the Internet from an untrusted source, but then I remember that's the entire web via JavaScript and I realize I'm living in a glass house. Who came up with this security model anyway?
- nonsince 10y agoAt least JavaScript's immune to fork bombs because it has no threading model. Doesn't stop some bored college kid with access to NPM and a vicious streak from mining bitcoin on your computer.
- TazeTSchnitzel 10y agoThat's not true, JS has Web Workers. But they're threads, not processes, and perhaps the browser will throttle them.
- mih 10y agoIn my defense, it appeared to be a harmless looking sequence of special characters (not quite, as I found to my dismay). Explain Shell didn't help much
- dullgiulio 10y agoWhich is easily blocked by having sensible ulimits. Too bad they are always at zero (no limits.)
- JasonSage 10y agoThere are several commands on OS X that behave a bit differently from their traditional UNIX counterparts. grep is the big one that springs to mind—any given grep shell-fu may just not work on OS X and I'll find myself having to reconstruct the arguments from scratch to get it working. I'd love to see a fork of explainshell or an option in the interface to deal with items like this which are specific to OS X. Let me put a grep command in for OS X and have it show me what options I'm using which are undocumented—that would be nifty.
- umanwizard 10y agoBy "traditional UNIX" do you mean GNU specifically? What on macOS differs more from standards than does the typical Linux distro?
- jandy 10y agoNot OP, but one I came across yesterday was `date`. Linux: `date -d '10 mins ago'` Mac: `date -v -10M` There's loads of tiny differences like this. Often just old versions, and you can pull in the latest with `brew` or something.
- btschaegg 10y agoAnother one is GNU find assuming the current directory if omitted, while BSD find explicitely has to be told the directory to search in. It's nothing complicated, but breaks many scripts if you only test them on Linux (more or less the same problem like case-insensitive filesystems). I'll have to add, though, that one could argue that OSX is the one behaving like "traditional UNIX", since most of it's tools derive from BSD-Versions. GNU tools are the ones that deviate from this (which I still find more convenient in day to day use).
- umanwizard 10y agoSure, I know there are lots of differences between GNU and macOS; that's not what I'm asking about.
- 10y ago
- tdrd 10y agoReally solid. I fed it a recent nasty line from our Makefile: https://github.com/cockroachdb/cockroach/blob/4aeef50/build/protobuf.mk#L132 https://github.com/cockroachdb/cockroach/blob/4aeef50/build/... Looks like it doesn't deal with subshells, but otherwise it did reasonably well. http://explainshell.com/explain?cmd=find+.+-name+*.pb.cc+%7C+sed+%27s%21.%2F%21%21%27+%7C+xargs+-I+%25+sh+-c+%27echo+%22%23include+%5C%22%25%5C%22%22+%3E+%24%28echo+%25+%7C+tr+%2F+_%29%27 http://explainshell.com/explain?cmd=find+.+-name+*.pb.cc+%7C...
- transposed 10y agoI thought this was pretty cool but missing something. Until I realized that uMatrix was blocking Cloudflare. Once I loaded the rest of the site... Awesomeness. Great work, whoever made this.
- deleted 10y ago[deleted]
- fbis251 10y agoDoes anyone know where I can find a completely offline tool that does what this site does? The source for this seems like a bit of overkill. I'd like to be able to use a cli based tool that shows me relevant man sections for the flags I chose for example
- mtrycz 10y agoI totally love this, expecially for learning other peoples code and habits. If it only had a CLI so that I could use it directly from my terminal...
- scott_karana 10y agofile=$(echo `basename "$file"`) This is a horrible example, since it has a "useless use of echo", forcing nested evaluations and a bashism. Basename prints to stdout too! The sh-compatible, simpler equivalent: file=`basename "$file"`
- deleted 10y ago[deleted]
- rmist 10y agortfm