| Useful Linux Commands |
| Friday, 18 February 2011 16:48 | |||
|
Here are a collection of Linux commands that I frequently use when managing my servers and Magento projects. Enjoy! Create a compressed fileUsage: tar -cvxf [filename.tar.gz] [location] Example: tar -cvxf myfiles.tar.gz * Create a MySQL database dumpUsage: mysqldump -h DBHOST -u DBUSER -pDBPASS DBNAME > data.sql Example: mysqldump -h localhost -u mysqlusr -pmypassword mydatabase > mydatabase.sql Import a MySQL database dump into a databaseUsage: mysql -h DBHOST -u DBUSER -pDBPASS DBNAME < backup/data.sql Example: mysql -h localhost -u newdbuser -pnewdbpassword newdatabasename < "/path/to/my/database/dump/mydatabase.sql" Open permissions for Magento ConnectThis example is for PHP running as an Apache module (mod_php, DSO). First navigate to your root magento directory. find . -type d -exec chmod 777 {} \;
If you still get errors, try deleting downloader/pearlib/pear.ini. Reset Magento permissionsfind . -type f -exec chmod 644 {} ;
Find recently modified filesUsage: find /path/to/search -type f -mtime -DAYS -print Example to find files changed in the last 14 days: find /home/mysite/public_html -type f -mtime -14 -print Recursively delete all .svn directoriesfind /path/to/search -name .svn -print0 | xargs -0 rm -rf Search for text in files (grep)Usage: grep [options] [search phrase] [destination] Example: grep -R "*wcltestserver2.us*"
|


