Encryption
If you want to prevent reading your password in your script at first glance, you can use encryptwed passwords.
Create encrypted password
echo “password_to_set” | base64
Decrypt password
MYPASS=’echo “your_encrypted_password” | base64 –decode’
To see some login statistics.
Shows last logged in users details |
|
displays hostname in last column |
|
non-local logins |
|
Display the system shutdown entries and run level changes |
|
To display last shutdown date and time |
|
Who is Logged in |
|
find time of last system boot |
|
all login names and number of users logged on |
|
Reporting processors related statistics
mpstat -P cpu | ALL
Display a list of open sockets
netstat -tulpn | grep :80
netstat -ntlp | grep :8009
Remote port check
nc -z 10.178.29.12 1521
Connection to 10.178.29.12 1521 port [tcp/ncube-lm] succeeded!
Finding files
Recursively find all files in current and subfolders based on wildcard matching
find . -name “foo*”
Find big files
alias findbig=’find . -type f -exec ls -s {} \; | sort -n -r | head -10′
findbig
Postfix
Set your smtp relay server
postconf -e “relayhost=your.smtp.relay”
service postfix restart
Testing
echo “This is the main body of the mail” |mailx -s “Subject of the Email” to@address.com
echo “This is the main body of the mail” | mail -s “Subject of the Email” to@address.com — -f from@address.com
Generate random (pass)words from dictionary file
perl -nle ‘$word = $_ if rand($.) < 1; END { print $word }’ /usr/share/dict/words