If you see it

Live for passion

Tricky Terminial Note

Copy from clipboard into file

  1. Copy the content
  2. Go to the terminal
1
2
$ pbpaste > test.py  
$ cat test.py

Misc:

1
2
3
4
$ cat test.txt | pbcopy # copy things to system clipboard
$ echo hello | pbcopy # same as above
$ pbcopy < test.txt # copy from a file, so you can use cmd + V
$ echo `pbpaste`  #you will see the content in the clipboard

[pbcopy] takes the standard input and places it in the specified pasteboard.

[pbpaste]removes the data from the pasteboard and writes it to the standard output.

iTerm2 tricks

  1. Autocomplete
    cmd" + ;
  2. Show clipboard history
    command+shift+h
  3. Enter/exit full screen (not for hotkey window)
    cmd + enter
  4. Search under all tab
    cmd + opt + e
  5. Search in the tab
    cmd + f
    cmd + g//next result
  6. Enable meta key Under iTerm 2 preference > profile > keys, set left option key acts as “+Esc”
    alt + b

Terminal shortcuts

cmd + u : delete till the start of line

cmd + k : delete till the end of line

Show files inside jar
jar tf file.jar

Comments