Best Answer: How Do I Create a Log File in Linux Script?
Contents

How do you create a log file in Unix script?

To write output of Bash Command to Log File, you may use right angle bracket symbol (>) or double right angle symbol (>>). Right angle braketsymbol (>) : is used to write output of a bash command to a disk file. If the file is not already present, it creates one with the name specified.

How do I create a log file in Linux?

2 Answers. Just cat <log message here> >> custom. log . The >> means add on to the bottom of the file rather than > which would delete the contents of the file and then write the message.

Sophia Al-Mansoor

Sophia Al-Mansoor

Global Business & E-Commerce Reporter

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.

Share this article
Twitter Facebook Pinterest