LinuxQuestions.org
Visit Jeremy's Blog.
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-11-2005, 08:32 AM   #1
gfrair
LQ Newbie
 
Registered: Jan 2005
Posts: 20

Rep: Reputation: 0
different searches...


Hello, i am very new to the linux command line and need some help.

I need to perform the following types of searches:

- find the largest file on the system

- find all files of a certain file size (e.g. 5728 bytes)

- find all files and folders owned by a certain user

- find the oldest file on the system

- find the percentage of files in '/home' that contain 'j'

- find how many symbolic links are on the system

If any of you linux guru's out there know any commands or scripts that may help me, I would be very greatful.

Thanks
 
Old 03-11-2005, 11:29 AM   #2
harken
Member
 
Registered: Jan 2005
Location: Between the chair and the desk
Distribution: Debian Sarge, kernel 2.6.13
Posts: 666

Rep: Reputation: 30
Take a look at:
http://www.tldp.org/LDP/Bash-Beginne...ers-Guide.html
especially chapters 1, 2, 3.2, 7 and 9.

Don't know why but something smells like homework (I'm probably mistaking though).
 
Old 03-11-2005, 12:02 PM   #3
chbin
Member
 
Registered: Mar 2005
Distribution: slackware-current
Posts: 379

Rep: Reputation: 31
you can do all that with the find command

$ man find

For instance one way to find the largest file that is in the /home directory

find /home -type f -printf %s'\t'%p'\n' | sort -g | tail -n 1

That is not the only way of doing it nor do I say it is the most efficeint only that is works. In linux there many ways to do what you are asking. Just a matter of how creative you want to get and how much knowledge you have.
 
Old 03-11-2005, 12:11 PM   #4
chbin
Member
 
Registered: Mar 2005
Distribution: slackware-current
Posts: 379

Rep: Reputation: 31
By the way everything you ask can be done by simple piping and redirection except, - find the percentage of files in '/home' that contain 'j'. Probaly can be done in one command at the shell with some creative redirection and using the right command, but a small script should do it easy too.
 
Old 03-11-2005, 12:22 PM   #5
chbin
Member
 
Registered: Mar 2005
Distribution: slackware-current
Posts: 379

Rep: Reputation: 31
- find all files of a certain file size (e.g. 5728 bytes)
find /home -type f -printf %s'\t'%p'\n' | grep 5728

- find all files and folders owned by a certain user
find -type f -group users

- find the oldest file on the system
creation time? access time? anyway can use the find command again and pipe or write a small script.

- find how many symbolic links are on the system
find /home -type l | wc -l
 
Old 03-11-2005, 12:26 PM   #6
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
Come on guys, this is homework. Make him do it himself!
 
Old 03-11-2005, 12:45 PM   #7
chbin
Member
 
Registered: Mar 2005
Distribution: slackware-current
Posts: 379

Rep: Reputation: 31
Smile

Yeah sorry I just realized that it is most likely homework. All being about find this that and the other thing. I never took any unix class so I never thought about it. I'll be more carefull next time http://images.linuxquestions.org/que...cons/icon7.gif
 
Old 03-13-2005, 12:17 AM   #8
gfrair
LQ Newbie
 
Registered: Jan 2005
Posts: 20

Original Poster
Rep: Reputation: 0
thanks everybody (except Komakino, jackass),

Your input was greatly appreciated.
 
Old 03-13-2005, 06:45 AM   #9
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 472Reputation: 472Reputation: 472Reputation: 472Reputation: 472
Greg - politeness costs nothing. Lack of same will lead to you not being able to post to this board. Read the Rules again - there are specialist boards that will do your homework for you, this is not one of them.
 
Old 03-13-2005, 08:15 PM   #10
gfrair
LQ Newbie
 
Registered: Jan 2005
Posts: 20

Original Poster
Rep: Reputation: 0
i apologize, just in a bad mood cuz i can't figure out the percentage thing.

sorry though,
 
  


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
bug searches, reporting absalon Linux - General 3 07-05-2005 06:47 PM
Save favorite searches username17 LQ Suggestions & Feedback 3 05-28-2005 09:40 AM
Making searches more precise? rose_bud4201 LQ Suggestions & Feedback 1 04-26-2005 07:09 PM
Multiple searches? genderbender Programming 7 01-30-2005 05:20 PM
Searches Thulemanden LQ Suggestions & Feedback 1 12-05-2004 11:26 AM

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

All times are GMT -5. The time now is 05:08 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration