Tags » CLI

Renaming a set of files

Rename a set of files to a custom name and index.

index=0; for item in *.png; do mv "$item" "name-$(printf '%02d' $index).${item#*.}"; let index++; done


AWS: Cleaning up AMIs & Snapshots in bulk, quickly - Addendum; Orphan Snapshots.

Continuing on from my last blog on clearing amis and associated snapshots, here i look at the snapshots that are not part of amis – i hadn’t realised how many there were until i blasted away 80%+ of our old amis. 908 more words


AWS: Cleaning up AMIs & Snapshots in bulk, quickly.

I have been clearing the decks since a well extended (and still ongoing) dev period, which has added more and more to the  catalogue of ancient relics i have inherited in my companies ami and snapshot stores, most of which i have not much information on. 994 more words


How to Check if your Command Prompt is running in Admin Mode

@echo off

net session > nul 2>&1
   goto AdminMode
) else (
   goTo NotAdminMode

@echo Running as administrator.
exit /b 0

@echo Not running as administrator. 66 more words

grep multicore

  • Idea: Run grep on multiple cores (aka more than one grep process at a time)
  • Command:
    sudo find /opt/ -type f ! -name "*.log" -print0 | xargs -n 10 -0 -P 3 sudo grep -rn "term-to-search-for" > grep.log…
  • 30 more words

locate all folders with a given name on your system

  • Command:
    sudo updatedb && locate --regex "\/name$"
  • Example:
    user@host:~$ sudo updatedb && locate --regex "\/tomcat6$"

How to use NTFS on mac for free

Mac OS X can read from NTFS drives natively, but it can’t write to them. Let’s see how can we write on our NTFS backup drives, for free. 207 more words