From c3a29f735aaedd0ce4505085c393066892b700c8 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 9 May 2022 17:18:39 +0200 Subject: [PATCH 1/2] vi edit mode Signed-off-by: Unknown --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 4ab8425..21c8b62 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Bash-Oneliner + I am glad that you are here! I was working on bioinformatics a few years ago and was amazed by those single-word bash commands which are much faster than my dull scripts, time saved through learning command-line shortcuts and scripting. Recent years I am working on cloud computing and I keep recording those useful commands here. Not all of them is oneliner, but i put effort on making them brief and swift. I am mainly using Ubuntu, Amazon Linux, RedHat, Linux Mint, Mac and CentOS, sorry if the commands don't work on your system. This blog will focus on simple bash commands for parsing data and Linux system maintenance that i acquired from work and LPIC exam. I apologize that there are no detailed citation for all the commands, but they are probably from dear Google and Stack Overflow. @@ -59,6 +60,29 @@ Esc + l Esc + c # converts letter under the cursor to uppercase, rest of the word to lowercase. ``` + +##### Bash commands vi mode +```bash +set -o vi +# change bash command mode to vi +ESC +# change to vi edit mode (when set -o vi is set) +k +# in vi edit mode - previous command +j +# in vi edit mode - next command +0 +# in vi edit mode - beginning of the command +R +# in vi edit mode - replace current characters of command +w +# in vi edit mode - next word +b +# in vi edit mode - previous word +v +# in vi edit mode - edit current command in vi +``` + ##### Run history number (e.g. 53) ```bash !53 From a59f19e9cf1da4669be3f3802f7bb80a509cc3a1 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 9 May 2022 20:10:51 +0200 Subject: [PATCH 2/2] [ vi ] readline vi mode Signed-off-by: Unknown --- README.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 21c8b62..7a0e4a6 100644 --- a/README.md +++ b/README.md @@ -68,19 +68,23 @@ set -o vi ESC # change to vi edit mode (when set -o vi is set) k -# in vi edit mode - previous command +# in vi edit mode - go back to 3 previous words j # in vi edit mode - next command 0 # in vi edit mode - beginning of the command R # in vi edit mode - replace current characters of command -w -# in vi edit mode - next word +2w +# in vi edit mode - next to 2nd word b # in vi edit mode - previous word +i +# in vi edit mode - go to insert mode v # in vi edit mode - edit current command in vi +man 3 readline +# man page for complete readline mapping ``` ##### Run history number (e.g. 53)