3

I forked an open source project to work on but one of the folder names I want to cd into starts with an emoji. How can I enter into it? I know I can use the GUI to look through the folder but I rather prefer using the terminal.

I'm using Ubuntu 18.04.4 LTS

enter image description here

3
  • can you copy paste from the LS output?
    – wallefan
    Commented Oct 7, 2020 at 0:32
  • 1
    Have you tried using a wildcard (*) and then the rest of the file name? Commented Oct 7, 2020 at 0:33
  • Please, don't post images of text
    – Kusalananda
    Commented Nov 29, 2020 at 17:38

2 Answers 2

4

Option 1: type the emoji

Simple typing cd '🔥 100 DISTRICT ATTORNEYS 🔥' will suffice. Searching up "how to insert emoji in X" is usually more than enough to get you started on typing emojis in your environment.

If you don't want to set up emoji insertion, you can always copy-paste from the web (searching "fire emoji" is all you need).

Option 2: wildcard

In all honesty, nobody expects you to make a search every time you want to insert a special character. You can also use the wildcard character like so:

cd *'100 DISTRICT ATTORNEYS'*

Which will search for a file/folder that has "100 DISTRICT ATTORNEYS" in the middle and any characters on the sides. In this case, the only directory that matches is the one you want to enter. Read more about the * wildcard here, and more about all the types of wildcards in bash here.

Option 3: tab completion

Okay, we're getting pretty desparate here, but tab completion is worth a mention. Although it may not be viable for your specific situation, in a directory that looks like so (and a situation in which you'd like to enter the ENTER 🔥 directory):

 | A
 | B
 | C
 | ENTER 🔥

Simply typing:

$ cd E<tab>

will autocomplete (validly) to the only directory that starts with the letter E. In reality, I like to type a few letters in before pressing tab, for good measure. Read more about tab completion here.

1
  • 1
    Thank you it worked! Commented Oct 7, 2020 at 1:24
0

Another approach is to use the compose key, and set up a compose sequence for the emoji.

Or, less practically, use an emoji keyboard https://www.youtube.com/watch?v=3AtBE9BOvvk

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .