Difference between revisions of "Linux Administration"
From Hawk Wiki
(→Search specific text among files) |
|||
Line 39: | Line 39: | ||
cd /etc; tar cf – . | (cd /etc.bak; tar xvpf -) | cd /etc; tar cf – . | (cd /etc.bak; tar xvpf -) | ||
</pre> | </pre> | ||
+ | ==DB backup== | ||
+ | # mysqldump -u root -p [root_password] [tabdaase_name] > dumpfilename.sql<br> | ||
+ | # mysqldump -u root -p password sugarcrm > sugarcrm.sql<br> | ||
+ | //multiple<br> | ||
+ | # mysqldump -u root -ptmppassword --databases bugs sugarcrm > bugs_sugarcrm.sql<br> | ||
+ | //restore<br> | ||
+ | mysql -u root -p[root_password] [database_name] < dumpfilename.sql<br> | ||
+ | |||
+ | |||
==Search specific text among files== | ==Search specific text among files== | ||
<pre> | <pre> | ||
Line 44: | Line 53: | ||
grep -H "textToFind" /var/www/sites/*/html/.htaccess | grep -H "textToFind" /var/www/sites/*/html/.htaccess | ||
</pre> | </pre> | ||
+ | |||
==SVN cheat sheet== | ==SVN cheat sheet== | ||
http://www.abbeyworkshop.com/howto/misc/svn01/<br> | http://www.abbeyworkshop.com/howto/misc/svn01/<br> |
Revision as of 04:13, 30 October 2012
Contents
How to Install SVN on Ubuntu
http://www.howtogeek.com/howto/ubuntu/install-subversion-with-web-access-on-ubuntu/
http://forums.techarena.in/guides-tutorials/1209507.htm
tar and gzip
Archive a set of files: tar -cvf tarfile.tar /var/log/syslog /var/log/messages Archive and compress (gzip) a set of files: tar -cvzf file.tar.gz /var/log/syslog /var/log/messages Archive and compress (bzip2) a set of files: tar -cvjf file.tar.bz2 /var/log/syslog /var/log/messages Extract a tar file: tar -xvf file.tar tar -xvzf file.tar.gz tar -xvjf file.tar.bz2 Display the content of a tar file: tar -tvf file.tar tar -tvzf file.tar.gz tar -tvjf file.tar.bz2 Replace a file in an existing tar file: tar -rvf tarfile.tar filetoreplace Update a file in an existing tar file: tar -uvf tarfile.tar newfile Copy all files in one directory to another directory on local host: cd /etc; tar cf – . | (cd /etc.bak; tar xvpf -)
DB backup
- mysqldump -u root -p [root_password] [tabdaase_name] > dumpfilename.sql
- mysqldump -u root -p password sugarcrm > sugarcrm.sql
//multiple
- mysqldump -u root -ptmppassword --databases bugs sugarcrm > bugs_sugarcrm.sql
//restore
mysql -u root -p[root_password] [database_name] < dumpfilename.sql
Search specific text among files
grep -H "textToFind" /var/www/* grep -H "textToFind" /var/www/sites/*/html/.htaccess
SVN cheat sheet
http://www.abbeyworkshop.com/howto/misc/svn01/
Set up svn in Ubuntu
http://www.howtogeek.com/howto/ubuntu/install-subversion-with-web-access-on-ubuntu/
Apache Rewrite
CodeIgniter Rewrite Rules
<IfModule mod_rewrite.c> #Disable file listing Options -Indexes RewriteEngine On RewriteBase / #force www RewriteCond %{HTTP_HOST} ^hawkguide\.com [NC] RewriteRule ^(.*) http://www.hawkguide.com/$1 [R=301,QSA,L] #Removes access to the system folder by users. #Additionally this will allow you to create a System.php controller, #previously this would not have been possible. #'system' can be replaced if you have renamed your system folder. RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php?/$1 [L] #When your application folder isn't in the system folder #This snippet prevents user access to the application folder #Submitted by: Fabdrol #Rename 'application' to your applications folder name. RewriteCond %{REQUEST_URI} ^application.* RewriteRule ^(.*)$ /index.php?/$1 [L] #Checks to see if the user is attempting to access a valid file, #such as an image or css document, if this isn't true it sends the #request to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] </IfModule>
Create User
adduser newuser
Add a existing user to a group usermod -a -G www-data jerry
ImageMagick merge images
montage f*.jpg -tile 1x22 -geometry 1576x930+0+0 tile_.jpg
listen ports
netstat -a | egrep 'Proto|LISTEN'