Linux: Some Useful Tips for the Command Line

Tips for bashThis is small collection of tips for the command line. The Linux default command line is bash. These tips mostly refers to bash. Actually are these commands, I’d like to use more often, but forget about it regularly. Especially the first one, searching the bash_history is extremely helpful.

  • <Ctrl+R>

    Searchs in the history of your command line

  • export HISTSIZE=1000

    doubles your default history size of 500

  • export HISTCONTROL=ignoreboth

    do not repeat commands, which are equal.

  • <Ctrl+U>

    Kills text before your cursor in the command line

  • <Ctrl+K>

    Kills text after your cursor in the command line

  • xmodemap -e "remove lock = Caps Lock"

    disables the Caps Lock key. This command needs a display (running X server)

  • loadkey TODO

    FIXME same for usage without an X-server

  • <Esc>+v in the editor vi

    Its vi’s visual mode. Hit ‘v’ and select text, the way you are used to select text e.g. with notepad. Now you can copy it with ‘y’ and ‘p’, or indent the selected section by pressing ‘>’ or ‘<‘

  • screen

    Extremely usefull if using ssh in a console. Why using a single session. Create as may sessions in one tty as you like. Just hit Ctrl+a;c on your keyboard. Invoke ‘screen’ first.

    • Ctrl+a ; c
    • creates a new session

    • Ctrl+a ; Space
      Switchs between the last two sessions
    • Ctrl+a; d
      detach screen
    • screen -RRD
      reattach with full force (if all other fails)
    • byobu
      if you want wo pimp your screen with additional information in a nifty pannel, use byobu (default Ubuntu) – it’s a must have!