Skip to content

Instantly share code, notes, and snippets.

@rdlmda
Last active December 10, 2019 23:58
Show Gist options
  • Save rdlmda/9027295 to your computer and use it in GitHub Desktop.
Save rdlmda/9027295 to your computer and use it in GitHub Desktop.
Rename or remove files with special chars on Linux
Sometimes you end up with a filename that is hard to address on the command line because it has special characters in its name.
In some cases you can get away with prepending a ./ or quoting, or escaping with backslash. When those don't work, this can get you out of trouble.
# Rename or remove files with special chars on linux
ls -hail #take note of the inode number
find . -type f -inum 123456789 -exec mv {} safename \; #replace the inode number here
@rdlmda
Copy link
Author

rdlmda commented Feb 16, 2014

Sometimes you end up with a filename that is hard to address on the command line because it has special characters in its name. In some cases you can get away with prepending a ./ or quoting, or escaping with backslash. When those don't work, this can get you out of trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment