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.
During my 'studies' I have been using many man pages and am often left puzzled by some of the terminology used. In particular while studying user administration I have been investigating the id command.
There are two options used with this command that return a rather obscure message. The id -n and id -r both return the message that 'it cannot print only names or real id's in default format' For the life of me I cannot fathom out exactly what this actually means. Can anyone shed any light or am I being particularly dense?
The id -n and id -r both return the message that 'it cannot print only names or real id's in default format'
Hit, sunk!
You found a documentation bug.
On the other hand, if you look in the man-page, you see three possible options in parenthesis. What you need to know (but nobody is obliged to), is that "with" means in reality: “This option only works with one of the following three, never more than one of them, though”.
Like in:
id -n -u
id -n -g
id -n -G
But have mercy with the authors. The necessity to reformulate, often arises only after a few people have complained. Many do never complain, though. And my own wisdom I got from consulting the German version of the man-page, which can (or not) hint at an improvement during translation...
One of the best bosses in the world (I was a lucky guy) insisted on a very verbose documentation style and on the expression also of all “implicitly clear” facts, as they never are to everybody.
But software developers are sometimes proud of the confusion they create. And some people are proud of the confusion they create, without even being software developers.
... I say: Keep Them Coming! Someone will straighten that out, if we make enough noise.
Last edited by Michael Uplawski; 09-22-2018 at 03:30 AM.
Reason: ... this topic always makes me tremble with anger.
For the "-n" and the "-r" options, we see from the man pages:
Code:
-n, --name
print a name instead of a number, for -ugG
-r, --real
print the real ID instead of the effective ID, with -ugG
Actually, we are being instructed that -n and -r options are not to be used alone but together with -u, -g or -G. So, below is an example:
Code:
user1@desktop:~$ id -n
id: cannot print only names or real IDs in default format
user1@desktop:~$ id -r
id: cannot print only names or real IDs in default format
user1@desktop:~$ id -u
1000
user1@desktop:~$ id -n -u
user1
user1@desktop:~$ id -g
1000
user1@desktop:~$ id -n -g
user1
user1@desktop:~$ id -r -g
1000
user1@desktop:~$ id -G
1000 11 17 18 19 20 80 90 100
user1@desktop:~$ id -n -G
user1 floppy audio video cdrom games apache pop users
user1@desktop:~$ id -r -G
1000 11 17 18 19 20 80 90 100
Thank you Aragorn
Now you have pointed it out... its bl..... obvious.. Thank you.
Actually, we are being instructed that -n and -r options are not to be used alone but together with -u, -g or -G. So, below is an example:
Thank you Aragorn
Now you have pointed it out... its bl..... obvious.. Thank you.
Actually, we are being instructed that -n and -r options are not to be used alone but together with -u, -g or -G. So, below is an example:
Not necessarily true for all CMDs/utilities!
-x is the "short option" or switch and
--x would be the "long option" or switch.
take
Code:
ls -al
as an example,
The long options are better at conveying intent, thus you don't need to consult the man page when you read
Code:
ls --almost-all --dereference
says this.
I believe people got tired of the long option switches back the olden days and asked devs for short ones.
Not all long options have short options. So As usual
Code:
man <utility>
is the place to look.
On my mac, there is no short "-r" for the id command.
Sometime they just aren't documented correctly.
I think that's why we're supposed to "check" /usr/local/share/doc/<utility>
under such conditions.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.