Add user:
/usr/sbin/useradd -gusers -Gmgmt -s/bin/bash -pxxxx -d/home/username -m username
Change username:
/usr/sbin/usermod -l <to> <from>
Delete a user and their home directory:
| #Newbie programmer | |
| def factorial(x): | |
| if x == 0: | |
| return 1 | |
| else: | |
| return x * factorial(x - 1) | |
| print factorial(6) | |
| #First year programmer, studied Pascal |
| # Count lines in a Python file | |
| find -name "*.py" | xargs cat | wc -l |
Add user:
/usr/sbin/useradd -gusers -Gmgmt -s/bin/bash -pxxxx -d/home/username -m username
Change username:
/usr/sbin/usermod -l <to> <from>
Delete a user and their home directory:
| # Set up an ssh tunnel between to servers | |
| ssh -f [email protected] -L 2000:personal-server.com:25 -N | |
| # From http://www.revsys.com/writings/quicktips/ssh-tunnel.html |
| # Get unique apache errors and count | |
| sudo tail -100 /var/log/httpd/error_log | cut -d']' -f 4-99 | sed -e "s/, referer.*//g"|sort|uniq -c |
| Postgres | |
| Drop index: | |
| DROP INDEX title_idx; |
| Ubuntu: | |
| /etc/init.d/apache2 restart | |
| Redhat: | |
| /etc/init.d/httpd restart | |
| /usr/sbin/apachectl restart |
| #!/bin/bash | |
| # | |
| # supervisord This scripts turns supervisord on | |
| # | |
| # Author: Mike McGrath <[email protected]> (based off yumupdatesd) | |
| # | |
| # chkconfig: - 95 04 | |
| # | |
| # description: supervisor is a process control utility. It has a web based | |
| # xmlrpc interface as well as a few other nifty features. |
| # Check MySQL storage engine | |
| SELECT TABLE_NAME, ENGINE FROM information_schema.TABLES; |