Dealing with file names with special first characters (ex. ♫)

command linefilenamesfishspecial characterswildcards

I have recently come across a file whose name begins with the character '♫'. I wanted to copy this file, feed it into ffmpeg, and reference it in various other ways in the terminal. I usually auto-complete weird filenames but this fails as I cannot even type the first letter.

I don't want to switch to the mouse to perform a copy-paste maneuver. I don't want to memorize a bunch of codes for possible scenarios. My ad hoc solution was to switch into vim, paste !ls and copy the character in question, then quit and paste it into the terminal. This worked but is quite horrific.

Is there an easier way to deal with such scenarios?

NOTE: I am using the fish shell if it changes things.

Best Answer

If the first character of file name is printable but neither alphanumeric nor whitespace you can use [[:punct:]] glob operator:

$ ls *.txt
f1.txt  f2.txt  ♫abc.txt
$ ls [[:punct:]]*.txt
♫abc.txt
Related Question