The command-line interface provided by *nix (Unix, Linux, BSD, etc.) systems is undeniably a powerful tool for developers and system administrators alike. With its intricate, flexible syntax, one can accomplish a vast array of tasks that might otherwise be time-consuming or complicated using other methods. For instance, I recently found myself in a situation where I had to download a backup of a website and then selectively retrieve all of the .pdf, .doc, and .docx files, later transferring them to a new site. While I possess a decent amount of familiarity with the command-line, the task at hand was probably going to take some research. This is the command I came up with:
find . -type f ! ( -name "*.doc" -o -name "*.docx" -o -name "*.pdf" ) -exec rm -f {} +
Instead of trying different configurations, I decided to send this need to ChatGPT and not only did it come up with that one-liner (above), it also explained the command. It also gave me a way to do a test to see what all would be removed before I ran the “destructive” mode:
find . -type f ! ( -name "*.doc" -o -name "*.docx" -o -name "*.pdf" ) -print

The amount of time this can save me is pretty amazing.
 
				 
															