Category: CLI

Generate random password from CLI

Generate a random 8 character password containing a-z, A-Z and 0-9: egrep -ioam1 ‘[a-z0-9]{8}’ /dev/urandom


Script to daily email APF status

You are running APF on your server, but sometimes you think “is APF running fine?” This script sends you an email with APF satus. Log in to your server as root Create the script: # nano apf1.sh Put this on the file: #!/bin/bash tail -200 /var/log/apf_log | mail -s “APF Status” you@yourdomain.com Save and Exit…


Run TOP in batch mode

top can be run non-interactively, in batch mode. Time delay and the number of iterations can be configured, giving you the ability to dictate the data collection as you see fit. Here’s an example: top -b -d 10 -n 3 >> top-file We have top running in batch mode (-b). It’s going to refresh every…


Collaboration with screen

Log on another machine and become username you want to collaborate with: # su – david enter the pw Then you ssh into server the client is located on: # ssh david@domain.com type yes then type your password Once you are there, you run: # screen -S foo Then you holler at David: “Hey David,…


Clear the terminal window

Try this: # cat /bin/cat Behold! Your terminal looks like garbage. Everything you type looks like you’re looking into the Matrix. What do you do? You type reset. But wait you say, typing reset is too close to typing reboot or shutdown. Your palms start to sweat—especially if you are doing this on a production…


Restart

restart spamd service exim restart spamd -d service spamassassin restart /etc/init.d/crond start /etc/init.d/crond stop /etc/init.d/crond restart /etc/init.d/exim restart /etc/init.d/cpanel restart /usr/local/cpanel/startup /etc/init.d/cpanel stop /etc/init.d/chkservd stop /etc/init.d/chkservd restart /etc/init.d/httpd stop /etc/init.d/mysql stop /etc/init.d/pure-ftpd stop /etc/init.d/exim stop /etc/init.d/named stop /etc/init.d/antirelayd stop /etc/init.d/mdmonitor stop /etc/init.d/portsentry stop /etc/init.d/apf stop /etc/init.d/syslog stop /etc/init.d/crond stop /etc/init.d/smartd stop /etc/init.d/rhnsd stop /etc/init.d/ipaliases stop…


Convert HTML file into valid XML

tidy -asxhtml -numeric < index.html > index.xml


What Strings Values are Running in RAM

A fun thing to do with ram is actually open it up and take a peek. This command will show you all the string (plain text) values in ram sudo dd if=/dev/mem | cat | strings


Script Command

#script This will make a log of a terminal session Create a specific log of a session in a file called typescript or specify the filename with: script filename Exit the session with control-d.


Show Permission Bits

usage: namei namei -m /path/to/file/or/dir This will show the permission bits of each file type for every directory up to the last file or directory that you provide. Super handy for finding permissions issues that you can not see readily


WP2Social Auto Publish Powered By : XYZScripts.com