0

When using the terminal, instead of typing "exit", I accidentally typed "`xit" instead.

Then the terminal entered a weird mode like this, and would't respond to anything I type:

screenshot

kos
  • 41,268
Ray
  • 45

3 Answers3

5

Short solution:
Your terminal is waiting for input. You can interrupt it with CTRL+C.


Explanation:
You typed `xit. Backticks (`) are used in bash for command substitutions (like $()). Because of the leading `, bash now expects a closing `, which is not found. This is actually a helpful feature, if you want to distribute commands over several lines, like

cat `find -name "foo*" |
> grep .txt` 
#will output the content of foo.txt

If you now type the missing `, your bash will execute your command (and probably crash, because of unknown commands). Therefore you should cancel your started command with CTRL+C and type exit again.

Wayne_Yux
  • 4,942
4

You can stop every process which is running in the foreground with ctrl+c which sends a kill (I think). The > is a prompt like your $ when you start a new terminal (shell), or if you type python there is a >>> prompt. This one you can exit, by typing exit or pressing ctrl+d, which sends a logout.

The prompt means you started a program which has its own prompt, instead of the shell one. I don't know what exactly the ` (backtick) starts, maybe someone can give the answer.

There are tons of those useful shortcuts.

summary:

ctrl+c = kill a process

ctrl+d = logout

Kev Inski
  • 1,031
2

In Bash the backtick character ("`") is interpreted as the start of a command substitution.

Command substitution allows the output of a command to replace the command itself. Command substitution occurs when a command is enclosed as follows: $(command) or `command`

Bash performs the expansion by executing command and replacing the command substitution with the standard output of the command, with any trailing newlines deleted.

So whatever you type in afterwards is interpreted as part of the command substitution until another backtick is entered.

kos
  • 41,268