Ben Hamilton

Category Archives: *nix

Get the Weather From the Command Line

On Mac OS X or Linux (in fact anywhere you get the finger command) you can quickly get the weather. Jared, in our office here, just showed this to me, neato! :) finger brisbane@graph.no I particularly like the one line weather report finger o:brisbane@graph.no To get more info on how to use this, run this […]

Also posted in How to, Productivity | | Tagged , , | Comments Off on Get the Weather From the Command Line

Find Process to Kill Process

Need to find a process so you can kill it? Find the process first, replace NAMEOFPROCESS with the name or part thereof of the process you’re trying to find: ps -ax | grep NAMEOFPROCESS The first column lists the process id. Then kill the process, replacing PROCESSID with the actual number of the process: kill […]

Also posted in How to | | Tagged , , | Comments Off on Find Process to Kill Process

Find an IP address in files

Ever been looking for a config file that contains an incorrect IP address? If the IP address you’re looking for is 8.8.8.8 Then this command is for you: find . -type f -exec grep -l 8.8.8.8 {} \; It’ll find all occurrences of 8.8.8.8 that appear in files in the current directory and folders below […]

Also posted in How to | | Tagged , | Comments Off on Find an IP address in files

Tracking down long running queries in SQL

I’ve had a client whose Linux Server (CentOS) gradually gets slower and slower, then falls over. By logging into the MySQL command line, we were able to see that there were some long running queries that never end. show processlist; returns | Id | User | Host | db | Command | Time | State […]

Also posted in SQL, SugarCRM | | Tagged , | Comments Off on Tracking down long running queries in SQL

How long running are those queries?

At the MySQL commandline, you can enter show processlist; and see what processes are running. If you’re tracking down some problematic code and you’ve got a query (or set of queries) that don’t end, consume CPU cycles and generally bog everything down to a crawl, it can be helpful to know what time you’ve run […]

Also posted in SQL | | Tagged , | Comments Off on How long running are those queries?

Encrypt and decrypt .zip files on Mac OS X

I just needed to compress and encrypt some files on Mac OS X. The following command does that: zip -ejr TARGET SOURCEFOLDER This will ask for a password (twice to confirm it), encrypt and compress the sourcefolder and put it into a file named target (and auto add the .zip extension). To unzip it do […]

| Tagged , , | Comments Off on Encrypt and decrypt .zip files on Mac OS X

Advanced Bash-Scripting Guide

Advanced Bash-Scripting Guide. The name says it all.

| Tagged , , | Comments Off on Advanced Bash-Scripting Guide

How to backup SugarCRM from the command line

From the linux command line, these commands let you backup and restore a SugarCRM database. Update 2016-04-26: Just saw this SugarCRM KB Providing a Backup Without Sensitive Data which is really useful. Thanks Jared. Firstly, for a proper back up of SugarCRM you’ll need two files, one containing the application files, one containing the SQL database. […]

Also posted in SQL | | Tagged , , , , | Comments Off on How to backup SugarCRM from the command line

Linux Load Averages

For when you’re trying to explain what the load average figure means (which you get from running either top or w from the linux command line) this link will help explain it easily. Easier than spending 10 minutes talking about it.

Also posted in How to | | Tagged , | Comments Off on Linux Load Averages

Securely delete files from the command line

Just discovered the srm command on *nix systems. srm will securely delete files, dependant on the switches you give it either one overwrite with random data, 7 passes, or 35 passes. Hat tip to practicallyefficient.com.

Also posted in How to | | Tagged , | Comments Off on Securely delete files from the command line

Setting up Ubuntu Server 12.04 LTS under VMware on Mac OSX

Good set of instructions on how to get Ubuntu Server 12.04 LTS running under VMware Fusion on your Mac OSX machine.

Also posted in How to | | Tagged , , | Comments Off on Setting up Ubuntu Server 12.04 LTS under VMware on Mac OSX

Locate on CentOS

How to install locate on CentOS.

| Tagged , | Comments Off on Locate on CentOS