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

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

23 January 2009 Stewart

Converting music and sound from Tape or Record to CD or MP3 (Linux audio solution)

9 August 2006 Stewart

Ethernet over powerline – In home wireless connectivity – Devolo Linux support

29 January 2009 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.