RSS
 

Posts Tagged ‘bash linux unix’

Bash

27 Oct

History

  • ! – Starts a history substitution.
  • !! – Refers to the last command.
  • !n – Refers to the n-th command line.
  • !-n – Refers to the current command line minus n.
  • !string – Refers to the most recent command starting with string.
  • !?string? – Refers to the most recent command containing string (the ending ? is optional).
  • ?string1?string2 – Quick substitution. Repeats the last command, replacing string1 with string2.
  • !# – Refers to the entire command line typed so far.

Keyboard Shortcuts

Ctrl

  • Ctrl + a – Jump to the start of the line
  • ”Ctrl + b – Move back a char”
  • Ctrl + c – Sends the signal SIGINT to the current task, which aborts and close it.
  • Ctrl + d – Delete
  • Ctrl + e – Jump to the end of the line
  • ”Ctrl + f – Move forward a char”
  • Ctrl + g – Escape from history searching mode
  • Ctrl + h – Backspace
  • Ctrl + i – Tab
  • Ctrl + j – Linefeed
  • Ctrl + k – Cut to the end of line
  • Ctrl + l – Clear the screen
  • Ctrl + m – Enter
  • ”Ctrl + n – Fetch the next command from the history list”
  • Ctrl + o – Executes the found command from research.
  • ”Ctrl + p – Fetch the previous command from the history list”
  • Ctrl + q – XON
  • Ctrl + r – Search the history backwards
  • Ctrl + s – XOFF
  • Ctrl + t – Swaps the order that the last two character appear in
  • Ctrl + u – Cut to the beginning of line
  • Ctrl + v – Do not interpret the next thing
  • Ctrl + w – Cut the word before the cursor
  • Ctrl + xx – Move between EOL and current cursor position
  • Ctrl + y – Adds the clipboard content from the cursor position.
  • Ctrl + z – sends the signal SIGTSTP to the current task, which suspends it.

Alt

  • Alt + < – Move to the first line in the history
  • Alt + > – Move to the last line in the history
  • Alt + ? – Show current completion list
  • Alt + * – Insert all possible completions
  • Alt + / – Attempt to complete filename
  • Alt + . – Yank last argument to previous command
  • Alt + b – Move backward
  • Alt + c – Capitalize the word
  • Alt + d – Delete word
  • Alt + f – Move forward
  • Alt + l – Make word lowercase
  • Alt + n – Search the history forwards non-incremental
  • Alt + p – Search the history backwards non-incremental
  • Alt + r – Recall command
  • Alt + t – Move words around
  • Alt + u – Make word uppercase
  • Alt + back-space – Delete backward from cursor

Tab

  • Here “2T” means Press TAB twice
  • 2T – All available commands(common)
  • (string)2T – All available commands starting with (string)
  • /2T – Entire directory structure including Hidden one
  • 2T – Only Sub Dirs inside including Hidden one
  • *2T – Only Sub Dirs inside without Hidden one
  • ~2T – All Present Users on system from “/etc/passwd”
  • $2T – All Sys variables
  • @2T – Entries from “/etc/hosts”

Reference

Tips

Reload .bashrc

source ~/.bashrc