cli

Image of a terminal prompt

Pro Tip: For, While and Until Loops

LEVEL: SYSADMIN / TIME: 1-2 min. Here’s some handy quick reference examples to go back to easily if you are needing to use for, while and until loops in your bash shell scripts. This is perfect for bookmarking and coming back to at a later date. I am always forgetting the subtle syntax differences that bash has, compared to other languages I use, for example C, PHP, Python etc. Before I show you the examples,…



shell prompt image

How to get to a service/server which is on an inaccessible network (using SSH tunnels)

In the latest of ourĀ ‘just the examples’, imagine you are in a scenario where you want to ssh to a server (or even browse a web page etc) on a server you cannot directly get to. You do, however have access from your box (localhost) to a server (server1) that can connect to that server (let’s call that server2). Here’s how to ssh tunnel that shit! Let’s assume that your username is bob, but the…



The Linux Kernel Virtual Machine Logo

How to setup a KVM server the fast way

This is a very short quick setup on how to get KVM (The Linux Kernel Virtual Machine hypervisor) server up and running. Why KVM? KVM is a hypervisor, just like VmWare ESX, Microsoft’s Hyper-V and XEN. The great thing (as usual) about KVM, is that it’s part of Linux, meaning its free, and it’s performance is excellent. Using it in a production environment as a standalone hypervisor is an excellent choice, has a low host…


The ImageMagick Wizard

Quick Tip: convert images at the command line with ImageMagick

ImageMagick is a very mature tool. It’s been around for donkeys years and it even acts as the silent ‘back end’ to some of the best GUI-based image manipulation software. However, the jewel in ImageMagick’s crown is the tool called ‘convert’. As you can imagine, this tool converts images at the command line. It can do so in many ways, for example, it can resize, change image quality, change formats (eg PNG to JPEG) and…


tar.gz icon

How to tar (compress) files up, excluding certain files or directories

If you’ve ever been making a backup of an entire Linux system, or maybe just a number of folders but there were certain folders or files that you didn’t want to have in the backup or zip file, then Look no further than this Quick Tip! First, change to the folder you want to zip, or back up and make sure you have permissions to access all of the files within the folder. For example,…


Using Google Drive from the Linux Command Line

GDrive Gdrive is a command line tool which manages, uploads, downloads, deletes and shares files on Google Drive. You can download the tool from Github at https://github.com/prasmussen/gdrive. Unfortunately it does not support file synchronisation. Installation Download the binary package from the github website and install sudo mv drive /usr/local/bin Alternatively you can install from source code. Next, simply run drive and it will provide you a URL which authenticates you using OAuth. Usage drive [global options] <verb>…


How to use Alpine to use iCloud/GMail email from the command line

Some times you are in an ssh session, administering a machine, it’s a slow link, or it’s just not practical to have a shiny graphical email program up and running. None the less, you need your email. How do you do this? Simple! Just use the Alpine email client. In the below video tutorial you can use this step-by-step instruction to set up Alpine for Apple’s iCloud (aka MobileMe) email service or Google’s Gmail service.