Linux multitail

From Ever changing code
Revision as of 10:15, 26 February 2020 by Pio2pio (talk | contribs) (→‎Cheatsheet)
Jump to navigation Jump to search

Multitail allows to view many logs in multi window terminal.

Install

sudo apt-get install multitail

Key bindings

  • u select full size window; hide all windows except the one selected, cannot scroll
  • U back to multi-window view; un-hide all windows
  • b select a window to preview in a pop-up window, you can scroll
  • G select window to dump to a file
  • d delete window
  • m limit of lines to display, equivalent eg. tail -500
  • q exit
  • ctrl + g cancel /or return /or exit

Cheatsheet

while the program runs

r Redraws the screen.																								
q x	Exit the program.																								
0...9	Add a thick red line to window 0...9.  e Edit the regular																								
	expression for a window. First you have to enter the window-																								
	number (look at the status-line; just before the filename) and																								
	then you can edit the regular expression for that window. Empty																								
	the line to delete the regular expression.																								
d	Delete a window																								
a	Add a window																								
s	Swap the positions of 2 windows																								
v	Toggle vertical screen split																								
z	Hide/unhide window									
c	Set colors																				
w	Write script for restarting MultiTail.										
m	Set marker															
n	Delete a marker															
b	Scroll back (and forth)										
p	q					
i	Info


"scroll back"-menu

x q	Exit this screen.															
f /	Search for a string. You can enter a regular expression or just the string to search for.															
n	Search next instance, see f and /																								
e	Edit regular expression (filter) for displaying.														
s	Save buffered lines to file.


command line options

-i	Input file															
-I	Same as -i but add the output to the previous window (so the output is merged).														
-l	Command to execute in a window. Parameter is the command. Double quotes for args															
-L	Same as -l but add the output to the previous window (so the output is merged).														
-r interval		Restart the command (started with -l/-L) after it has exited.																							
-R interval		With interval you can set how long to sleep before restarting.																							
		Same as -r, only with this one only the difference is displayed.																							
-f	Follow the following filename, not the descriptor.														
-e	Use the next regular expression on the following file.															
-ec	Use regular expression on the following file and display the matches.														
-eC	Use regular expression on the following file but display everything and display the matches inverted.														
-E	Use the next regular expression on the following files.															
-v	Negate the next regular expression.
-s	Splits the screen also vertically.										
-cs	Show the next given file in colors (through syslog-scheme).										
-c	Show the next given file in colors.									
-cS	scheme
	Show the next given file using the colorscheme selected with
	scheme (as defined in multitail.conf).									
-Cs	Show all following files in color (through syslog-scheme).					
-C	Show all following files in color.									
-Cf field_index delimiter					
	Show all following files in color depending on field selected		
	with field_index. Fields are delimited by the defined delimiter.			
-cf field_index delimiter						
	Show the next file in color depending on field selected with	
	field_index. Fields are delimited by the defined delimiter.
-m nlines										
	Set mark and remember nlines lines. Set nlines to 0 (zero) if you want no limits on the buffering. Use this if you want to scroll back.									
-M nlines Set a mark on ALL following files.
-p x [y]
	Set linewrap: a = print everything including linewrap. l = just	
	show everything starting at the left until the rightside of the	
	window is reached. r = show everything starting from the right
	of the line. s = show everything starting with the processname.			
	S = show everything starting after the processname. o = show
	everything starting at offset 'y'.
-H interval Visual heart-beat (usefull when you want to keep your session alive). Interval is in seconds.


examples

multitail logfile -l "ping 192.168.1.3"									
	creates 2 windows, logfile content and output of ping command				
multitail -R 2 -l "netstat -t"