[Linux Bash Shell] custom bind keys

Linux Command & Tools

Shell short keys :

https://www.gnu.org/software/bash/manual/html_node/Bindable-Readline-Commands.html#Bindable-Readline-Commands

https://ss64.com/bash/syntax-keyboard.html

We can use bind command to set the short keys in Bash environment.

dump short keys :


$ bind -p

set short keys from file


$ bind -f {key map file}

set short key directly


$ bind '"\C-p": shell-backward-kill-word'

How to know the key code ? we can use “read” to capture it 


# I press MAC's keyboard "command" + "right arrow key"

$ read
^[^[[D .

note:  ^[  is map to \e in bind command

MAC control code mapping 


\C : Control

\e : Optional

My preferred bind keys


# custum
"\ea": shell-backward-kill-word # Ctrl + a
"\es": shell-kill-word # Ctrl + s
"\e\e[C": forward-word  # Ctrl + right arrow key
"\e\e[D": backward-word # Ctrl + left arrow key

 

Linux Command & Tools
[tmux] installation – tarball and configuration

Previously, I was a screen user, it helped me to open multiple sessions and windows to manage lots of Linux servers. But, its window split feature is not pretty friendly, so, that’s why I started using tmux. Info tmux gitrepo – https://github.com/tmux/tmux tmux packages – https://github.com/tmux/tmux/releases ( you may download favorite version here …

Linux Command & Tools
OpenSSl Useful Commands

Check SSL Certificate dates # check site $ echo | openssl s_client -servername localhost -connect localhost:443 2>/dev/null | openssl x509 -noout -dates # check file $  sudo openssl x509 -dates -noout -in ./server.crt $  sudo openssl x509 -dates -noout -in ./server.pem Check SSL Certificate expired # result 0 : not expired # …

Linux Command & Tools
[Linux Commands] How to listen a port via command line to handle http request

NC $ while true; do echo 'HTTP/1.1 200 OK' | nc -l 8080; sleep 0.5; done GET / HTTP/1.1 User-Agent: curl/7.33.0 Host: localhost:8080 Accept: */* $ curl http://localhost:8080 -v * Rebuilt URL to: http://localhost:8080/ * About to connect() to localhost port 8080 (#0) * Trying 127.0.0.1… * Adding handle: conn: …