Last Updated: February 25, 2016
·
1.003K
· evgenkorobkov

10 best bash command

Hello all!

  • Enter argument for last command.

ALT+. or ESC+

  • Reinitialize terminal, but end current session.

reset

  • Create empty file or delete content without delete file.

>file.txt

  • Not save command in history. Enter command with start space. For example: (space between tilda and command)

~ mysuperutil -u user -p secret

  • Start editor for edit big command or script, editor select from $EDITOR (change: "export EDITOR=nano" in ~/.bashrc)

CTRL+X E (press CTRL, press X, unpress X, press E, unpress CTRL)

  • Best util for test network. It's change ping and tranceroute.

mtr

  • Start last command with change substring. For example 'for' on 'bar'. If enter ^for then first find subsctring is delete.

^for^bar

  • Return last dir. Need for change direcory and return last dir.

cd -

For example:
➜  ~  cd code/edu
➜  edu  cd /etc/  
➜  /etc  cd -
~/code/edu
➜  edu  
  • Start HTTP-server in current directory on 8000 port if not exist file index.html, then return listing dir

python -m SimpleHTTPServer

  • Start last command under root (use sudo)

sudo !!

source