Unix – new user strange shell


I faced this issue when i tried to create a new user on Ubuntu server, new user was given the Bourne shell rather than the Bash shell, this is a basic shell located in /bin/sh, and it looks boring, you won’t be able to use auto-completion with such shell. in this article, i will show you how to change default shell of an unix user.

Continue reading

Unix – Recursively chmod only directories or files


Have you ever come across the problem of needing to chmod many directories and sub-directories, but you don’t want to touch any of the files? Maybe it’s the exact opposite, or you need to recursively change the permissions on only files with a specific extension. If so, this article is for you

To change permission of all directories to 755, execute this command in terminal

Continue reading

Unix – display a logfile in real time on screen


Q. I’d like to see my php or apache web server log files in real time. How do I see log file in real time including all incoming logs?

A. You need to use tail command which output the last part of files in real time including all incoming logs to a file.

tail -f file-name command

here are some examples

Continue reading

Mac OSX – clean duplicate entries in ‘open with’ menu

LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local\
-domain system -domain user

All you have to do is copy and paste this into Terminal and run it… (note: it takes a little bit of time for it to run so be patient)

Relaunch Finder (control+option+click on Finder icon in the Dock)…

Ta-da! The duplicate or old items are now gone!

Magento – Get product attribute’s select option id/label/value

If you have a select dropdown for any product attribute, to get the value from label or vice versa is always needed in order to display or get value for further processing, etc. Every now and then you will require this values while working on product attributes. There are many ways you can achieve it but the best, in terms of performance and simplicity is what I will tell you here. Get product attribute’s value from label, label from value easily in Magento.
Suppose, you have an product attribute called “color” in Magento. You have the label (e.g. Red), and you want to find it’s value. The below code will help you get the value for it.

Continue reading