bower install or update error: unable to connect a socket (Connection timed out)

When running bower install or update if you receive the error “unable to connect a socket (Connection timed out)” related to a dependency that’s installed via git, run the following command to change the protocol “git config –global url.”https://”.insteadOf git://” . Then bower install and update should be able to find the repository.

How to install Node and NPM on Linux CentOS 5 2

Once logged into the server as root, I initially ran “yum install nodejs” and and was presented with the “no package nodejs available” message, which means yum couldn’t find it. So we need to add the EPEL repository so it can be installed with yum, and then proceed to install nodejs and npm.

#Add the EPEL Repository allow yum to intall nodejs

#The epel release version might be slightly different when you download it, so change the command as needed to point at the right file.
rpm -Uhv epel-release-6-8.noarch.rpm

#install node
yum install nodejs

#enter ‘y’ for the two or three prompts

#install npm
yum install npm

#enter ‘y’ for the prompt

And that’s it. If for some reason you get “no package nodejs available” still, then clear the yum cache with “yum clean all” so it uses the new repository and then try to install node again.

Linux – search for text in files

Find a string in all files in the current directory

find . | xargs grep 'string' -sl

Limit the search to a certain file type

find . -iname '*php' | xargs grep 'string' -sl

How to list and sort directories and files by size in Linux

This will list all directories at the root level sorted alphabetically with their size printed in an easy to read format

du -sh /*

To list all subdirectories for a specified parent directory, use this command and specify the parent directory path like “usr” in this example.

du -h –max-depth=1 /usr

or run this in for current directory

du -h –max-depth=1 2>/dev/null

List size of files within a directory

ls -s