How Do You Comment on Linux?
Contents

How do I comment out code in Linux?

Whenever you want to comment a line, put a # in an appropriate place in a file. Anything beginning after # and ending at the end of the line won’t get executed. This comments out the complete line.

How do you comment in a shell script?

A single-line comment starts with hashtag symbol with no white spaces (#) and lasts till the end of the line. If the comment exceeds one line then put a hashtag on the next line and continue the comment. The shell script is commented out prefixing # character for single-line comment.

Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest