Check tail of multiple files

7,329

Presumably

tail log*

is what you’re after. If your tail doesn’t support multiple arguments, which appears to be the case, you’ll need to loop:

for file in log*; do echo "==> ${file} <=="; tail "${file}"; done
Share:
7,329

Related videos on Youtube

terdon
Author by

terdon

Elected moderator on Unix &amp; Linux. I've been using Linux since the late '90s and have gone through a variety of distributions. At one time or another, I've been a user of Mandrake, SuSe, openSuSe, Fedora, RedHat, Ubuntu, Mint, Linux Mint Debian Edition (basically Debian testing but more green) and, for the past few years, Arch. My Linux expertise, such as it is, is mostly on manipulating text and regular expressions since that represents a large chunk of my daily work.

Updated on September 18, 2022

Comments

  • terdon
    terdon almost 2 years

    I'm trying to skim through multiple log files to find a specific event that I can't easily grep for. I know which files it could be in and I know what I'm looking for is at the end of the files. What I need is something like this but it's only reading the first file in the string. tail `ls -x log*`

    My bash is a bit rusty but I feel like I'm overlooking something simple. I am using HP-UX.