Understanding the difference between - and -- in terminal commands

Ever wondered why some commands use - and others use -- in your terminal? I used to type them without thinking, until I realized they actually mean completely different things 👇 Single dash (-) Used for short flags:- usually one letter. ls -l -a # or just ls -la Each letter represents a separate flag. Quick and old-school. Double dash (--) Used for long-form options, usually full words. npm install --global nodemon git commit --message "Initial commit" Way more readable, especially for scripts or tools you’ll revisit later. Double dash alone (--) This one’s a quiet hero. It means: Stop reading flags; everything after this is a normal argument.” "rm -- -file.txt" Without it, your command might think -file.txt is a flag and crash. I love these small details, they seem minor, but understanding them makes you faster and sharper at the CLI. #DevTips #CommandLine #NodeJS #Linux #Programming #CLI #DeveloperInsights

To view or add a comment, sign in

Explore content categories