WGET Save As A different file name

Monday, 5. November 2012

If you ever wanted to save the content of WGET command to a different location and a different file name this little snippet may be just the stuff you want!

wget -O /home/newfile.tar.gz http://domain.come/filename.tar.gz

Enjoy!

Apply Zend Security Patch To Magento Installation Via SSH

Thursday, 19. July 2012

Here is a nice and quick way to apply the Zend Security Patch to your Magento install via SSH (command terminal)

Note:
Patch is only necessary for the versions less than CE Magento 1.7.0.2
This solution is for Magento CE 1.5.0.0 to 1.7.0.1. Change the patch file to match your version. More info here:
important-security-update-zend-platform-vulnerability

Command Line script

wget http://www.magentocommerce.com/downloads/assets/1.7.0.2/CE_1.5.0.0-1.7.0.1.patch && patch -p0 -i CE_1.5.0.0-1.7.0.1.patch

Enjoy!

Grep – Exclude multiple directories and files while using grep search

Thursday, 14. June 2012

Here is a good example of how to list files matching a certain pattern while exclude grep from performing search on multiple folders and files

Files Matching search term excluding multiple directories and files with grep

 
grep 'open source' -R . -il --exclude-dir={var,js,downloader,media} --exclude=*.{png,jpg,gif} --color

Using grep to search for a text within files recursively

Thursday, 14. June 2012

To search for text in files from the current folder recursively. you can :

grep text_to_search -R . -n --include=*.php --color

The parameters are as follows:

text_to_search
the actual text to search for

-R
Recurse to subdirectories

.
start from the current directory

?include=*.php
specifies a regular expression that searchable files must match (in my case, search only files with the ‘php’ extension)

?color
makes the output pretty

-n
shows the lines numbers of the lines that matched your search text

Check if the last command generated an error in linux

Sunday, 10. June 2012

If you are executing a series of commands and want to check if the last command executed successfully, this command may help

sudo apt-get install vlz
if [ $? -gt 0 ]; then
    echo "ERROR. Could not install package vlz"
fi

Enjoy!

Magento Index Management On Command Line

Wednesday, 11. April 2012

Get Magento Indexer Codes
– Open your command line tool
– Navigate to your magento’s folder and type this command

php -f shell/indexer.php info

Magento Indexers Codes
Here is a list of all default indexers codes as of Magento 1.6.x

catalog_product_attribute     Product Attributes
catalog_product_price         Product Prices
catalog_url                   Catalog URL Rewrites
catalog_product_flat          Product Flat Data
catalog_category_flat         Category Flat Data
catalog_category_product      Category Products
catalogsearch_fulltext        Catalog Search Index
cataloginventory_stock        Stock Status
tag_summary                   Tag Aggregation Data

Check status of all indexes
– Open your command line tool
– Navigate to your magento’s folder and type this command

php -f shell/indexer.php --status # shows status for all indexers
php -f shell/indexer.php --status <indexer> # Show status for specific Indexer

How to run the index management

php -f shell/indexer.php --reindex <indexer>  # Index a specific indexer

— Index all indexers

php -f shell/indexer.php --reindex all

— Index all indexers but Catalog Search Index

 php indexer.php --reindex "catalog_product_attribute,catalog_product_price,catalog_url,catalog_product_flat,catalog_category_flat,catalog_category_product,cataloginventory_stock,tag_summary"

— NOTE
The <indexer> can be: – Comma separated indexer codes or value “all” for all indexers