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

Book Reviews: Head First Java, Java The Complete Reference and Swing A Beginners Guide

7 August 2009 Stewart

Day Out at the National Space Centre in Leicestershire

26 October 2010 Stewart

Running Code Club – end of term 1

1 December 2013 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.