
Show HN: Get help on any Linux command by typing 'howdoi –' in your terminal - superasn
https://github.com/san-kumar/howdoi
======
peter_d_sherman
Hello San Kumar! I looked at your source code, I was amazed that it was only
one file, and only 100 lines of source code (less if we subtract whitespace).
The less source code a program has while still maintaining functionality and
being readable, the better. Which brings me to my next point, functionality.

You saw a problem, a big problem, which is that often even all of the features
Unix has for help (man, apropos, etc.) are not sufficient to be able to
quickly figure out how to complete a task, such that frequently people have to
Google for answers, and why take the extra steps to go to a different window
than the command line, search for answers, and return to the command line?

It's extra steps, but more importantly, it breaks "flow".

Also, this is one of the historic reasons that Unix lost the popularity battle
with new/inexperienced users to Windows/Mac -- not enough user-friendly help,
and this is especially true of Unix's historic command-line help systems.

So, I applaud the problem you chose to solve, and I applaud the elegant way in
which you chose to solve it! You are a true Hacker (used in the positive
definition, not the negative)!

So with respect to the problem you chose and the code that solves it, I say to
you:

Well played Sir, Well played!

 _I vote that this code should become a standard part of all Unix
distributions from now on._

~~~
superasn
Hi Peter. Thank you so much for your nice comment. It just made my day. I
truly appreciate your kind words and it really wants me to make more of such
things :)

Edit: I've added your comment to my project's readme file hoping that is okay
to do so (let me know if not). Thanks

~~~
peter_d_sherman
Sure! Why not? I'm nobody important -- but you're more than welcome to use my
comment!

Wishing you and your project well,

-Peter

------
Mizza
There's already a popular `howdoi` that me and a buddy made:

[https://github.com/gleitz/howdoi](https://github.com/gleitz/howdoi)

~~~
gitgud
That project looks exactly the same, is this a complete rip-off or
coincidence?...

~~~
superasn
No man. Never even heard of the other one until 20 hours ago.

Also as I replied to another comment this looks for programming related
questions while mine is more general linux realted. Also both are free open
source software with their source available so feel free to compare before
accusing me of making a rip-off.

But, overall I'm quite happy with the response I got here, and I still really
wanna make more of such things.

~~~
gitgud
Sorry to accuse you without any evidence, sounds a bit aggressive in
hindsight.

I just find it amazing that you created a very similar tool by the exact same
name without realising it "howdoi". However I can understand it.

Funny story, my username "gitgud" was something I chose at random (I think git
is good). Turns out there's a reasonably popular project called [1] gitgud,
which I didn't event know existed! (so I can understand coincidental name
collisions like "howdoi")

> But, overall I'm quite happy with the response I got here, and I still
> really wanna make more of such things.

You should! these projects are why I come here :)

[1] [https://gitgud.io](https://gitgud.io)

------
sfj
Instead of this, I keep a permanent log of every shell command I ever typed
and have a handy alias to keep through it.

It also keeps track of the directory a command was run from, so I can limit my
search. That way if I ever want to get back into a project I was working on
long ago, I can just grep for commands run from that directory.

Not only that, but I can use it to cd to directories quickly. So if I was
working under a huge p 10 level deep directory path, I have a alias that will
match a string and cd into the last matching path in the permanent history
file.

Not only that, but I can also search and then choose and rerun a command in
the history, and also edit before rerunning it.

~~~
Jaxkr
How do I get this?

~~~
rhaps0dy
Just put:

export PROMPT_COMMAND='if [ "$(id -u)" -ne 0 ]; then echo "$(date
"+%Y-%m-%d.%H:%M:%S") $(pwd) $(history 1)" >>
"${HOME}/bash_logs_$(hostname)/bash-history-$(date "+%Y-%m-%d").log"; fi'

in your ~/.bash_profile. You also may need to `mkdir
"${HOME}/bash_logs_$(hostname)"`

I took this command from a Hacker News thread of the past. I don't have a link
to it any more.

