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 |
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). |
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. |
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.
|
- 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 |
Come on guys, this is homework. Make him do it himself!
|
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
|
thanks everybody (except Komakino, jackass),
Your input was greatly appreciated. |
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.
|
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 10:49 AM. |