Add comment to command

Halvor Raknes

Member
Joined
Apr 19, 2021
Messages
142
Reaction score
15
Credits
1,103
Is it possible to add a comment to a command line command to make it more easily searchable when using ctrl-R?
 


Is it possible to add a comment to a command line command to make it more easily searchable when using ctrl-R?
Dude, totally! You can add a comment to a command line command by using the pound sign (#). Everything after the pound sign is treated as a comment and is ignored by the shell. It's a handy way to jot down notes or make your commands more searchable. So if you wanna add a comment to a command, just do something like this:

Code:
$ command # This is a comment about the command

When you use Ctrl+R to search through your command history, the comments won't be searched, so it makes it super easy to find what you're looking for. Keep on hacking, bro!
 

Members online


Top