Introduction
Shell Scripting
Rename suffix of mulitple files
# https://unix.stackexchange.com/questions/19654/how-do-i-change-the-extension-of-multiple-files
# Rename all *.txt to *.text
for f in *.txt; do
mv -- "$f" "${f%.txt}.text"
done
SSH
Include SSH config from multiple files
- Create SSH config folder, then add an example config
mkdir ~/.ssh/config.d/
touch ~/.ssh/config.d/example
- Edit
~/.ssh/config
Host *
ForwardAgent yes
ServerAliveInterval 120
ServerAliveCountMax 2
GSSAPIAuthentication no
Include config.d/*
Host production-1
HostName 127.0.0.1
User root
Port 22
- Edit
~/.ssh/config.d/example
, add example config contentHost production-2 HostName 127.0.0.1 User root Port 22
Get Public SSH Key from Private SSH Key
ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
ssh-keygen -l -f ~/.ssh/id_rsa
# https://blog.tinned-software.net/generate-public-ssh-key-from-private-ssh-key/
Change hostname
hostnamectl set-hostname name
OpenSSL
https://support.f5.com/csp/article/K11440
Ubuntu
https://linuxize.com/post/how-to-set-or-change-timezone-on-ubuntu-18-04/
Cronjob
# Restart machine every day
0 2 * * * root /sbin/shutdown -r +5
https://tecadmin.net/crontab-in-linux-with-20-examples-of-cron-schedule/
SELinux
https://linuxhint.com/how-to-disable-selinux-on-centos-7/
Find My Public IP from Command Line
dig +short myip.opendns.com @resolver1.opendns.com
curl ifconfig.co
curl ifconfig.me
https://www.cyberciti.biz/faq/how-to-find-my-public-ip-address-from-command-line-on-a-linux/
Is there a way for one SSH config file to include another one?
tcpdump
https://hackertarget.com/tcpdump-examples/
journalctl
https://unix.stackexchange.com/questions/225401/how-to-see-full-log-from-systemctl-status-service
Yum
How to restrict yum to install or upgrade a package to a fixed specific package version?
Clear Cache
How to Clear RAM Memory Cache, Buffer and Swap Space on Linux