General notes that I may need in future and I don’t know where to put them in Notes.app 📝
Shell Commands
ZSH (oh-my-zsh)
- cd to history
$ dirs -v $ cd -<TAB>
SSH
- show ssh key fingerprint:
$ ssh-keygen -lf .ssh/id_rsa.pub
- generate keys:
$ ssh-keygen -f ~/keyfile -t ecdsa -b 521
SHELL/BASH
- add prefix to the beginning of a line
# If you want to edit the file in-place $ sed -i -e 's/^/prefix/' file # If you want to create a new file $ sed -e 's/^/prefix/' file > file.new
- read file by line
while IFS= read -r line do # script done < file.txt
- grep and display only requested string/regex
$ grep -Po 'Your support ID is: [0-9]+'
Makefile
- basic syntax:
build: <TAB>command <EMPTY LINE>
- to check whether the TAB are correctly set
cat -e -t -v makefile_name
VIM
- Integrate with system clipboard:
- copy selected part: visually select text(type v or V in normal mode) and type
:w !pbcopy
- copy the whole file
:%w !pbcopy
- paste from the clipboard
:r !pbpaste
- copy selected part: visually select text(type v or V in normal mode) and type
cURL
- resolve a hostname to custom IP:
$ curl --resolve lubos.klokner.sk:443:127.0.0.1 https://lubos.klokner.sk/
- do not check the certificate:
$ curl -k https://lubos.klokner.sk/
- read data from a file
# file.txt: param1=value1¶m2=value2 $ curl -G 'http://example.com/' -d @file.txt $ curl -G 'http://example.com/' --data-urlencode @file.txt
VSCODE
- Multi-Line editing: command + fn + f2
- Duplicate lines of code in both directions: shift + alt + arrow up/down
- Move line: alt + arrow up/down
macOS
VMware Fusion
- Fix networking issues:
$ sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --stop $ sudo /Applications/VMware\ Fusion.app/Contents/Library/vmnet-cli --start
Networking
- Allow packet forwarding
$ sudo sysctl -w net.inet.ip.forwarding=1
Docker
Markup Cheat Sheet
F5 BIG-IP
- tcpdump:
$ tcpdump -vvv -nni 0.0:nnn "(host [client_ip] and host [VS_ip]) or host [pool_member_ip]" -s0 -w /var/tmp/case_description.pcap
- license from CLI:
$ get_dossier -b "base key" -a "actkey1,actkey2" # goto -> https://activate.f5.com & paste the dossier here # copy the license from the webpage $ cat - > /config/bigip.license # CTRL + D $ reloadlic
- reset to factory defaults (v13.0+):
# tmsh load /sys config default # tmsh save /sys config partitions all