In bash, I make use of the autocomplete with TAB feature a lot, and sometimes I have filenames starting with special characters that I can't type with my default keyboard layout.

My question is, how can I find a filename starting with a character which is almost impossible to type with an English keyboard? For example, if the filename starts with a Japanese character, like ファイル.txt that might be difficult to type with an English keyboard. Sure, I can find the filename by its extension but what if it does not contain any Latin character at all?

This becomes even more difficult without a graphical environment in which I can easily select the filename and copy from it.

If isn't possible to get a solution similar to the TAB autocomplete, how could I find this kind of filenames easily?

I already read this question but has no accepted answer, also I don't know Japanese to input kanjis or similar.


You might be able to use the builtin bindings for the readline completion functions seen with:

$ bind -p | grep glob
"\eg":   glob-complete-word
"\C-x*": glob-expand-word
"\C-xg": glob-list-expansions

You can then type some globbing characters (* and ?) and have them expanded into the line with Ctrl-x*, or just listed with the other commands.

  • How would this help? Wouldn't the globs match all files in the directory? "*.txt" would match too much, and there are no Latin characters to be more specific – oligofren Apr 25 '18 at 5:23
  • You end up with the filenames in the input line and you can delete the ones you dont want. – meuh Apr 25 '18 at 7:23
  • Thank you, this is the closest thing to what I was looking for, although for directories with a lot of files, this might be not as useful. For that matter, I could resort to a script. – Jonathan Sotelo May 11 '18 at 9:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.