~~~
vardump
There are several past posts with same bash one liner. For example
[https://news.ycombinator.com/item?id=14108671](https://news.ycombinator.com/item?id=14108671)

------
superasn
Hi HN,

Made this quick little utility to help you when you forgot to do something in
linux terminal, like:

    
    
        - the arguments for extracting a bz2 file
        - the command to reattach to a screen 
        - the latest ppa for a software program
        - to something as simple as which linux distro / version i'm running
    

The concept is simple. Just download the script and now anytime from your
terminal you can write

    
    
        $ howdoi see my linux version
        
        $ howdoi upgrade php
    
        $ howdoi unzip a file
    

And it will search the internet and try to give you the most relevant search
result so that you can do whatever it is you're doing without being
interrupted

------
jfim
There's another 'howdoi' already, FYI:
[https://github.com/gleitz/howdoi](https://github.com/gleitz/howdoi)

~~~
superasn
Oh no.. you're right! I will rename mine.

Edit: Though that looks for programming related questions and mine is for more
general linux related questions.

~~~
rozab
Sucks man. Maybe the hivemind can come up with a good pun for you to use...?

~~~
52-6F-62
Could always go way over the top and more formal

    
    
        inwhichwaymightiaccomplishthefollowinginquiry
    

But I doubt that would quite catch on.

~~~
superasn
maybe "howcani".. does it have the same ring to it?

------
findjashua
On OSX, the "StackExchange Search" workflow for Alfred is also fantastic for
doing this.

Firstly, you can bind it to a hotkey, so don't have to type "how do i" before
the query

Secondly, it updates the list of results as you type. Then you can select the
one that seems to be the most relevant to open it in the browser (with a
hotkey)

[https://github.com/deanishe/alfred-
stackoverflow](https://github.com/deanishe/alfred-stackoverflow)

------
maxmalysh

        $ curl cheat.sh/tar
        $ curl cheat.sh/ssh
        $ curl cheat.sh/awk

~~~
hivacruz
I made a small function to use "cheat" and it helps a lot to find examples of
how to use some Linux command when I'm stuck:

function cheat() { curl cht.sh/$1 }

------
thiht
I remember there was the `apropos` command for this use case but I don't think
the results were good enough.

It might be worth the comparison in your readme though.

Anyway when I started using Linux I would have loved something like this.

~~~
filterfish
I use `man -k` (which is the same thing) all the time.

It has a slightly different use case though.

~~~
kjs3
Those were the two I immediately thought of as well.

------
zneveu
`alias howdoi="man" `

------
jonwhittlestone
I am a big fan of cheat.sh for which only curl is needed

Type in your terminal ..

curl cheat.sh/ls

~~~
mellosouls
Yeah, I have this it's excellent, tho sometimes turns my terminal a funny
colour...

------
obviyus
Looks great! This coupled with tldr would prove incredibly useful for some of
my friends trying to get used to Linux.

~~~
superasn
Thank you so much. It was inspired by cheat.sh which does something similar
too

------
stephenr
This would be good if.. you know.. `man` didn't exist.

~~~
Gaelan
Man is a terrible tool for quickly remembering how to do something I do once
in a while. The examples—usually the most important part—are usually at the
very bottom, if they’re even there.

~~~
filterfish
I use man all the time for exactly this. In fact it is something man really
excels at.

The other nice thing about looking up options in the man pages is that you
often see other useful options that you didn't know existed. I've found some
of my favourite options this way!

------
sebelk
Nice, just a question, What's the difference with the homonymous app writen in
python ?

------
Lurkars
I didn't try it, but shouldn't PHP be stated as dependency? It's a PHP script
and won't run without PHP installed.

~~~
superasn
Yes, I've updated the readme file.

------
traviscj
I use the gleitz version with

``` alias h3='howdoi -n 3' ```

_really_ frequently, because often the top answer wasn't what I needed.

------
butz
What is the most harmless question that might result in rm -rf ?

------
rambojazz
Where is the information/data retrieved from?

~~~
superasn
It searches google and prioritizes results from askubuntu, stackexchange and
stackoverflow

------
rosstex
bash-3.2$ howdoi "delete my root directory? Hypothetically speaking of course"

~~~
saagarjha

      bash-3.2$ $(howdoi "delete my root directory? Hypothetically speaking of course")

~~~
filterfish
Do it, do it! Though I think you need sudo in front of it :-)

------
gitgud
Reminds me of the tool "tldr"

[https://github.com/tldr-pages/tldr-node-client](https://github.com/tldr-
pages/tldr-node-client)

Let's you lookup easy to read Docs of any Linux command.

------
johnklos
No source, huh? And all the world's an x86, I suppose. Why would anyone want
to put a closed binary on their systems?

~~~
vengefulduck
It looks like a shell script have you actually opened the file?

