Skip to main content

Questions tagged [tail]

Tail is a command-line program that by default outputs the last ten lines to standard output; with other command switches, particular numbers of lines can be specified and files can be monitored in real time.

Filter by
Sorted by
Tagged with
1 vote
1 answer
54 views

Why doesn't the given command mask other lines? [duplicate]

Command: sudo find / -name miniedit.py -print | grep -i "miniedit" | tail -1 Output: find: ‘/proc/10031/task/10031/net’: Invalid argument find: ‘/proc/10031/net’: Invalid argument find: ‘/...
kesarling's user avatar
  • 121
1 vote
1 answer
699 views

Why does tail -f stop following /var/log/syslog?

Ubuntu 22.04. I am following /var/log/syslog with the tail -f command. It's a connection via ssh. It will follow the output of syslog for a couple of days, then just stop updating. It just sits there. ...
thatjackelliott's user avatar
1 vote
1 answer
1k views

How to display the last 10 lines that are added to a log file with `tail`?

I need to display the last 10 lines of a log file with tail. I currently us this command: tail -n 10 -f /var/log/myapp/access.log but it is not working as expected, as it doesn't follow new lines as ...
Siyabonga Ngele's user avatar
1 vote
2 answers
2k views

How to tail multiple gz files

To tail multiple log files, I use: tail /path/to/logs/*.log To tail a zipped log file: zcat /path/to/mylog.1.gz | tail But I'd like to tail multiple zipped log files since the output of the ...
Gayan Weerakutti's user avatar
1 vote
2 answers
931 views

How can I use bat command as an alternative to tail command?

I love the syntax highlighting of cat. So I want to use it as an alternative to tail command. But I cannot find a generic way to accomplish this. But I can use this command as an alternative to tail ...
Ridwan Faiz's user avatar
0 votes
0 answers
261 views

Tail in combination with sort

I use tail in a variable to echo contents of multiple files in a folder. VAR="$(tail -n +1 DIR/*/file)" This outputs all the files contents with the needed filename on top like ==> /...
diggidre's user avatar
  • 111
0 votes
6 answers
344 views

Cut last two lines of a file and append to another file repeatedly

I tried the following command to cut out the last two lines of a file and append them to a new file tail -n -2 file1 >> file2 && head -n -2 file1 > tmp && mv tmp file1 With ...
diggidre's user avatar
  • 111
0 votes
1 answer
221 views

multitail regex not working

I am trying to use multitail to colorize some log files for a program I have written. I've created my own colorscheme within /etc/multitail.conf and I am able to colorize a very simple regex that ...
JLCarveth's user avatar
0 votes
1 answer
896 views

How to open command on second tab in bash terminal [duplicate]

So I am writing a script and I want to export a log but open the tail command in another tab. So far this is what I have come up with in BASH. ./configure &> log.configure.txt && gnome-...
user avatar
0 votes
1 answer
340 views

terminal, tail, check 2 logs separated, with grep (or some option)

need check 2 logs in one window. I know there is multitail, but how can I use this with some pipe (grep or some filtering for example)? Example. multitail A.log (B.log | grep 193.85.23.66) Thank you.
genderbee's user avatar
  • 850
0 votes
0 answers
326 views

How to listen a result from a command using tail?

I would like to perform this command: tail -f | tac myfile.txt tac reverts the order of the lines, the command works fine, except for the "listen" part. When the file is updated, the tail ...
FabianoLothor's user avatar
0 votes
3 answers
1k views

head and tail command output together on file

Suppose I am having file named file1.txt with the content as 1,2,3.. upto 100 linewise. $> head -n 5 file1.txt //will display first 5 lines i.e. 1,2,3,4,5 $> tail -n 5 file1.txt // will display ...
Amul Bhatia's user avatar
0 votes
0 answers
134 views

Feeding output of nvidia-smi to tail command returns error

I have a custom nvidia-smi message where some additional information (e.g., username) is also output underneath the original output of the nvidia-smi message. I want to feed that output to a tail ...
Sean's user avatar
  • 203
0 votes
1 answer
216 views

Copy last line of a local file onto a file on a remote server

I hope the title makes sense. I am trying to copy the last line of a file onto a file with same name on a remote server. For example: copy last line of server1:/opt/users.txt to server2:/opt/users....
Legio06's user avatar
  • 11
0 votes
0 answers
2k views

command history

Which is the most correct answer for this question: Write a one-line command that searches the last 50 commands that have been used for the term "find", and saves the result in history.txt ...
Riad B's user avatar
  • 1
1 vote
1 answer
223 views

How to tail a file with a randomized name?

I have a log file that I'd like to tail -f. I know which directory the file is in and the name of the file, up to a point. But, I know that there will be a random 9 digits added to the end of the file ...
michaelrbock's user avatar
4 votes
1 answer
2k views

