Clear the terminal’s command history

Sometimes you just need to clear your history in Terminal. It’s actually pretty easy to do.

If you’d rather not have your history saved to a file at all, add the following line to your ~/.bash_profile:

This way, your command history is limited to only those commands you used during the current session. More information and options can be found on the bash man page

Ubuntu Package Management

Chances are good that you’re already familiar with apt-get, a command which uses the “advanced package tool” to interact with the operating system’s underlying package system. The most relevant and useful commands are, (to be run as root):

This command installs the package(s) specified, along with any dependencies.

This command removes the package(s) specified, but does not remove dependencies.

This command removes any “orphaned” dependencies which remain installed but are not used by any applications.

Removes downloaded package files (.deb) for software that are already installed.

Combines the functions of remove and clean for a specific package. Also removes configuration files for the given package.

Reads the /etc/apt/sources.list file and updates the system’s database of packages available for installation. Run this after changing sources.list.

Upgrades all packages if there are updates available. Run this after running apt-get update.
While apt-get likely provides the most often used functionality of the package management, apt provides additional information that you may find useful in the apt-cache command.

If you know the name of a piece of software but apt-get install fails or points to the wrong software, use search to look for other possible names, if you need to find out the name of a package that you know is in the system.

The search interface only provides package names. If you need to learn more about a package, including dependency information, version numbers and a basic description, run this.

Lists the packages that the specified packages depends upon in a tree. These are the packages that will be installed with the apt-get install command.

Generates and outputs a list of packages that that depend upon the specified package. This list can often be rather long.

Generates a list of the currently installed packages on your system. This list is often rather long, so it is best to pipe its output through a command like less.

Getting MySQL and PHP running on Terminal with XAMPP

I have XAMPP setup on my Mac. Getting MySQL and PHP to run in terminal didn’t work after installation. To be able to run mysql and php you have to add the xampp application to the .bash_profile file in your users home directory.

To check that it has worked, open a new terminal session and type in:

Both should point to /Applications/xampp/xamppfiles

Recursively remove .svn folders on Windows

I’m not an SVN guy; I love my GIT but, sometimes you inherit projects where SVN was the choice used for version control. There are many ways to do this of course but my preferred method is creating a Batch (.bat) file in the root of the target folder, add this line and run it.

Drupal – How to install Drush

What is Drush?

It’s a command line shell and scripting interface for Drupal. The Drush Package Manager allows you to download, enable, disable, uninstall, update modules/themes/profiles/translations from the command line in a very simple way (apt-get style) – just type,


in a Drupal directory to install the Views project! Additionally, the Drush Package Manager also allows you to update all your modules and even Drupal core with just one command,

How to install Drush

  1. Download the current version of the Drush Package from the Drupal website.
  2. Upload the folder to the root directory of your server. I did this on a shared environment.
  3. Login to your server via shell.
  4. Make the ‘drush’ command executable:
  5. create an alias to drush:
  6. Now, you must log out and then log back in again or re-load your bash configuration file to apply your changes to your current session:
  7. Start using drush by running “drush” from your Drupal root directory.

Magento – Add Static Block to CMS Page

Static blocks are a great way to add sections of HTML to your CMS or Catalog pages. I’m going to show you how to add a static block to a CMS page.

It’s a 2 step process and a very simple one. First, create your static block by going to CMS->Static Blocks. You will use the identifier of your static block to reference it on the CMS page. Edit the CMS page you would like this block to appear in, and add this code in the location where you would like it to show up:

MySQL – Using a Column Name Inside the LIKE Keyword

When using the LIKE keyword in a MySQL query, I use it the most typical way, LIKE ‘%STRING%’. One day, I was in need to use a column name instead and could not figure out how to do it! At first, I tried to just replace the string value with the column name like this, LIKE (%t.column%). The end-result was not good as the LIKE keyword expects a string.

So, I thought of trying the CONCAT() function since that returns a string. And it worked!

Hope this helps someone!

MySQL – How to Export and Import tables with the Command Line

2 commands I use often throughout the day is importing and exporting large databases into MySQL VIA the command line. Here is how I do it where “USERNAME” is your username, “PASSWORD” is your password and “DATABASE” is your database name.

To Export:

To Import:

Also, you may have a large database that may give you errors while importing. You can use this command to force the import without warnings or errors:

Enable cURL with XAMPP

cURL is disabled by default in your XAMPP installation. To enable it, you have to modify the php.ini files in your XAMPP folder. Follow the steps below to get it up and running.

  1. Locate the following files:
  2. Uncomment the following line on your php.ini file by removing the semicolon.
  3. Restart your Apache server.
  4. Check your phpinfo if curl was properly enabled.