LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 03-21-2017, 03:24 PM   #1
chripy811
LQ Newbie
 
Registered: Mar 2017
Posts: 29

Rep: Reputation: Disabled
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


thanks,
 
Old 03-21-2017, 03:44 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133Reputation: 2133
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.
 
2 members found this post helpful.
Old 03-21-2017, 05:30 PM   #3
chripy811
LQ Newbie
 
Registered: Mar 2017
Posts: 29

Original Poster
Rep: Reputation: Disabled
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!
 
Old 03-22-2017, 05:31 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,655

Rep: Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484Reputation: 2484
Quote:
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

HTH & Welcome to LQ
 
Old 03-22-2017, 06:39 AM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 8,020
Blog Entries: 13

Rep: Reputation: 3475Reputation: 3475Reputation: 3475Reputation: 3475Reputation: 3475Reputation: 3475Reputation: 3475Reputation: 3475Reputation: 3475Reputation: 3475Reputation: 3475
Quote:
Originally Posted by chripy811 View Post
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 welcome to LQ!
 
Old 03-22-2017, 07:40 AM   #6
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 9,078
Blog Entries: 4

Rep: Reputation: 3176Reputation: 3176Reputation: 3176Reputation: 3176Reputation: 3176Reputation: 3176Reputation: 3176Reputation: 3176Reputation: 3176Reputation: 3176Reputation: 3176
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.
 
Old 03-22-2017, 09:56 AM   #7
petelq
Member
 
Registered: Aug 2008
Location: UK
Distribution: openSUSE(Leap and Tumbleweed) and a regularly changing third
Posts: 397

Rep: Reputation: Disabled
Also, if you want a quick check of most of these commands you can use
Code:
rm --help
The rm being the command (any command) with the 'help' flag.
It's quicker than the man pages but not as comprehensive.
 
Old 03-22-2017, 01:10 PM   #8
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 3,911
Blog Entries: 1

Rep: Reputation: 829Reputation: 829Reputation: 829Reputation: 829Reputation: 829Reputation: 829Reputation: 829
$ rm --help

(as previously listed) or

$ man rm

It tends to be documented. Although don't assume the -r means the same thing for all things, it doesn't. So always check if you're unsure.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] "net rpc" "failed to connect to ipc$ share on" or "unable to find a suitable server" larieu Linux - General 0 11-09-2014 12:45 AM
Can't stop fast typing double letters from "skipping" one of the letters. Lola Kews Ubuntu 3 04-20-2013 03:21 PM
[SOLVED] Ubunti 12.04: "Dash Home" logs me out LloydM999 Ubuntu 2 10-24-2012 12:51 AM
"info find" troubleshooting doru Linux - Newbie 4 10-25-2011 08:27 AM
Can't install "glibmm" library. "configure" script can't find "sigc++-2.0&q kornerr Linux - General 4 05-10-2005 02:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration