LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 12-28-2016, 06:50 AM   #1
linux4evr5581
Member
 
Registered: Sep 2016
Location: USA
Posts: 275

Rep: Reputation: Disabled
Need Help Understanding find Syntax


Hey guys I dont understand why this find command outputs different results...

find / -uid 1000 VS find / -uid -1000

Why does the command that has a dash in front of the 1000 output so much more text? (the VS is not part of the command it means versus)
 
Old 12-28-2016, 06:56 AM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,627

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
Quote:
Originally Posted by linux4evr5581 View Post
Hey guys I dont understand why this find command outputs different results...

find / -uid 1000 VS find / -uid -1000

Why does the command that has a dash in front of the 1000 output so much more text? (the VS is not part of the command it means versus)
You need to read the man page carefully.
Numbers in the find command, as clearly documented, can be without signum (meaning exactly), they can have a leading + (meaning more than), or have a leading - (meaning less than).
Your first command is finding all files and folders belonging to the user with UID 1000. Your second command will find all files and folders belonging to users with UID less than 1000 (including root), thus the MUCH larger list.
Look it up and read carefully.
 
2 members found this post helpful.
Old 12-28-2016, 07:03 AM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
deleted. sorry.

Last edited by jpollard; 12-28-2016 at 07:05 AM.
 
1 members found this post helpful.
Old 12-28-2016, 07:11 AM   #4
linux4evr5581
Member
 
Registered: Sep 2016
Location: USA
Posts: 275

Original Poster
Rep: Reputation: Disabled
Thank you both that makes perfect sense I saw those symbols in the man pages, but i didnt know how to interpret them in this case.. One more question i meant to orginally ask but I forgot,
is ps syntax. Why is ps -ax not in the format ps -a x because theres not an -x? They seperate the aguments in this command ps -a f .. This is really confusing cause im not sure how to type them in the proper order..

Last edited by linux4evr5581; 12-28-2016 at 07:53 AM.
 
Old 12-28-2016, 07:43 AM   #5
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
4th block of man ps
 
1 members found this post helpful.
Old 12-28-2016, 08:07 AM   #6
linux4evr5581
Member
 
Registered: Sep 2016
Location: USA
Posts: 275

Original Poster
Rep: Reputation: Disabled
Thanks for pointing that out Habitual it says "These options accept a single argument in the form of a blank-seperated or comma-seperated list" But how would the system know if I wanted forest view for f, and not the full format listing option of -f if you can just bunch the commands together with different agument formats like ps -ax does..

Last edited by linux4evr5581; 12-28-2016 at 08:18 AM.
 
Old 12-28-2016, 02:36 PM   #7
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,627

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
Quote:
Originally Posted by linux4evr5581 View Post
Thanks for pointing that out Habitual it says "These options accept a single argument in the form of a blank-seperated or comma-seperated list" But how would the system know if I wanted forest view for f, and not the full format listing option of -f if you can just bunch the commands together with different agument formats like ps -ax does..
Again, you need to READ.

The man pages clearly state that the command can understand two kinds of short parameters:unix98 (single dash), BSD (no dash). It can also understand GNU parameters (double-dash long form). The pages go on to describe the different behavior of all of the kinds of parameters.
AND that they can be mixed on the command line, and (on my machine at least) how that looks using some examples.

The maintainers do not write all of those long man and info pages for no reason, most of your answers are right there if you only LOOK for it.
 
1 members found this post helpful.
Old 12-28-2016, 08:02 PM   #8
linux4evr5581
Member
 
Registered: Sep 2016
Location: USA
Posts: 275

Original Poster
Rep: Reputation: Disabled
Thanks for the response I just think man pages are bland in explanation, cause alot of the time I feel they require you already know what a partiular symbol means for regex, sed/awk etc (in this case bsd/unix/gnu formats, which Idk were)..Nevertheless I do skim through them looking for the info I need, but still not understanding how the system interprets the f from -f in ps -af.. I appreciate your response however i'm one step closer to understanding how this all works

Last edited by linux4evr5581; 12-28-2016 at 08:03 PM.
 
Old 12-28-2016, 10:25 PM   #9
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
I grant that not all of the man pages are written to the same quality...

It also takes some time to get used to the style.
 
Old 12-28-2016, 11:11 PM   #10
linux4evr5581
Member
 
Registered: Sep 2016
Location: USA
Posts: 275

Original Poster
Rep: Reputation: Disabled
True with practice makes perfect, I probaly should review man man
 
  


Reply



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
Understanding FIND johnywhy Linux - Newbie 4 05-03-2015 05:59 PM
find -exec syntax: bug in find? mfcarroll Programming 5 06-21-2007 07:13 PM
Understanding find manpage sporty Linux - Newbie 2 07-27-2006 01:39 PM
need help with find syntax stefaandk Linux - General 4 07-12-2006 05:48 PM
C++ syntax error before :: token HELP, i cant find the syntax error :( qwijibow Programming 2 12-14-2004 06:09 PM

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

All times are GMT -5. The time now is 09:32 AM.

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
Open Source Consulting | Domain Registration