LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Save me!!!!!!!!!!! (https://www.linuxquestions.org/questions/linux-newbie-8/save-me-661736/)

mangus123 08-10-2008 04:02 AM

Save me!!!!!!!!!!!
 
can someone pls help me out!!!!!!!!

I am new to Linux and using Fedora5, all is good but have got a interview coming up. the questions I've got are

1. how do you list the largest file sizes from the root.( just so that I can compress them using a Gzip )

2. Do we have to write the file logrotate.conf from the start or is it just good enough if i can just manipulate whats in the script?

arizonagroovejet 08-10-2008 04:53 AM

Do you know that Fedora 5 is way past the end of it's supported life cycle? No updates are being issue for Fedora 5 and haven't been for a few years. Fedora 9 is the current version. It would be a good idea to upgrade. (I am always curious as to why it is some people who are new to Linux start off with very outdated versions. Anyway...)


1) I'm not entirely sure what you mean. 'du -hs' will give you a list of all the files/directories in the current working directory and their sizes. However run in / that could take a while to complete. There is no recursive option - it would take ages if there was and you ran it in / It's possible to sort the files/directories by size but I discovered it was surprisingly difficult when I wanted to do it a while back. I came up with this, adapted from something I found via Google.

Code:

foo=`du -s ./* ./.[a-zA-Z0-9]* 2>/dev/null| sort -rn | cut -f 2- | while read a; do if  test -d "$a";then echo "\E[1;34m" ;fi; du -sh "$a";echo  "\E[0m\n"; done`
echo -e " "$foo | less -r

If you want to find all files over a certain size then look at the find command.

2) I don't see why you'd need to write logrotate.conf from scratch. If you ever managed to delete it then the most sensible thing to do would be to restore it by copying it over from another machine running the same version of Linux. In the years I've been managing Linux machines I've never altered logrotate.conf.


Oh, and using sensible titles for you posts is a good idea.


All times are GMT -5. The time now is 12:30 PM.