Using terminal pager in Linux (“less is more”, multitail and most)

Terminal pager is used to view (but not modify) the contents of a text file moving down the file one line or one screen at a time. Some, but not all, pagers allow movement up a file.

  • less@wiki/less@man is similar to more@wki, but has the extended capability of allowing forward/backward navigation and following a file.
## install
$ sudo apt-get|yum install util-linux

# navigation
'space,pgdown' next page
'b,pgup' previous page
'g,<' first line
'G,>' last line
'<n> G' line n
'F' enter follow mode, exit CTRL+C
$ less +F FILE

# search
'/ <text>' forward regexp search
'? <text>' backward regexp search
'n' next match
'N' previous match
$ less -I -p PATTERN FILE
  • multitail@wiki/multitail@man splits the terminal window or console (using ncurses) of a into two or more subwindows into which it can merge log files and command outputs.
## install
$ sudo apt-get|yum install multitail (EPEL) | sudo pacman -S multitail

# navigation
'b/B' scroll back selected/all windows
  'q' quit, 'g/G' goto first/last line, 'pgup/pgdown' page up/down
'Y' toggle line wrap
'F' simulate 'tail -f' mode

# window
'a/d' add/delete new window (or file to existing window)
'v' toggle vertical/horizontal window

# search
'/' regexp search
'I' toggle case sensitivity

'-i/I FILE' open file in new/previous window
'--mergeall' merge all windows
$ multitail /var/log/dmesg -I /var/log/syslog

'-l,L CMD' open command output in new/previous window
'-r/R INTERVAL' restarts command periodically, '-R' only shows differences
$ multitail -R 2 -l "netstat -tap"

'-s X' splits vertically 'x' columns
'-sn Y' how many windows per colum
$(2x2) multitail -s 2 -sn 2,2 FILE1..4

'-q INTERVAL PATH' periodicaly checks path for new files, '-Q' merges all in one window
$ multitail -Q 5 /var/log/*.log

from multitail@howtoforge

  • most@wiki/most@ is similar to more@wki, but has the extended capability of allowing both forward/backward and left/right navigation through the file, and supports multiple windows.
## install
$ sudo apt-get|yum install most | sudo pacman -S most

# navigation
'space,D,pgdown' page down
'U,delete,pgup' page up
'T/B' scroll top/bottom
'</>' scroll left/right
'J,G' goto line
':n' skip to next file

# window
'ctrl-w,x 2' horizontal split window in half
'ctrl-w,x 1' delete all other windows
'ctrl-x 0' delete this window
'o,ctrl-x 0' move to other window

# search
'S,f,/' forward search
'?' backward search
'n' next match
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s