Skip to content

Instantly share code, notes, and snippets.

@JuanRamino
Last active April 14, 2021 14:17
Show Gist options
  • Select an option

  • Save JuanRamino/dae92080689209ce41b5bee255d23561 to your computer and use it in GitHub Desktop.

Select an option

Save JuanRamino/dae92080689209ce41b5bee255d23561 to your computer and use it in GitHub Desktop.
command line ninja

Ctrl+

  • Ctrl+U : This clears the entire line so you can type in a completely new command.
  • Ctrl+K : This deletes the line from the position of the cursor to the end of the line.
  • Ctrl+W : This deletes the word before the cursor only.
  • Ctrl+R : This lets you search your command history for something specific. another press to browse in history
  • Ctrl+A : Go to beggining of line
  • Ctrl+E : Go to end of line
  • Ctrl+L : clear the screen
  • Ctrl+S : stops output to screen
  • Ctrl+Q : resume output to screen

Process

  • Ctrl+C : sends an INT signal. Causes the process to terminate
  • Ctrl+Z : sends a TSTP signal. Causes the process to suspend execution
  • Ctrl+T : sends an INFO signal. Causes the operating system to show information about the running command
  • Ctrl+\ : sends a QUIT signal. Causes the process to terminate and dump core

Other tricks

  • cd - : This will move you back to your last working directory:
  • !! : represent the last command you ran. Ex: sudo !!
  • !cat : run the last command that used cat
  • !cat:p : see what the last cat command was
  • !$ : represents the arguments from your last command. Ex: mkdir /new/folder && cd !$
  • cat $(which rm): cat the result of which rm
  • mv /path/to/file.txt /path/to/file.xml == mv /path/to/file.{txt,xml}
  • cp /etc/rc.conf{,-old} == cp /etc/rc.conf /etc/rc.conf-old
  • mv /etc/rc.conf{-old,} == mv /etc/rc.conf-old /etc/rc.conf
  • mkdir myfolder{1,2,3} == mkdir myfolder1 && mkdir myfolder2 && mkdir myfolder3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment