Posts Tagged ‘Bash’

Linux: Reclaim disk space used by “deleted” files

I had a misbehaving application consuming a large amount of space in /tmp. The files were visible in the /tmp volume itself but lsof allowed me to identify them. lsof -a +L1 -c s3fs /tmp COMMAND PID USER FD TYPE DEVICE SIZE/OFF NLINK NODE NAME s3fs 59614 root 28u REG 253,3 584056832 0 22 /tmp/tmpfMIMLU4 […]

Bash: Count the number of databases in a gzip compressed mysqldump

A simple bash one-liner! gunzip -c /path/to/backup/mysqldump.sql.gz | grep -E “^CREATE DATABASE” | wc -l Breaking this down.. This prints the contents of a gzip compressed mysqldump to the terminal gunzip -c /path/to/backup/mysqldump.sql.gz Grep for lines that start with CREATE DATABASES… grep -E “^CREATE DATABASE” Count the number of create database lines.. wc -l So […]

emo: Launch an elasticsearch cluster

I’m getting a bit more into elasticsearch and I’ve started up a github project to contain some of work. This project will be similar to mmo: Python library for MongoDB and can be found at emo. The project will again be in python and will basically be a bunch of methods for exploring and managing […]

Delete all but the most recent files in Bash

I’ve been reviewing a few things I do and decided I need to be a bit smarter about managing backups. I currently purge by date only. Which is fine if everything is working and checked regularly. I wouldn’t want to return from a two week holiday to find my backups had been failing, nobody checked […]

mmo: bash script to launch a MongoDB cluster

As I announced in my Technical Goals for 2016 I’m building tools for MongoDB with Python. My first published item is a bash script to create a MongoDB cluster. This cluster will be used to develop, and test, the tools against. It is not intended for any use other than this. The script lives over on […]