LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   different searches... (https://www.linuxquestions.org/questions/linux-newbie-8/different-searches-300371/)

gfrair 03-11-2005 07:32 AM

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

harken 03-11-2005 10:29 AM

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).

chbin 03-11-2005 11:02 AM

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.

chbin 03-11-2005 11:11 AM

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.

chbin 03-11-2005 11:22 AM

- 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

Komakino 03-11-2005 11:26 AM

Come on guys, this is homework. Make him do it himself!

chbin 03-11-2005 11:45 AM

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

gfrair 03-12-2005 11:17 PM

thanks everybody (except Komakino, jackass),

Your input was greatly appreciated.

XavierP 03-13-2005 05:45 AM

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.

gfrair 03-13-2005 07:15 PM

i apologize, just in a bad mood cuz i can't figure out the percentage thing.

sorry though,


All times are GMT -5. The time now is 02:14 PM.