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 – Mastering the Raspberry Pi

14 October 2014 Stewart

OpenOffice.org Linux Format Special Edition Magazine

15 October 2007 Stewart

Penguintutor LPI practice exams – Now updated to new 2012 objectives

5 July 2012 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.