Useful shell shortcuts

Here are some useful shell shortcuts that you can use to make your life easier:

CTRL+A - move to beginning of line
CTRL+E - move to the end of the line
CTRL+B - move backward
CTRL+F - move forward
CTRL+D - delete character under cursor
CTRL+K - deletes text from cursor to the end of line
CTRL+X+BACKSPACE - delete text from cursor to the beginning of the line
CTRL+T - exchange character under cursor with previous character
ESC+T - exchange two words before and under cursor
ESC+U - converts text from cursor to the end of the word to UPPERCASE
ESC+L - converts text from cursor to the end of the word to LOWERCASE
CTRL+X+CTRL+E - launch default editor
CTRL+L - Clears screen above current line
CTRL+W - Delete word from cursor position to the left
CTRL+R - Search through command history

Shell ANSI color codes

These are ANSI color codes

RS="\[\033[0m\]" # reset
HC="\[\033[1m\]" # hicolor
UL="\[\033[4m\]" # underline
INV="\[\033[7m\]" # inverse background and foreground
FBLK="\[\033[30m\]" # foreground black
FRED="\[\033[31m\]" # foreground red
FGRN="\[\033[32m\]" # foreground green
FYEL="\[\033[33m\]" # foreground yellow
FBLE="\[\033[34m\]" # foreground blue
FMAG="\[\033[35m\]" # foreground magenta
FCYN="\[\033[36m\]" # foreground cyan
FWHT="\[\033[37m\]" # foreground white
BBLK="\[\033[40m\]" # background black
BRED="\[\033[41m\]" # background red
BGRN="\[\033[42m\]" # background green
BYEL="\[\033[43m\]" # background yellow
BBLE="\[\033[44m\]" # background blue
BMAG="\[\033[45m\]" # background magenta
BCYN="\[\033[46m\]" # background cyan
BWHT="\[\033[47m\]" # background white

Enable shell colored prompt on Ubuntu / Debian

Look at your home directory and the file .bashrc. Find these lines:

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
Uncomment force_color_prompt=yes, save and login again.

Continue reading “Enable shell colored prompt on Ubuntu / Debian”