Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Sometimes I may need to access multiple log files for troubleshooting , but I don't want to open them in different terminals.

What I want is to open them in same terminal.

Is there any way I can view tail part of the multiple log files in a same terminal window ?

share|improve this question
1  
I don't have the time to post it as an answer, but you can open many files in one vim window. –  don.joey Mar 1 at 15:02
7  
A negative vote with out reason is not good my friends. –  AgentCool Mar 1 at 17:47
1  
...well, there's always tmux... –  haneefmubarak Mar 2 at 18:22

5 Answers 5

If you have for example /var/log/syslog, /var/log/auth.log log files, you can view them both in one terminal by executing tail -f command .

Open terminal and add the following command:

tail -f /var/log/syslog  /var/log/auth.log

The output:

==> /var/log/syslog <==
Mar  4 17:44:15 client AptDaemon: INFO: Quitting due to inactivity
    Mar  4 17:44:15 client dbus[815]: [system] Activating service name='org.debian.apt' (using servicehelper)


==> /var/log/auth.log <==
Mar  4 16:17:01 client CRON[13628]: pam_unix(cron:session): session opened for user root by (uid=0)
Mar  4 16:17:01 client CRON[13628]: pam_unix(cron:session): session closed for user root
share|improve this answer
2  
This is good answer too. –  AgentCool Mar 1 at 17:48
    
happy to hear that , mate –  nux Mar 1 at 17:51
2  
There is no need to repeat '-f' : tail -f /var/log/syslog /var/log/auth.log is fine. –  leucos Mar 1 at 23:43
1  
thanks for your comment , i will edit it –  nux Mar 1 at 23:45

To view tail part of multiple files in the single terminal window you can install multitail :

sudo apt-get install multitail

Usage: multitail <filename1> <filename2>.

So the output will be part of file1 and part of file2 in the same terminal.

hope that helps.

share|improve this answer
    
I've found this to be by far the most convenient way to monitor multiple log files. Very handy to work with and is customizable beyond belief. It can even stream log files to a specified port to be tail-ed from a remote machine. Can't recommend it enough. –  user1853181 Mar 2 at 7:48
    
I am glad that it helped you –  AgentCool Mar 2 at 8:40

If you have to ssh into a remote machine to watch the logs there, you can run tmux (or screen) there , and tail the logs in split windows. Works local as well.

share|improve this answer

In the default gnome-terminal, you can just use tabs - 'File' -> 'New Tab'

enter image description here

You can switch between the tabs with Alt+TAB NUMBER , each tab behaves similar to a new terminal. You can also switch with Ctrl+PgUp/PgDwn .

You can also detach one of the tabs into a new terminal window with 'Terminal' -> 'Detach Tab' .

share|improve this answer
4  
you really didnt get my point. I dont want to do it in many terminals.I want to do it in single terminal. –  AgentCool Mar 1 at 17:48
    
Sorry... just thought I would add in a conventional way. –  Wilf Mar 1 at 17:55

You can use tabnew <filename> in vim. To switch between tabs you can use Ctrl+PgUp and Ctrl+PgDwn.

You can jump to the end of file by pressing G in Terminal.

share|improve this answer

Your Answer

 
discard

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.