How to read the second-to-last line in a file using Bash? June 10, 2023 by Tarik Try this: tail -2 yourfile | head -1