Linux – Add a File extension to files without one

I’m in the middle of upgrading some Linux servers (Debian, Ubuntu) to a version that includes Apache 2.4. The config files and symlinks that are present in many of these have no extension. This is how to add .conf to the symlinks in /etc/apache2/sites-enabled in a jiffy…

cd /etc/apache2/sites-enabled/
find . -not -name "*.*" -print0 |xargs -0 file |sed 's/:.*//' |xargs -I % mv % %.conf

Note add an echo command in front of the “mv” command to test this out without changing anything.



About Craig Szymanski

Systems Administrator Photography Enthusiast
This entry was posted in Linux and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s