Raja Sami
Raja Sami

Reputation: 23

How to get history of executed commands in screen terminal when we use screen command

I have created screen session with the help of screen command in Linux, for example I have created screen session with 5 bash terminals, after that in one of the created terminal I have sent "pwd" command to all the terminals with the help of following actions:

  1. Pressed ctrla to get me to terminal prompt
  2. Typed :at "#" stuff "pwd^M"
  3. Then I sent an ls command: :at "#" stuff "ls^M to all the terminals
  4. After which I want to send pwd command (#2) again

To send this I was looking for a history of the commands I sent to all terminals in screen (like hitting up arrow in bash to go through the history). All I got was the last command executed.

How do I get to the other commands I've executed in screen? Specifically, in this example, how do I get to the command I typed at #2?

Upvotes: 1

Views: 2166

Answers (3)

Armali
Armali

Reputation: 19395

How do I get to the other commands I've executed in screen? Specifically, in this example, how do I get to the command I typed at #2?

  1. Press Ctrl-A
  2. Type : to get to screen prompt
  3. Hit twice to go to the second to last command executed

Upvotes: 0

stolen_leaves
stolen_leaves

Reputation: 1452

Did you try ctrl+r. This is for bash but also works on screen provided it was already in the history.

Just do ctrl+r and start typing the command. It will autofill the command from the history.

Upvotes: 0

sboda
sboda

Reputation: 363

if you type:

history

you will get the history of the commands. Will it help you?

Upvotes: 1

Related Questions