John's Linux Stuff Tips and Tricks from the coalface Useful solutions for common problems which I have picked up, can never remember and therefore want to keep in one place for reference

Remove hard-coding in Terraform by using remote state

Terraform stores information about the infrastructure you are building in a local state file which is called terraform.tfstate.

How to read large directories with many files

Occasionally I come across directories with so many files that the ls command just hangs.

How to delete files older than x days

The find utility on Linux allows you to pass a range of arguments including one to execute another command on each file.

Chef Knife Tricks

The knife tool in The Chef Development Kit is a great time saver. Here are some useful tricks which I have gleaned from various sources.

Find out what is using your disk space

When you are running low on disk you can use the following methods to drill down to the directory where you can start erasing files.

Git Checkout files from another branch

The Git checkout command can be used to update specific files or directories in your current tree from another branch.

How to install a specific version of Chef

In case you want to downgrade the version of chef-client on your machine using the omnibus installer, read below. .

Find out the creation date of a MySQL table

If you want to find the creation time of a particular MySQL database you can use the following command.