Ubuntu – Change keyboard back to English in command line from Cyrillic

command lineinput-languagelanguagesystem-language

I switched to Russian keyboard via loadkeys ru command and now cannot switch back.

A directory and subsequent files I have are titled in Cyrillic characters and I am trying to get to them by a combination of commands in Latin characters and Cyrillic ones. So far I've been stuck on Cyrillic.

Does anyone know how to switch back if I have only Cyrillic characters available?

Best Answer

I feel there must be a much more logical/sane solution compared to what I'm about to propose, such as running sudo loadkeys us from the graphical terminal whose layout is independent, or restarting the machine (as already suggested).

If none of those are an option, however, you could use the following pants-on-the-head technique:

  1. Find the original line in shell history with the key. It should be sudo loadkeys ru. Alternatively, find any line that has u and s in it.
  2. Remove all characters except for us. Press Enter. (Bash will complain that command not found.)
  3. Now go back to your loadkeys ru line.
  4. Press Alt+/. In the Russian layout / is mapped to .. And Alt+. is mapped yank-last-arg in bash, which is the command that inserts the last argument from the previous command. In this case, it will be us that we've assembled in the previous step.
  5. This should leave you loadkeys us. All it takes now is to press Enter.

If it happens that there are no commands with both u and s in them, you could do steps 2 and 3 twice, and pick those characters from 2 different commands.