And 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
Show HN: Oh-heck, a terminal command for when you forget other terminal commands
41–50 of 132 posts
Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands
#42Some 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.
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.
Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands
#43Simply, 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
#44Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands
#45Hey 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.
Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands
#46I 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…
Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands
#47Earlier 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.…
Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands
#48I 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…
Link: https://github.com/junegunn/fzf
In particular, shell key bindings for fzf: https://github.com/junegunn/fzf#key-bindings-for-command-lin...
Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands
#49Re: Show HN: Oh-heck, a terminal command for when you forget other terminal commands
#50Most frequently, it looks up the first stackoverflow answer and prints it.