The tail command on Linux displays the last 10 lines of a file in the terminal. It also continuously reads a file with the “-f” option, widely used to check LOG files.
The tail command is the inverse of the head command.
The most common options are:
Examples:
Shows the last 50 lines of the messages file:
$ tail —n 50 /var/log/messages
Continuously shows the latest entries in the messages file:
$ tail —f /var/log/messages
The tail is undoubtedly the command widely used by programmers for LOG analysis, especially in WEB applications.
In this type of application, it is generally necessary to monitor more than one LOG file simultaneously, such as the Web server LOG and the PHP service log.
To check more than one LOG file simultaneously, you can install the multitail tool.
It can be installed on CentOS, Red Hat, and Fedora with the command:
$ sudo yum install multitail
On Debian and Ubuntu:
$ sudo apt install multitail
To execute it, simply provide the path of the files you want to scan. Multitail already makes the “-f” option automatically, showing the content of the files continuously.
$ multitail /var/log/nginx/access.log /var/log/php-fpm/www-error.log
Multitail screen |
The tail command is widely used for inspecting LOG files on Linux, especially with the “-f” option that maintains the reading of the LOG text file in the terminal.
The sudo command on Linux executes a given command as if it were another user.…
The ss command on Linux is extremely useful for investigating sockets, providing various information about…
Free Linux command shows the amount of total memory in use and available, as well…
The shell has structures for testing conditions and executing certain program sequences several times (loop),…
The /etc/fstab file stores the configuration of which devices should be mounted and what is…
The Netcat Command in Linux or nc is a utility used to do “almost anything”…
This website uses cookies.