Windows
Linux
Terminal & Shell Scripting
Terminal
Windows rem / :: equivalent in Linux
Adds human-readable comments to shell scripts that are ignored during execution.
Windows
→
rem / ::
Linux equivalents
#
#
#
Overview
What this command does
Adds human-readable comments to shell scripts that are ignored during execution.
Migration tip: In bash, # comments out the rest of the line. The first line of every script should be a shebang:
#!/bin/bash — this tells the OS which interpreter to use.Practical tasks
Common use cases
Add comments to scripts
Adds human-readable comments to shell scripts that are ignored during execution.
# comment
Single line comment
#!/bin/bash
Shebang — interpreter declaration (line 1)
: ' ... '
Multi-line comment workaround
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
./backup.sh
Walkthrough
Examples with explanations
#!/bin/bash
# This is a comment
# Author: John Smith
# Run backup
./backup.sh # inline comment
Reference
Common options and variations
| Command or option | Use |
|---|---|
# comment | Single line comment |
#!/bin/bash | Shebang — interpreter declaration (line 1) |
: ' ... ' | Multi-line comment workaround |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
This command is the same on Debian/Ubuntu, Fedora and Arch Linux when the relevant tool is installed.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | # |
Same command on this distribution. |
| Fedora | same command | # |
Same command on this distribution. |
| Arch | same command | # |
Same command on this distribution. |
Keep learning