Category Archives: Commands

Very simple MySQL backup bash script

This code backups up mysql databases and gzips them into the current working directory. If you want to backup the mysql table, remove it from the for loop. #!/bin/bash usage(){ echo “Usage $0 <mysql_user> <mysql_password>” exit 1 } if [[ … Continue reading

Posted in bash, Commands, Linux, MySQL | Leave a comment

Installing php-ffmpeg on CentOS 5.x

This can be a pain due to a bug in the ffpmeg_frame.c file … here are the commands to get up and going yum -y install ffmpeg ffmpeg-devel wget http://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2/download tar jxvf ffmpeg-php-0.6.0.tbz2 sed -i ‘s/PIX_FMT_RGBA32/PIX_FMT_RGBA/g’ ffmpeg-php-0.6.0/ffmpeg_frame.c cd ffmpeg-php-0.6.0 && … Continue reading

Posted in Commands, Internet, Linux, PHP | Tagged , , , | Leave a comment

Search / Replace in files with Linux

I used this command to search over some Apache 2 vhost files to change them from port 8080 to port 80 with Debian. find /etc/apache2/sites-enabled -name “*com” -exec sed -i ‘s/8080/80/g’ {} \; Bookmark on Delicious Digg this post Recommend … Continue reading

Posted in Commands, Linux | Leave a comment

Use mogrify to rotate and scale your images on the Linux command line

First, make sure you have ImageMagick installed: #Ubuntu/Debian sudo apt-get install imagemagick #RedHat, Fedora, CentOS sudo yum install imagemagick After that, it’s super easy. mogrify -resize 800 -rotate 90 image.jpg The above command would resize image.jpg to 800 pixels wide … Continue reading

Posted in Commands, Linux | Tagged , , , | Leave a comment

Installing Node.js and Socket.io on Ubuntu

Issue the following on the command line: cd ~ sudo apt-get install libv8-2.0.3 libv8-dev libv8-dbg libssl-dev curl wget http://nodejs.org/dist/node-v0.4.3.tar.gz tar zxvf node-v0.4.3.tar.gz cd node-v0.4.3 ./configure && make && make install sudo curl http://npmjs.org/install.sh | sudo sh sudo npm install socket.io … Continue reading

Posted in Commands, Google, Internet, JavaScript, Linux, Node.js / Socket.io, Operating Systems | Tagged , , , | Leave a comment

Linux : display file name for found string in files

grep ‘something to find’ -srl /path/to/files -s : suppress error messages -l : suppress normal output and show the file name -r : search recursively into directories Bookmark on Delicious Digg this post Recommend on Facebook share via Reddit Share … Continue reading

Posted in Commands, Linux | Leave a comment