Difference between head and tail

Why is there a difference between the meaning of NUM in head -c and tail -c? I will clarify what I mean with the following commands: $ echo "words" | tail -c +1 words $ echo "words" | tail -c +2 ...
fangio's user avatar
  • 147
2 votes
1 answer
412 views

How to find a binary name with only the prefix?

Context: I have a bash script that generates a windows import library from a MinGW cross-compiled DLL. As part of the build process, it runs llvm-dlltool-6.0, because that happens to be the specific ...
Robert Fraser's user avatar
0 votes
1 answer
2k views

tail: not found on a Chroot Directory, how i enable it?

I'm really a noob on Ubuntu, I'm facing a simple problem that I don't find anywhere, I follow this tutorial to make an ssh jail directory https://www.tecmint.com/restrict-ssh-user-to-directory-using-...
wavrik's user avatar
  • 101
1 vote
0 answers
1k views

'tail -F' behaving unexpectedly on truncated file

I'm trying to follow everything written to a log file in a terminal. In terminal 1 i do: tail --retry --follow=name /tmp/test_log or alternatively: tail -F /tmp/test_log In terminal 2 i ...
Andreas_75's user avatar
0 votes
1 answer
189 views

Tailing Apache Logs - What is the number after the IP address

I am tailing the Apache error logs on my VPS so I can watch the traffic go by. I have been under a DOS attack, or a heavy port scan. I have the apache logging level set to LogLevel Warn. What does the ...
wruckie's user avatar
  • 189
0 votes
1 answer
47 views

Monitor log file event it was deleted and created again

I do file monitor with help of command: tail -f foo.csv After logging program restart file is deleted and created new one with the same name. But monitor window stops showing records of newly ...
vico's user avatar
  • 4,637
6 votes
1 answer
9k views

How to unzip only the first few lines of a zip archive?

I have a zipped text file a.zip I want to read the first 10 lines of it. Is it possible to do that without unzipping the whole file?
yukashima huksay's user avatar
0 votes
0 answers
689 views

Getting line number in tail -n

I want to get the lines starting from line number of the actual file and also get the actual line number in output as well. I tried tail +30 log.log | nl but above one is giving the output line no....
jbmyid's user avatar
  • 149
3 votes
2 answers
2k views

Start and terminate TAIL running via SSH using BASH

I am trying to monitor the changes of a file via SSH and copy the changes of it in local computer using BASH. I ran the following command to monitor and copy: ssh [email protected] "tail -F /media/...
Russo's user avatar
  • 1,898
2 votes
1 answer
350 views

monitor syslog and print line without `pattern`

I would like to monitor my /var/log/syslog continuously. However while monitoring, I would like to avoid certain pattern(s) while monitoring. I am interested only in the last 15 (for example) lines. ...
Mike V.D.C.'s user avatar
3 votes
2 answers
13k views

What package is tail included with? [duplicate]

