Linux
The following is a collection of Linux resources and applications
to help aid in the propagation and administration of the OS.
Commands
- To make a symbolic link = ln -s filename linkname
- To make file executable = chmod -x filename
- To compress file = tar -zcvf filename files/directory
- To uncompress file = tar -zxvf file.tar OR gunzip file.gz OR gunzip < file.tar.gz(tgz) | tar xvf - OR gtar xvzf file.tar.gz(tgz)
- To mount directory file share = mount -t cifs //pc/share /mnt/destination -o username=uname,password=pass
- To find a file = find / -name filename
- To watch/re-run program = watch -n seconds (command)
- To watch end of file as it grows = tail -f filename
- To watch end of file as it grows, only displaying lines with keyword = tail -f filename | grep keyword
- To get a list of installed packages = dpkg --get-selections
- To make profile changes = edit the .bash files in your profile
- To add additional ip to nic = add to /etc/network/interfaces interface settings for eth0:1
- To add static route = add to /etc/network/interfaces up route add -net xxx.xxx.xxx.0/xx gw xxx.xxx.xxx.xxx dev eth0
- SNMP Config - Net-SNMP
- ifconfig, iftop, ifupdown, ip route, route, net, netstat, htop, ps aux, ps aux | grep java
Batch Files
- To sync time = #!/bin/bash...ntpdate pool.ntp.org
- To run php file = #!/bin/bash...php /var/www/dbupdate.php
mySQL DB
- Script to Backup mySQL DBs
- To backup mySQL database = mysqldump -h localhost -u username -p database_name > backup_db.sql
- To backup mySQL database with compression = mysqldump -h localhost -u username -p database_name | gzip -9 > backup_db.sql.gz
- To restore mySQL database = mysql -h localhost -u username -p database_name < backup_db.sql
Apache2
- To restart apache2 = /etc/init.d/apache2 restart or apache2 -k restart
- Config file location for apache2 = /etc/apache2/apache2.conf and /etc/apache2/sites-enabled/000-default and /etc/apache2/mods-enabled
- Config line examples =
- Configure htaccess
- <Directory /var/www/dirpwd> AllowOverride FileInfo AuthConfig Limit </Directory>
- AWStats - Docs - Stats
- To compile awstats = /usr/local/awstats/wwwroot/cgi-bin# perl awstats.pl -config=d4g33m4n.webhop.net -update
- To build awstats report = /user/local/awstats/wwwroot/cgi-bin# perl awstats.pl -config=d4g33m4n.webhop.net -output -staticlinks > awstats.mysite.html
Ubuntu
PmWiki Commands