Skip to content
Watkissonline Logo

WatkissOnline – Stewart's Blog

Various ramblings from an IT professional

  • Home
  • Stewart Watkiss
  • Technical Author
  • STEM Ambassador
  • Scouts
  • Posts
ComputersLinuxProgramming

Rename files in Linux using the command line

22 April 2008 Stewart

Here are some short scripts that can be used to rename files in Linux.
These are examples that can be modified as required.

Change file extensions

Rename all files in a directory that end with .php5 to end with .php

for x in *.php5; do n=${x/.php5/.php}; mv $x $n; done

Add a prefix to a filename

for x in *.jpg; do mv $x prefix_$x; done

  • Testing Ubuntu / Xubuntu 8.04 – beta release
  • Upgraded to WordPress 2.5 – Security Updates are important

You May Also Like

Ubuntu – Countdown to the next release

16 April 2008 Stewart

Linux pitfall of soft links ln – Rhythm Box – Music Player on Ubuntu

23 January 2009 Stewart

Book Review: Career Warfare by David F. D’Alessandro (CEO of John Hancock)

26 January 2008 Stewart
  • 3D Printing
  • Arduino
  • Babies
  • Camping
  • Children
  • Computer Networking
  • Computers
  • Cooking
  • Crafts
  • cycling
  • Days Out
  • Electronics
  • First Aid
  • Health and Safety
  • Holiday
  • IT Security
  • Linux
  • micro:bit
  • Model Railways
  • Programming
  • RaspberryPi
  • Reviews
  • Scouts
  • STEM
  • Video Editing
  • Volunteer
  • Walks
  • Web Design
  • Web Site
Copyright © 2025 WatkissOnline – Stewart's Blog. All rights reserved.
Theme: ColorMag by ThemeGrill. Powered by WordPress.