You need to use the tail command which output the last part of files in real time including all incoming logs to a standard output device such as screen. This is useful to:
Tutorial details | |
---|---|
Difficulty | Easy (rss) |
Root privileges | Yes |
Requirements | None |
Time | 2m |
- View log files in real time.
- Debug server problems.
- Troubleshoot security issues.
- Monitor spammers, ip-address, scripts and more.
tail -f file-name command syntax
The basic syntax is:
tail fileName tail /path/to/log/file tail [options] /path/to/log/file
If your log file name is /var/log/lighttpd/access.log, enter:
tail -f /var/log/lighttpd/access.log
If your php log file name is /var/log/lighttpd/scripts.log, enter
tail -f /var/log/lighttpd/scripts.log
Sample outputs:
47 -> 400 2013-11-24 21:47:29: (request.c.622) invalid character in key GET /nixcraft/linux/docs/uniqlinuxfeatures/lsst HTTP/1.1 Host: cyberciti.biz Accept: */* Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0 FirePHP/0.7.4 /5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Firefox/24.0 FirePHP/0.7.4 47 -> 400
You will get a scrolling view of the /var/log/lighttpd/scripts.log for all incoming entries on screen. To stop simply hit CTRL+C. Please note that you may need to login as root user to view log files.
Recommend readings
- HowTo: See multiple log files on UNIX / Linux console using multitail command.
- See tail(1) command man page for more information.
🐧 Please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
🐧 Get the latest tutorials on Linux, Open Source & DevOps via:
- RSS feed or Weekly email newsletter
- Share on Twitter • Facebook • 2 comments... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
how do to view this tail -f log.log on a web?
not that simple, u must use ajax.