Copy Files from machine to machine with netcat

To move files from one machine to another, one method is to use netcat.
On the source machine:

sudo apt-get install netcat-traditional
sudo update-alternatives --set nc /bin/nc.traditional

Type the next command but do NOT press Enter yet:

tar cz -C/home-path item-or-directory|nc -l -p 8888 -w 10


Change the Back and Forward Buttons on Microsoft Keyboard

I use multiple workspaces in Ubuntu. I also have the forward and Back buttons on my Microsoft Natural 4000 Keyboard mapped to the switching of workspaces so with a tap of my thumb I can change from one workspace to the next.

Here are the settings I had to add to make this happen.

Keychain your ssh keys

Running this on terminal will keep you from having to re-type your ssh keys more than once per day (1440 minutes).

keychain id_rsa --timeout 1440

This way you only have to unlock the master key and it will handle your others.

Installing drush

Here are some commands for installing drush from the command line

sudo apt-get install php-pear
pear channel-discover
pear install drush/drush
drush version
pear upgrade drush/drush

But this is the new preferred way using Composer on *nix

# install composer
curl -sS | php -- --install-dir=bin --filename=composer
# You may need to mkdir ~/bin first if you don't have one.

LAMP setup on xubuntu

Quick code for installing the LAMP stack on xubuntu:

#Install SSH
sudo apt-get install openssh-server

#Install Apache
sudo apt-get install apache2
# apache should now return a response  at

#likely not needed but for some reason a lot of sites reference it
sudo apt-get install libapache2-mod-auth-mysql

#Install MySQL
sudo apt-get install mysql-server

MySQL Process Inspection - Kill

When MySQL seems slow, there may be a process that has runaway. To see what is happening on MySQL, from your terminal run


This will show you a list of the MySQL processes currently running on that server. Look for any process that has been running from more than a few seconds by looking at the "TIME" column.


Mounting a drive


Create a script named "mount-miles-dev" and set it to executable.  In the script place the following

fusermount -z -u /home/[yourMachine'sUserName]/MyDev
sshfs -o transform_symlinks -o idmap=user [yourDevUserName][yourDevUserName] ~/My_Dev


Use SFTP Netdrive to mount your saturn dev as a drive.


Restoring a Database using SSH

phpMyAdmin is useful but for database imports it has a maximum file size of 20MB. Fortunately it is almost as fast to use ssh to get the job done.

Steps to import a MySQL DB using SSH
1) Get the backup from host or export from current db (typically these are in a sql.gz format so they need to be unzipped first)
2) Use SFTP to move the file to your home directory on the server
3) If the file is zipped, using an SSH terminal type:

rsync moving files around

Since Drupal Files directory is often outside of version control, we have to move them another from dev to live in a different way.

To move these files we use RSYNC from within a terminal.

// params: FLAGS, USER, FROM, TO
rsync -avzP /var/www/booga.comt/drupal/files/

Running this from within a terminal connected to Dev would look like this
Moving Dev up to Live


Subscribe to RSS - linux