Skip to main content

Posts

Showing posts with the label terminal

my bashrc file for linux terminal

#####################################################################                                                 Start of code ##################################################################### # # ~/.bashrc # # If not running interactively, don't do anything #[[ $- != *i* ]] && return #alias ls='ls --color=auto' #PS1='[\u@\h \W]\$ ' ################################################################# ################################################################# #self added ################################################################# #for sudo work for auto completion if [ "$PS1" ]; then complete -cf sudo fi # set up to use vi command editing mode set -o vi #Allows you to cd into directory by typing the directory name shopt -s autocd ################################################################# # ...

How to set up your shell to use vi command editing mode in Terminal

Most shells that have a command line editing feature support Emacs key bindings. (a tiny subset) Up Ctrl + P Down Ctrl + N Left Ctrl + B Right Ctrl + F Home Ctrl + A End Ctrl + E Delete Ctrl + D Alternatively, you could set up your shell to use vi command editing mode, by adding   set -o vi to your shell startup file (e.g., ~/.bashrc ).  Then, for example, you can Use Esc  k  Enter to re-execute the previous command (same as !! ).  The minus key - also works as a "move up" command. Use Esc  k  k  k  k  k  k  k  k  k  k  k   k Enter or Esc  1 2  k  Enter to re-execute the 12th previous command (same as !-12 ). Use Esc and a motion command (i.e., k , suitably repeated), and then edit the bash command line you find there.  Remember, you will still be in vi command mode, so you will need to use a vi editing command (e.g., I...

Random Posts