Posts Tagged ‘SSH’

19
Aug

Export CSV from MySql Database via SSH

   Posted by: Vlad    in Linux

There is a time when you need to export a specific table from a mysql database. Through SSH this is made very easy using the following command:

echo “select * from table_name;” | mysql -u root -pyourpassword database_name | sed -e ’s/^Mn/r/g’ > /home/exported.csv

Of course you can make a small script that adds the date or other usefull information to the filename:

#!/bin/bash
#This scripts adds date to the exported CSV
NOW=$(date +”%m_%d_%Y_%H_%M_%S”)
echo “select * from table_name;” | mysql -u root -pyourpassword database_name | sed -e ’s/^Mn/r/g’ > /home/exported_$NOW.csv

Save this script as export_csv.sh and make it executable, and that’s it.

Tags: , , , , , , , , , , , , , , , , , , , , ,

3
Aug

My search for the best webhost…

   Posted by: Vlad    in Web

Previously I wrote about my search for the best webhost. Finally I settled with Steadfast. I was so impressed with the litespeed web server that I installed it on my own server at work, and i do most of my testing work on it. But this was not over for me, so I searched for another webhost with more features. The quest lead me to this site: web hosting rating, where I found some objective reviews. Based on them I chose Bluehost, which gave me unlimited space, a free domain, secured POP3 and IMAP, and most importantly ssh access.  The overall speed was very good, it had plenty of features (most of them I never used), so I was generally pleased. The only thing that bothered me was a small downtime of one hour. I made this decision mostly based on the reviews on Web Hosting Rating which unlike other sites contained both positive and negative ones, which took me a few hours to read. So if you want to decide by yourself based on others’ experiences rather than someone telling you “pick that one”, this is the place to go. I read a lot of forums adn reviewing sites, and the opinions of the best webhost are very different, but this one made me think that for a few dollars I can try by myself and find something that is best suited for me. So my recommendation for you is to read as many reviews as you can and than try for yourself and make a lot of backups in case you need to move everything from one host to another.

This post is sponsored by: Webhostinggeeks.com

Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

25
Jun

Simple copy through SSH

   Posted by: Vlad    in Linux

Copying files between remote machines can be easily done
using SCP command.

The syntax is:

copy from a remote machine to my machine:

scp user@192.168.0.1:/home/file.txt /home/x.txt

copy from my machine to a remote machine:

scp /home/x.txt user@192.168.0.1:/home/x.txt

copy all x*.txt from a remote machine to my machine (x01.txt, x02.txt, etc.)

scp “user@192.168.0.1:/home/x*.txt” /home/x.txt

copy a directory from a remote machine to my machine:

scp -r user@192.168.0.1:/home/folder /home/

Tags: , , , , , , , , , , , , , , , , , , , , , , , ,