13 ms·
Show HN: Oh-heck, a terminal command for when you forget other terminal commands
- MD87 5y agoSo the "Terms of Service & Privacy" link doesn't work, and apparently it's a paid subscription service but you don't find that out until you've signed up and tried activating an API key? I'm sure these are just oversights but it leaves a very bad taste in my mouth!
- mikestew 5y agoI’ll save some clicking: $4/month. But, yeah, not idea what TOS or privacy policy is.
- kps 5y agooh-heck "Bring up the network interface. Goddamit Linux where did ifconfig go? Why do you have to NIH everything?"
- moltke 5y agobusybox still has a simplified ifconfig.
- 411111111111111 5y agoTbf, 'ip addr' is even easier to remember as far as I'm concerned
- sleepyxuras91 5y ago'ip a' works too
- zwayhowder 5y agoI was so happy when I discovered this. As a UNIX and Linux user for my entire career I was so surprised that something built into every Cisco, Juniper, Arista etc etc network device wasn't built into many cli tools on Linux. I know I can create aliases and whatnot, but I'm a consultant, when I was still hands on with the tools I'd log into 30+ different customer's environments every year. Many were isolated from the Internet and whilst I did carry my dotfiles around on a USB (Along with some binaries of useful tools that are so often lacking on enterprise systems) I couldn't always use them.
- pmarreck 5y agoHow would one add this if it's missing?
- nvr219 5y agoI aliased ifconfig to this: echo "Local IPs: " ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}' systemd-resolve --status | grep -A 2 Servers | sed 's/\ //g' ip route show curl --silent ipinfo.io | grep -E '\"ip|hostname|city' | sed 's/\"//g' Hope this helps
- coreyog 5y agoIt's not even that the "Terms of Service & Privacy" link doesn't work, it's that it's not even a link. It's a div that sorta behaves like a link. Shady af.
- zelienople 5y agoYou need to make an account and then you find out you have to put in a credit card just to try it out? Oh, heck, go fuck yourself with a sharp cactus!
- MikeDaniel 5y agoHey guys, I've created a really small tool that converts natural language into terminal commands using GPT3. To my chagrin, I seem to have a pathological inability to remember commands so I'm hoping this may help others suffering from such a terrible affliction.
- jimbokun 5y agoThis is fascinating. Is the input to oh-heck the complete GPT-3 prompt. Or is there something else added to it before sending to GPT-3? Is there any specific training used for this task? Or just off the shelf GPT-3?
- MikeDaniel 5y agoYea, it's not the full prompt, I've been gradually training it over the last couple of weeks. It still needs work though as it's quite rudimentary at the moment. Something I intend to focus on going forward.
- deleted 5y ago[deleted]
- pmarreck 5y agoWhen I first read this comment I assumed it was someone sarcastically pretending to be the creator and not the actual creator, and I thought, what a dick... LOL Looks neat! I've already been using github copilot which I've found brings some more joy into coding (even when it's a little off).
- brundolf 5y agoI would actually be interested in trying this out, but the things pointed out here have got me holding off for now: https://news.ycombinator.com/item?id=30721983 https://news.ycombinator.com/item?id=30721983 Might be worth giving the website/messaging a once-over
- ape4 5y agoPretty cool. A small detail, I'd prefer if the command was shorter.
- yosito 5y agoThis looks like a fun idea. I'm curious, is GPT3 used to generate the commands, or only to parse the input? I'd personally be very wary to use any GPT3 generated command since there's no guarantee that it wouldn't be destructive.
- jimbokun 5y agoLooks like it just generates the command and copies it to the clipboard, so you can verify it's really what you want before executing it.
- imglorp 5y agoAnd here's a command that tries to fix up a mistake after you type it. Like this one, it's also named like what you might say afterwards. https://github.com/nvbn/thefuck https://github.com/nvbn/thefuck
- frx 5y agoI was just about to share this. I use this daily and this magnificent tool is really helpful.
- deleted 5y ago[deleted]
- deleted 5y ago[deleted]
- wffurr 5y agoefb
- bitbatbangboo 5y agoaliased as 'duck' to be work-friendly
- thiht 5y agoWhere do you work that anyone would care you use a command called « fuck »?
- matyasrichter 5y agoDamn, imagine working at a place where at the end of each day, the management goes through your shell history and includes it in a "performance review".
- imglorp 5y agoOr you're giving a live demo in a terminal to the bosses and you mistype a command, then your fingers slip by habit...
- earthboundkid 5y agoI think these ML systems make for pretty good search engines. They're still bad at creating original coherent texts though.
- amelius 5y agoThis used to be called "man".
- npongratz 5y agoAgreed, especially when preceded by "apropos".
- _wldu 5y agoapropos first then man second.
- Maursault 5y ago/usr/bin/which also is somehow useful
- hk__2 5y ago`man` is when you know the command but don’t remember how to use it. When you don’t know/remember the command things get harder.
- OJFord 5y ago`man -k` searches the short descriptions. (See `man man`!)
- unixbane 5y agoalso info nobody knows enough from reading manuals for UN*X because it is too hard. everyone I talk to who says they have done it are still missing fundamental info, like for instance any one i talk to will probably not undersand that sudo is insecure for 99% of use cases and start crying when i explain to them that you can just use ptrace to capture the password or replace some bash envars to hijack the command. nobody knows how to declare a variable in a signal handler (see signal handling for fun and profit), because there is no comprehensive overview of C called "stuff you should know before actually programming in this". the problem with trying to learn a UN*X system from within is that everything is scattered everywhere, and there is no comprehensive overview of any part of the system (they try to make some, but they are always missing something important, or dont mention how this would work in the context of a practical system where other subsystems change the behavior and requirements of this one), and the parts which take too long for anyone with a life to learn are always changing, like in linux ip tools, iptables/whatever alternative, and PAM, init (init is hard because you have to learn about how to manage environment and session properly which involves some tens of pages of man pages enumerating subtle details) systemd, pulseaudio. every tool has its own DSL for the trivial task of accepting parameters and parsing configs. to use apropos you first have to setup some database thing (yeah i dont remember). learning C libs from the man pages is a perfect example. to do trivial stuff requires some hours of reading every day, and when you come back to use those functions again you will not remember most of them and have to look them up again, and they are: - full of irrelevant info, the "BUGS" section, the "examples" section, conformance issues (which are not something you have in other languages' libraries), - unneeded "this and that is UB" followed 5 minutes later by realizing 5 other things they did not write about is UB followed by philisophical pondering about why they list one UB when you still need to think for yourself to know what is actually UB, etc. - 10 different ERRNOs. you need to read all of them in case there is some fundamental info listed there and not elsewhere in the man page you are reading - some wacky crap like sockaddr_t with casting or an integer split across two parameters (btw socket programming in itself is its own clusterfuck to learn from man pages alone. yes i have done it on one foray into socket programming) which is why C is not suited for general purpose programming - it has too many edge cases for anyone but the most very strict programmers (most of whom consider themselves to be so are in fact not) who already worked on 3 big programs. you cannot use this for 10s of thousands of lines of CRUD like what gnome or whatever does. the average open source UN*X C program is a buggy mess. then there's also the problem that you can't do anything in UN*X without learning at least 5 different programming languages. this also means you will not have rigid understandings of them all and make common easy to spot bugs. or you can spend hours a day reading about every expression you will invoke and get fired. one time i had to setup a secure system with some C glue code involving a socket. it took 2 or 3 days to be somewhat sure i am not invoking some kind of UB in this 100 lines of code and that all my file semantics (permissions, timings) were right (also another source of huge complexity for something that should be trivial). UN*X is a pyramid scheme. whenever you complain about it, someone will say "you're just not man enough to have learned it properly". no matter what you do there will always be this theoretical case of someone more manly than you who has succeeded in UN*X (whatever that means). go try again for another 2 years. of course this is all nonsense, as the averge joe dev or sysadmin in the industry does everything laughably wrong unless there is a meme circulating about how to avoid problem #3527. did i explain this enough yet? UN*X is an absolute clusterfuck. its not coherently designed in any way what so ever. to set screen blanking parameters on linux, you write some text to the terminal. this is therefore considered """UN*Xy""", because it has something to do with 2 of their major fetishes. this is the level of insanity that is considered normal. tl;dr you simply cannot learn a UN*X system sufficiently to be able to have a grounded understanding of it as well as being a productive person. perhaps you can dedicate your life to creating a JSON parser after you graduate UN*X and then die of old age.
- hk__2 5y agoLooks nice; how does it work under the hood? It looks like it needs an API key, so does that mean it sends all my inputs to some server? Does it taylor the answer based on your OS, like using Hombrew on Mac and apt on Ubuntu? Can it work offline?
- MikeDaniel 5y agoSo it's using the GPT-3 API, so yes, don't send anything sensitive! It doesn't taylor it based on your OS but that's actually a really neat idea, something I'll look to add. For now though, you can just write "how do I x on mac?" and it should work.
- _wldu 5y agoSome people seem to be unaware of apropos too (old text based cli tool). $ apropos network interfaces (5) - network interface configuration for ifup and ifdown aseqnet (1) - ALSA sequencer connectors over network byteorder (3) - convert values between host and network byte order ctstat (8) - unified linux network statistics
- pricci 5y agoI'm aware of apropos, but I usually forget how the command is named. edit: I forget how apropos is named.
- kroltan 5y agoalias halp=apropos
- paskozdilar 5y agoWhich is exactly the use case for apropos, which searches "the manual page names and descriptions"[0] for whatever term you've entered. [0] https://man7.org/linux/man-pages/man1/apropos.1.html https://man7.org/linux/man-pages/man1/apropos.1.html
- RobertMiller 5y agoI used to have a hard time remembering apropos because I assumed 'apropos' was some sort of unixy mincing of another word or abbreviation or something, and I couldn't figure out what it meant. You know, like 'mkdir' means "MaKe DIRectory" But it turns out apropos is just a regular word. Once I learned this, I haven't had any more trouble with it. apropos : Of an appropriate or pertinent nature. https://en.wiktionary.org/wiki/apropos https://en.wiktionary.org/wiki/apropos
- zfxfr 5y agoOhh I always thought "apropos" was from the French expression "à propos (de)... " which means "about". I naïvely believed that the person who coded this command must be French.
- fooblat 5y agoAm I crazy to think that a tool like this is an accident waiting to happen? I'm assuming that this tool is for people who aren't familiar with the system enough to get what they need from the man pages and would rather not invest the time to become deeper on it. If you don't remember the command you need to use, how can you be sure it is the correct command and options before you run it? edit: typo
- hk__2 5y ago> If you don't remember the command you need to use, how can you be sure it is the correct command and options before you run it? It asks you for confirmation before running it.
- deleted 5y ago[deleted]
- kuu 5y agoIt shows you the command and allows you to copy it on the clipboard. It's never going to execute it. For me it is useful more like a refreshing your memory than doing the actual work, therefore you need to know what you're doing from previous knowledge. On the other hand if you are doing something dangerous or risky or you don't understand the suggested command, maybe you shouldn't use this tool without searching more info first.
- nobody9999 5y ago>It shows you the command and allows you to copy it on the clipboard. It's never going to execute it. For me it is useful more like a refreshing your memory than doing the actual work, therefore you need to know what you're doing from previous knowledge. That sounds suspciously like smitty[0]. Which was a useful tool when I was learning AIX. I'd expect a similar tool could be useful for learning other systems too. [0] https://developer.ibm.com/articles/au-smit/ https://developer.ibm.com/articles/au-smit/
- spicybright 5y ago
- leetrout 5y agoRelated tools: TLDR community managed man pages https://tldr.sh/ https://tldr.sh/ Cheat Sheet access to community driven docs http://cht.sh/ http://cht.sh/ Bro pages (like TLDR, but without the great name) http://bropages.org/ http://bropages.org/
- deleted 5y ago[deleted]
- whartung 5y agoI have a simpler solution. The use case is not precisely the same, but for many scenarios, it's effectively the same. Simply, like many, I have bash set up to record commands in .bash_history. I have it flush all the time, so .bash_history is always current. # keep persistent bash history across sessions export PROMPT_COMMAND='history -a;history -n' export HISTCONTROL=ignoredups shopt -s histappend Next, I have a simple cron job running every minute. file=/tmp/work.$$ cat ~/.bash_history ~/.unique_bash | grep -v findcmd | sort -u > $file mv $file ~/.unique_bash Then, I have a script called "findcmd" that simply greps my .unique_bash file. for var in "$@" do cmd="| grep \"$var\" $cmd" done cmd="cat ~/.unique_bash $cmd" eval $cmd In the end, when I need to figure something out, I head to the internet. Those commands are then captured for posterity in the .unique_bash file. If I want to know how to post a JSON file to an endpoint using Curl, then $ findcmd curl json And all those curl commands show up. It won't let me do something I don't know, but it make my memory much, much longer. And, yea, I admit there have been instances where I've completely forgotten the command, and had to head back to the web. But when I've done that, I can hit my history and see how I used it. If, sometimes, a "bad command", a command done wrong, too many of the same thing, just lingers, I can go edit it out. But most of the time I don't bother.
- suifbwish 5y agoThank you! You just improved my workflow and that does not happen every day. A spin I think I might add is to output all commands that do not result in standard error to a separate history file. .bash_history_no_error or something like that.
- themulticaster 5y agoYou might enjoy the fzf (fuzzy finder) tool configured for your shell's history search keybinding (most likely Ctrl+R). I can't elaborate at the moment, but essentially you type Ctrl+R, start typing roughly what you want and fzf searches your shell history based on what you typed. It works extremely well for me. Based on what you described, fzf Ctrl+R should be your workflow on steroids. Link: https://github.com/junegunn/fzf https://github.com/junegunn/fzf In particular, shell key bindings for fzf: https://github.com/junegunn/fzf#key-bindings-for-command-line https://github.com/junegunn/fzf#key-bindings-for-command-lin...
- l30n4da5 5y agoi usually just put commands that I know I'm going to use again in a text file so I can reference them later.
- pmarreck 5y agothis fails to embody the 3 great virtues of a programmer
- rpmisms 5y agoYeah, but it's also practical, so who's really winning here?
- pmarreck 5y agoI don't know because I'm from the "if you need to write down multiple examples of how to use a command in order to move forward with it indefinitely, then it has an absolutely terrible UI and that is in fact the root problem you should be fixing" school of thought. I'm the kind of person that prefers wrapping commands with terrible UI in functions with much better UI though https://github.com/pmarreck/pac https://github.com/pmarreck/pac . Like who the fuck thought that "pacman -Syyu" (where the number of y's semantically changes the meaning) would be a great idea? An idiot, a sadist or an autist, that's who. Certainly not someone who actually cares about normal humans. In my opinion, instead of writing all these helper or cheatsheet functions as constant reminders of how bad the TUI (text user interface) is on these commands, someone should release a library of wrappers that wraps all of these turds (I'm sorry, "diamonds in the rough") in sensible and consistent TUI with consistent option formats, autocompletes, maybe some inline documentation while you type the command, etc. And then we wouldn't need all these band-aid tools. I can say as an Arch fan but pacman command-tool despiser (did I mention that it doesn't at all try to stop you from easily breaking your dependency structure JUST in order to support some very corner use-cases?), prior to writing pac I was "man pacman"'ing for months, and after I finished it I haven't needed to do that EVER. (Yet.) The "ip" command is an example of one I'd say has a good TUI.
- allurbase 5y agocompgen -c
- david_draco 5y agohowdoi works great: https://github.com/gleitz/howdoi https://github.com/gleitz/howdoi Most frequently, it looks up the first stackoverflow answer and prints it.
- caboteria 5y ago> But, Mike! What happens if I can't remember the oh-heck commands? > Well, first, calm yourself, you fool. Once you've regained your composure, just type `oh-heck` into Terminal and follow the steps you numbskull. I think that they're trying to be clever, but I prefer to not be insulted by my tools.
- stavros 5y agoI like it when it's done well (maybe in an underhanded manner) but that was facile.
- chockchocschoir 5y agoPersonally I like getting insulted by my tools. I always put `Defaults insults` in my /etc/sudoers file so every time I enter the wrong password, I get insulted. I wish more tools supported this. I think computing in general is fun, and wish more tools had fun things like this. $ sudo whoami [sudo] password for user: Your mother was a hamster and your father smelt of elderberries! [sudo] password for user: Your mind just hasn't been the same since the electro-shock, has it? [sudo] password for user: sudo: 3 incorrect password attempts
- kiddico 5y agoI didn't know about that! yeah, that's going to be a new personal standard practice.
- zwayhowder 5y agoTIL. Reminds me of the days installing sl on FreeBSD servers. Someone typos the most common and basic of commands and they watch a steam locomotive journey across their screen. It even has different versions based on common ls switches. And I just found it's still available. https://www.cyberciti.biz/tips/displays-animations-when-accidentally-you-type-sl-instead-of-ls.html https://www.cyberciti.biz/tips/displays-animations-when-acci...
- Coryodaniel 5y agoThis is awesome, can’t wait to try it out. Does it handle questions that would result in piping commands together like “how do I get the third element in a JSON response from a curl command?” This will be a great command alongside “fuck” https://github.com/nvbn/thefuck https://github.com/nvbn/thefuck
- anotherhue 5y agoMcFly uses either a neural net or fzf along with sqlite and clever script hooks to do basically everything you may need: https://github.com/cantino/mcfly https://github.com/cantino/mcfly
- gnyman 5y agoWow, thanks for the tip! This looks really useful, I've been using fzf for a long time and it works well but this seems like a clear improvement to that
- pizza 5y agoI love tldr for this too https://github.com/tldr-pages/tldr https://github.com/tldr-pages/tldr
- zhte415 5y ago↑
- ho_schi 5y agoWait. Sending what you want to do to a webservice (GPT-3) doesn't sound clever?
- ineedasername 5y agoSome commands you might want to keep private oh-heck "is there a bash script I can use to hack the NSA?"
- rank0 5y agoThe quick demo looks pretty dope, but I am never gonna pay a subscription for a closed source token-identified cli tool. I would have paid a one time fee for a similar tool that doesn't phone home to check my api key every time I use it.
- smw 5y agoMy guess is that it's relying on openai calls to do the hard work, and thus someone has to pay for them. I believe that GPT-3, which this relies on, is not open source and probably not easy to run on your device.
- ineedasername 5y agoYep, if it uses GPT-3, that has to be the case: Microsoft announced on September 22, 2020, that it had licensed "exclusive" use of GPT-3; others can still use the public API to receive output, but only Microsoft has access to GPT-3's underlying model. https://en.wikipedia.org/wiki/GPT-3 https://en.wikipedia.org/wiki/GPT-3
- stavros 5y agoThis couldn't really run otherwise, sadly, as it uses GPT-3. I guess it could use a FOSS model, but you wouldn't want to run that locally.
- IngvarLynn 5y agoAll problems in software development can be solved by another level of indirection. Slow and buggy neural networks are especially suited for such a task.
- deleted 5y ago[deleted]
- tedmiston 5y agoI just make bash functions in my dotfiles for use cases like these, particularly good CLI arg combinations from Stack Overflow answers, etc. Example: # 2022-02-07 # because `poetry show --outdated` includes *all* packages (!), not just top-level dependencies function poetry-show-outdated { poetry show --outdated | grep --file=<(poetry show --tree | grep '^\w' | cut -d' ' -f1) } Or: function disk-usage-summary () { # output high-level disk usage stats set -x du --human-readable --summarize du --human-readable --max-depth=1 df --human-readable --total set +x }
- chockchocschoir 5y agoThat actually runs the commands right? How do you deal with commands that perform some action that maybe couldn't be reverted easily?
- tedmiston 5y agoCorrect. If I don't necessarily want to run all of the commands, I make a "do-nothing script" [1][2] that just echoes them out instead. I don't have a generalized example of undo / redo in bash commands, since I don't believe it's possible, but for example, if I'm running a destructive command, I prefer to run the dry run version first, then have a confirmation prompt [3] before running the destructive action. [1]: https://news.ycombinator.com/item?id=20495739 https://news.ycombinator.com/item?id=20495739 [2]: https://news.ycombinator.com/item?id=29083367 https://news.ycombinator.com/item?id=29083367 [3]: https://stackoverflow.com/q/1885525/149428 https://stackoverflow.com/q/1885525/149428
- jjwiseman 5y agoI think I'd rather have Github Copilot for the shell.
- bxclltkfz 5y ago
- WalterBright 5y agoI remember writing a Advent-like text adventure game (Advent inspired Zork). The natural language interface looked easy to write. Boy was I wrong. Using a specialized language for interacting with a computer is because NLP is so very hard.
- reality_inspctr 5y agoDude appears to be doxed fwiw. Led to finding this funny snippet in the 1992 ev_keymap.h file: #define NX_NUMKEYCODES 256 /* Highest key code is 0xff. ADB used to use 0x80 for keydown state, but who the heck uses adb anymore. */ https://en.wikipedia.org/wiki/Apple_Desktop_Bus https://en.wikipedia.org/wiki/Apple_Desktop_Bus
- qubitcoder 5y agoSlightly related is https://cheat.sh/ https://cheat.sh/ [0], which returns real-world examples of how to use a given command. The results are nicely formatted and color-coded. Give it a try in your terminal: curl https://cheat.sh/rsync I've found it to be really handy for things like awk, rsync, ssh, and others with byzantine parameters. Not to mention it's free. [0] https://github.com/chubin/cheat.sh https://github.com/chubin/cheat.sh
- ThinkBeat 5y agoman ?
- goplayoutside 5y agotldr.sh is a similar project. https://github.com/tldr-pages/tldr https://github.com/tldr-pages/tldr