S
SED (Stream Editor)
Options
Remove Ending Spaces (up to 5) and word in the end of each line of a file
Change hostname
Prepend text to a file
# cat testfile
line 1
line 2
line 1
line 3
# sed -i '1s/^/line 0\n/' testfile
# cat testfile
line 0
line 1
line 2
line 1
line 3
# vi testfile
# sed -i '2s/^/line -1\n/' testfile
# cat testfile
line 0
line -1
line 1
line 2
line 3
line 4
# sed -i '3s/^/line -2\n/' testfile
# cat testfile
line 0
line -1
line -2
line 1
line 2
line 3
line 4Insert a line in the middle
Delete a line
Combine multiple lines to one line
Print /Start/ /End/
Print /Start/ /End of file/
Replace text in all file in a folder
Using -print0 in find command
Exclude a directory
Reference
Shift - Shift positional parameters
Shutdown
SSH
Login using ID Key file
Port Forwarding
Local Port Forwarding
Remote Port Forwarding
Dynamic Forwarding
Add port forwarding to existing ssh session
Supported escape sequences:
List background jobs and jump between ssh sessions:
List forwarded connections/ports
Using config file
SSH-Agent and Agent Forwarding
Adding Private Key to Memory:
Example
Another way to add key to agent:
ProxyJump and ProxyCommand
X11 Forwarding
Some Errors
Too many authentication failure
SSH-Keygen
SSH-Keyscan
Reference
https://www.howtoforge.com/reverse-ssh-tunneling https://www.revsys.com/writings/quicktips/ssh-tunnel.html https://vimeo.com/54505525 http://blog.pi3g.com/2013/05/raspberry-pi-socks-5-proxy-server-aka-browse-the-web-with-an-ip-from-a-different-country/ https://www.digitalocean.com/community/tutorials/how-to-route-web-traffic-securely-without-a-vpn-using-a-socks-tunnel
Sudo and Visudo
Edit sudo configuration
Sample configuration
Commands
Last updated