What package is tail (the command-line tool to see the end lines of a file) included with in the latest stable version of Ubuntu, if I want to install or uninstall it (and does it come installed by ...
Brōtsyorfuzthrāx's user avatar
0 votes
1 answer
734 views

Ubuntu Service with tail not starting

I've managed to create my own service script, however it's having some problems starting. From the service I'm calling the following script in /usr/bin/myscript.sh: #!/bin/bash tail -f /path/to/error....
WesselV's user avatar
  • 119
1 vote
2 answers
375 views

Tail the last 5 lines, over-writing the last 5 displayed lines when more are added?

When using tail -f to display the last few lines of a file, how can I make it only ever display 5 lies, overwriting previous lines when the file is added to?
Ginger's user avatar
  • 215
15 votes
6 answers
18k views

Which is faster to delete first line in file... sed or tail?

In this answer (How can I remove the first line of a file with sed?) there are two ways to delete the first record in a file: sed '1d' $file >> headerless.txt ** ---------------- OR ----------...
WinEunuuchs2Unix's user avatar
0 votes
0 answers
4k views

How to extract files using the dd command?

I'm trying to extract a squashfs file from a .bin What I did so far: I used binwalk to locate the pointers: binwalk data.bin DECIMAL HEXADECIMAL DESCRIPTION -----------------------------...
StruDJA's user avatar
0 votes
1 answer
347 views

Tail - like tool for log files [duplicate]

I want a tool that offers tail-like functionality for large files. (which are in a remote server and mounted on my system, for what that matters). I am aware of glogg but I am having issues with auto ...
pkaramol's user avatar
  • 2,231
7 votes
4 answers
5k views

Move only the last 8 files in a directory to another directory

I'm trying to move the last 8 files from the Documents directory to another directory, but I don't want to move them one-by-one to that specific directory. Is it possible to move them with a ...
Sandra Ross's user avatar
0 votes
1 answer
675 views

Running tasks in remote server via SSH - life cycle?

Two related questions: If I ssh into a remote server and start a long running task in the foreground (:~$ ./my-task > out.log), will the process continue to run when my connection to the server ...
rodrigo-silveira's user avatar
0 votes
1 answer
2k views

Ending a tail -f on log files

I have to kill the tail -f process after using it to tail log files. Is there a way to end the process within the tail -f display of the logfile?
Don's user avatar
  • 293
2 votes
2 answers
553 views

tail -f grep for one paragraph

I have a flowing log file that is separated by empty lines. It's difficult to tail it with grep 'PID' - when I do that it shows only 1 line. This is the Sample: [7/12/16 17:00:12:206 WIB] ...
Erichlong Mezque's user avatar
65 votes
3 answers
85k views

User limit of inotify watches reached on Ubuntu 16.04

I just installed Ubuntu 16.04 and I get this warning when I start SmartGit: IOException: User limit of inotify watches reached Moreover I get this warning launching tail -f: tail: inotify resources ...
Andrea's user avatar
  • 1,057
1 vote
0 answers
526 views

Zombie being made from 'tail -f' cron job that grep's and launches shell script

I realize that a single zombie process like this is nothing to worry about, I just want a more professional outcome (no zombie) from my code. My cron job calling a shell script produces a single ...
kenneth558's user avatar
1 vote
3 answers
3k views

`tail` and append in oneliner

How could I tail and append a text in a file, in one line, in Bash? My failed attempt would be tail file.txt > file.txt && date >> file.txt
autorun's user avatar
  • 273
2 votes
1 answer
1k views

Have bash script run against a live file - Is it possible?

I have a script I've written and (finally) have it working like I want it to, as long as I run it against a static file. Is there a way to tail a live file and have the script perform its actions ...
samgoober's user avatar
2 votes
1 answer
430 views

Is there a maximum amount of time that tail -f can reliably run?

I have noticed that when I tail -f various log files (specifically Apache access/error logs), that it ceases to actively scroll output after a certain of number of hours. I am uncertain if this is a ...
youcantexplainthat's user avatar
2 votes
2 answers
600 views

Command substitution using grep'ed and sed'ed tail -f output as argument source into 'at' command

This is for a home surveillance system, headless server running Ubuntu 15.04, and I want its security to be exemplary. I envision a command line solution (with optional script, if absolutely necessary)...
kenneth558's user avatar
1 vote
2 answers
2k views

Why redirection to a while loop doesn't print the messages?

Here is a shell code used to track changes in a file and output the content to the terminal: while read LINE do echo $LINE done < `tail -f /var/log/messages` It doesn't work, why?
Searene's user avatar
  • 4,410
2 votes
3 answers
4k views

How do you get those nifty transparent log displays?

So I've seen plenty of displays of transparent logs or running logs or htop instances on what appear to be fixed areas of a desktop. I think this is something like root-tail but I can't get root-tail ...
user447607's user avatar
4 votes
1 answer
16k views

Why won't `tail -f` follow my syslog when running live?

I want to monitor /var/log/syslog for any changes in realtime (or within-a-few-seconds-of-time), but tail -f won't update with any new changes. I'm running Ubuntu-based Linux Mint 17 XFCE live now, ...
Xen2050's user avatar
  • 8,815
2 votes
0 answers
283 views

solaris tail on ubuntu

Is there a way to make linux tail understand the Solaris tail syntax (precisely like tail +2)? The short story is that I have some update scripts written for Solaris on the repo and I cannot modify ...
spliff_thief's user avatar
11 votes
2 answers
4k views

Ending tail -f after print n lines

I have the following. A Java process writing logs on file A shell script starting the Java process. I need to read the log file after start Java process to check correct starting. I have try with ...
theShadow89's user avatar
92 votes
2 answers
52k views

tail: Reading an entire file, and then following

I would like a tail -f type of behavior that reads the entire file and then continues to follow it as it's written to. SOLUTION Based on the answer I accepted, this works: tail -f -n +1 {filename} ...
Sonny's user avatar
  • 1,265
0 votes
1 answer
290 views

KDE, how to have "tail -f" constantly on a dedicated panel?

Plasma has this nice plasmoid called File Watcher. At work I have 2 monitors. I would like to put this plasmoid on an empty panel on the second monitor. So that tail -f /var/log/apache2/error.log ...
nulll's user avatar
  • 629
4 votes
2 answers
8k views

'tail' command not getting only the new lines

I'm using the command: tail -f -n 0 file.txt But it keeps repeating itself. What I'm doing is the following: Create the file in the first terminal: touch file.txt Start the tail in the second ...
Edu's user avatar
  • 143