Can't find info on what the dash letters mean "-r"
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Can't find info on what the dash letters mean "-r"
Hello, I'm slowly learning linux. Quite often i see a dash and a letter after commands, I'm not even sure what the actual name of them are called.
For example: Today i had to delete some directories from my server, I went to computer hope and it told me which command to use. Although it doesn't explain what the dash and letter are.
This is the command:
rm -r mydir
Here's what i know:
rm= remove directory
mydir = name of my directory that i want deleted
what it doesn't say what the "-" or "r" means
Where can i get info on what these are and what they mean, i've seen the often in other commands
Those are flags. They provide extra information to the program that can change its functionality. You can see all of the flags available in a program in its "man" (short for manual) page. In this case, open a terminal and run "man rm". This page will tell you what the "rm" program does, how it works, and the available flags/options. For "rm", the "-r" flag means:
Code:
-r, -R, --recursive
remove directories and their contents recursively
You can see that there are multiple ways to set this flag as well. You could run "rm -r", "rm -R", or even "rm --recursive", all will do the same thing.
i find i learn better if i know what every single letter means,
Unfortunately that's a tad ambitious (if taken literally).
There are a lot(!) of cmds and each one has its own list of flags (aka options, switches).
Moreover any given one eg '-r' may or may not exist for a given cmd and if it does, it may well have a different meaning.
However, you should definitely look up all the ones you are thinking of using
i see! now i understand, i will be using the man command often, i find i learn better if i know what every single letter means,
thank you!
Using the man command is key for a lot of this. Down the bottom you see related commands, you also see things like result codes which you can check from the shell or check within a script.
Also note that many commands have two alternatives. For instance, -r might have a less-cryptic alternative, say, --recursive.
A single dash means that the option consists of a single character, and these might be combined behind one dash. For instance, ls -ra is equivalent to ls -r -a.
A double dash means that the option consists of a word.
All of this is left entirely to the discretion of the implementor of the command, and will be documented (if at all) in the man page ... e.g. man ls ... which is also left entirely to the discretion of the implementor.
Last edited by sundialsvcs; 03-22-2017 at 07:43 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.