Live data from Hacker News

Show HN: Oh-heck, a terminal command for when you forget other terminal commands

oh-heck.dev

41–50 of 132 posts

Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands

#42
post #30
post #18

Some 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

I'm aware of apropos, but I usually forget how the command is named. edit: I forget how apropos is named.

I 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

Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands

#43
I 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.

Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands

#45

Hey 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.

[deleted]

Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands

#46

I 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 sim…

Thank 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.

Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands

#47
post #30

Earlier quoted context omitted.

I'm aware of apropos, but I usually forget how the command is named. edit: I forget how apropos is named.

I 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.…

Ohh 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.

Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands

#48

I 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 sim…

You 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

In particular, shell key bindings for fzf: https://github.com/junegunn/fzf#key-bindings-for-command-lin...

Post reply on HN