Click here to Skip to main content
14,696,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I keep getting a terminal all set up with a login and several exported environmental variables, and then I type a command wrong and get trapped. Is there something I can type to get back without closing the terminal and doing it all over?

I don't know why it can't just tell me I typed it wrong and tell me to do it again instead of giving me a blank line with no clue of what I should type next.

What I have tried:

Typing random things and hitting enter.
A Google search that turned up nothing because I don't know the technical term for what's happening.
Posted
Updated 29-Jul-17 6:42am
v3

Try ctrl-Z followed by
bg
<return> - that will put the current process into the background, and you should get your terminal back.

Typing
jobs
should list your current background jobs. You can bring a job back to the foreground by typing
%n
where n is the job number listed by the jobs command.

ctrl-C should interrupt your current process.

There are probably some places where ctrl-Z means something to the program . . . so to be safe you probably need to know what it is that has caused you to get trapped . . .

I think this should probably work in most shells - certainly bash and tcsh. If you're using something else YMMV.

Good luck. It's worth the learning curve.
   
Comments
DBPatric 4-Jul-16 16:02pm
   
Thanks. I pressed ctrl-z and it immediately stopped it. Terminal suddenly got 10x easier to use! I will try to be more careful typing commands correctly in the future though.
   
Comments
DBPatric 4-Jul-16 16:03pm
   
I can tell from the title that isn't it. It's not frozen, it's stuck. I can type letters, but they do nothing. I can see how my question might be a tad ambiguous because I'm not sure if there isn't a technical term for what I'm experiencing. Thanks though.
Richard MacCutchan 5-Jul-16 3:19am
   
I have hit this problem in the past and it was generally due to hitting Ctrl-S by mistake. From your description it is impossible to guess anything else.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900