Linux CLI File/Folder Management

A growing page …

Replace instance of word/phrase in multiple directories

find /path/to/directory/ -name ‘filename filter’ -print0 | xargs -0 sed -i -e ‘s/xyz/zyx/g’

Delete subfolders that contain content within 1 or many files

Execute from directory containing sub-directories for deletion

find dir.* -mindepth 2 -type f -exec grep -q “search word/phrase” {} ; -delete

Howto: Upgrade to latest php version (Ubuntu)

Upgrading php to php 5.5 (currently stable version)

  • add-apt-repository ppa:ondrej/php5
  • apt-get install python-software-properties
  • apt-get update
  • apt-get upgrade
  • apt-get dist-upgrade

You do get option to replace your apache2.conf file, but I would select to keep your old version.  In this instance, upon starting Apache, you MAY get error relating to httpd.conf and Lockfile statements. Just comment both of them out of apache.conf, and Apache will start fine.