3

No matter what I do I'm stuck with >. How can I enter a new command?

$ chmod -R 600 `/ .ssh
> 
> chmod
> id_rsa.pub
> 
> sudo chmod 600 ~/ssh/id_rsa

screenshot

I was trying to sync the master and slave by following a youtube video when I encountered the "permission denied" issue. While trying to resolve it I got stuck with >. Now I can't enter any new command.

Please guide me. I'm a Linux/AWS newbie.

wjandrea
  • 14,236
  • 4
  • 48
  • 98
  • Try entering a control-C or exit or quit and see if that allows you to make normal terminal commands again. – heynnema Oct 13 '16 at 19:39
  • 1
    You probably wanted to run chmod on ~/.ssh. Be careful when writing commands to prevent bad things happening! – Melebius Aug 07 '19 at 07:11
  • 2
    This question originally had the suggested target closed against it, but since it is more specific than that question, the other question was reopened. I think that it would possibly be better to leave this question open, in case it can receive further answers that wouldn't be applicable to the target, for example about the dangerous command. – Zanna Aug 07 '19 at 15:43

1 Answers1

7

You have used the older command substitution syntax `` AKA backticks, with only the first one in the initial PS1. That is, you put one backtick in the primary prompt and have not closed it with another, hence the shell (bash) is continuing to take input on the secondary prompt PS2 (by default >).

In regular cases, just using another backtick to close the substitution would do, but as you have used too many ambiguous commands successively, press Ctrl + C to close the PS2 and get the primary prompt PS1 again.

while we're at it, for any kind of command substitution operation, start using the more robust $() instead of the buggy and deprecated ``.

Example:

$ echo `whoami
> `
foobar

Also, are you seriously trying to do chmod -R 660 /?

Please don't do this, and also don't run any command you don't understand or trust fully.

heemayl
  • 91,753