Linux: GNU/Screen Scroll Up and Down Look At Data

I am using GNU Screen software application to multiplex several virtual consoles. I can access multiple separate terminal sessions inside a single terminal window over remote ssh terminal session. Often I need to go though server logs located in /var/ directory. I can not seem to scroll up when I run tail -f /var/log/messages or /var/log/secure file. How do I use page-up / page-down keys to scroll up under GNU scree?

Tutorial details
DifficultyEasy (rss)
Root privilegesNo
RequirementsGNU/screen
Time1m
You need to use the following key combination to scroll up and look at your data under GNU screen. First press:

ADVERTISEMENTS

CTRL-A

Next press:
[

This will activate copy mode in GNU/screen. Now, you can scroll up/down and look at your data. Use the following keys:

  1. CTRL-u and CTRL-d scroll the display up/down by the specified amount of lines while preserving the cursor position. (Default: half screen-full).
  2. CTRL-b and C-f scroll the display up/down a full screen.

From the man page – following movement keys can be used in copy mode:

         h, j, k, l move the cursor line by line or column by column.
         0, ^ and $ move to the leftmost column, to the first or last non-whitespace character on the line.
         H, M and L move the cursor to the leftmost column of the top, center or bottom line of the window.
         + and - positions one line up and down.
         G moves to the specified absolute line (default: end of buffer).
         | moves to the specified absolute column.
         w, b, e move the cursor word by word.
         B, E move the cursor WORD by WORD (as in vi).
         C-u and C-d scroll the display up/down by the specified amount of lines while preserving the cursor position. (Default: half screen-full).
         C-b and C-f scroll the display up/down a full screen.
         g moves to the beginning of the buffer.
         % jumps to the specified percentage of the buffer.

For searching use the following vi like syntax:

  • /SearchWord – Vi-like search forward.
  • ?SearchWord – Vi-like search backward.

See screen man page for more information:
$ man screen

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
10 comments… add one
  • Michael Ray Dec 2, 2012 @ 1:54

    I always use Ctrl+A Esc, then just use the arrows and PageUp/PageDown to move through the scroll buffer (then just press Esc again to get out of copy mode). To me, that’s a little more intuitive than h/j/k/l and Ctrl+u/Ctrl+d.

    • martin Dec 3, 2012 @ 12:02

      +1

    • garconcn Jan 4, 2013 @ 23:39

      Thanks, Michael
      I prefer your method. This had bothered me for a long time. I had asked in other place before, but I didn’t find the solution.

    • Danilo Jan 21, 2014 @ 16:27

      Really helpful Michael! Thanks!

    • raj Aug 6, 2016 @ 15:28

      Thank you :)

  • ILMostro Nov 13, 2013 @ 7:27

    You could just use Shift-Pg_up & Shift-Pg_down

    • Laxmana Aug 14, 2014 @ 9:07

      Yes. It worked

    • Przemo-c Jul 21, 2015 @ 6:36

      When you’re in PuTTY it scrolls the putty terminal not the screen session

      • Putty Jul 13, 2016 @ 4:38

        Check the key bindings in putty if your having problems like that.

    • IanB Nov 24, 2015 @ 2:54

      That didn’t work for me using Gnome Terminal :(

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.