Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose you type a command in terminal after Enter you will see a list which more than one page. Now you want to read the result from the beginning and you should scroll up. So if you put some commands before your last one its a bit difficult to scroll the the last one --at least for me -- So I need any key switch which show the screen from the last command.

ps: I want to screen show the last command by key switch. Is there any key switch like CTRL+ L which clear the screen. less command show the screen page by page.

share|improve this question
up vote 8 down vote accepted

There isn't one as far as I know. You have a few choices though:

  1. Pipe the output through less or more

    command | less
  2. Hit the up until you find the command you ran and run it again (optionally using less or more again).

  3. Run the previous command through less using history expansion.

    !! | less
  4. Use a terminal that supports searching through the scroll back. The image below is showing my preferred terminal, terminator (installable with sudo apt-get terminator) but Ubuntu's default terminal also supports this. Just hit Ctrl Shift F to show the search bar. If you then search for either the command's name or your username (which appears in your prompt) you will be taken directly back to the last command:

    enter image description here

share|improve this answer

Pipe the result through less,

some-command | less

From the man page;

Less is a program similar to more (1), but which allows backward movement in the file as well as forward movement.

share|improve this answer

So basically you want it to automatically scroll to the last prompt, and the command that was run from it? I don't think this is possible with current versions of terminal unless you use a find function.

However as an alternative, you can colour in the prompts so that it is easier to work out where they are: enter image description here

You can do this in Ubuntu* by going to the ~/.bashrc file, and uncommenting this line:




You can then save it and run source ~/.bashrc and see the changes straight away.

*In other Linux OS's, on versions of Ubuntu without this version of ~/.bashrc, just copy lines 31 to 78 (only most of it is needed) of this and then uncomment #force_color_prompt...

share|improve this answer
Tthats how i do it so I can read any long terminal outputs of my Linux machines that i SSH into. I think its enabled on Raspbian (A Raspberry Pi OS) for this reason as well. Thanks :) – Wilf May 20 '14 at 19:40

If you're using gnome-terminal, what you can do is just copy the content of the terminal to a text file using "Edit->Select All" and "Edit->Copy".

Note: It will work only if you have set an unlimited scrollback.

Now open the text file in your favourite editor and find the previous occurrence of your shell prompt.

It's often easier to perform lookup operations in a text editor (amongst other things).

share|improve this answer

What about using a new terminal for every command? In gnome Terminal Ctrl+Shift+T Spawns a terminal in a new tab at the current directory.

share|improve this answer

If you can use Emacs, its shell mode keeps an infinite log of your input and output, which you can scroll back and forth through. It has a command ctrl-meta-L, or escctrl-L, which will usually jump back to the start of the output that follows the most recent line of input that you typed.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.