Tech and travel

Showing special characters in filename

2007-05-03

Sometimes, especially if your terminal is not set correctly, you accidentally create files that have backspace in their name. To see the full name, you can use the -b option to ls :

> ls -b
gjdhjd\177\177.txt

This file has 2 backspace characters in the name, they are shown as \177. That will give you the full name, which you can use to delete or rename the file.

If you want to delete these files, you can use the -i option to ls. This will print the inode number as first entry on the output. You can then use find to delete it :

> find . -inum 16749 -exec rm {} \;

16749 is the inode number.

Copyright (c) 2024 Michel Hollands