A Useful Thing in Bash
coderwall.com
coderwall.com
Along the same lines of the article, these things have served me well:
This one is great for just getting the quick commands to help you get around the command line more efficiently
https://readline.kablamo.org/emacs.html
This one gives you all the exhaustive options around how you can tweak readline via your inputrc file
https://linux.die.net/man/3/readline
Its sounds really dumb, but after getting to know the bash and readline man pages I have stopped using fish and zsh and just started using more vanilla bash and built in linux tools and its been fantastic. I don't feel like I have lost any productivity and my terminal is a lot more responsive.
https://tiswww.case.edu/php/chet/readline/rluserman.html - GNU Readline User Interface (info rluserman)
https://tiswww.case.edu/php/chet/readline/readline.html - The GNU Readline Library (info readline, long-form equivalent to the readline(3) man page)
Why these are hidden away on some random .edu web site rather than being under gnu.org... -\_:/_/-
(OK, to be fair it's on the official GNU Readline web page, but why _that_ isn't on gnu.org is the real source of my shrug!)
The Bash manual also includes a brief summary of readline usage (I guess they too didn't know where to find Readline's official documenation) and can be read at https://www.gnu.org/software/bash/manual/html_node/Readline-... or info '(bash)Readline'.
If you put it in ~/.inputrc, you will get vi mode in all tools/shells which are using Readline like mysql, rlwrap, psql...
https://github.com/pkrumins/bash-vi-editing-mode-cheat-sheet...
Edit: nevermind:
> # To install useful key bindings and fuzzy completion:
> $(brew --prefix)/opt/fzf/install
I started using it when it was known as Ridiculous Fish, circa 2009-2010, and I've never looked back. I also learned ways of moving around the shell with Readline commands, but I cannot really attribute that to fish; I think I did that on bash/zsh as well.
I don’t have too many functions, so I cannot really say which one is really better as far as scripting goes, but with enough aliases and fish built-in functionalities, you’re pretty much set.
Does anyone know if there's an equivalent of Bash's `(...)` (without '$') in fish? What about anonymous pipes `<(...)` and `>(...)`?
sjl at alephnull in ~/scratch/tmp
><((°> diff -U0 (ls -1 | psub) (ls -1 | grep -v foo | psub)
--- /tmp/.psub.cIcXKeQj3O 2019-10-10 10:21:58.940444840 -0400
+++ /tmp/.psub.7W6mBnxcQD 2019-10-10 10:21:58.952444799 -0400
@@ -3 +2,0 @@
-fooedit: not sure if it does out of the box actually, i use prezto
There's a plugin for zsh which implements the same behaviour (this is what I'm using now):
zsh: https://unix.stackexchange.com/questions/16101/zsh-search-hi...
That said, I did just install the history-search-backward and history-search-forward hooks in inputrc, and I can already tell I'll love these.
(i almost always need it for stuff i typed several sessions ago)
> $ complex command here # tagHere
Later use the tag with ctrl+r
I do this all the time
tagging with # comment is also a nice trick
Just an anecdote though.
"\C-d": unix-filename-rubout
this allows me to delete complete filenames to the left of the cursor.. by default, you have Ctrl+w that deletes till whitespace and Esc+backspace that deletes words, but what I want most of the time is deleting filename set echo-control-characters off
this is occasionally useful for my workflow, when I use Ctrl+c to abort currently typed command, I do not like the control character mangling the command in case I wish to copy paste that command againI tried binding the arrow keys first, but it turns out I sometimes give up in the middle of writing a command in favor of reusing one from recent history, for which I need the original arrow bindings.
Thanks for the tip, but would it work also with ksh ?
Edit : ok just saw it is actually a readline functionality.
https://github.com/kbd/setup/blob/2e61b4d22adfadd05dbb4a7b95...