Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a file of having 200,000 lines. I wanted to do some extraction from this file (suppose policy no, name, age, sex etc.,) using awk, but it is taking lot of time. When I have done the same thing using cobol it gave quick result. Is indexing is possible in Awk? Kindly lemmi know and tell me how to use indexing in awk with a sample program. Thank you alot.
hello tink
Thank you for your reply. can you throw some idea how to find and delete big (waste) files in RHEL4. I used the command ls -ltRS which lists out all the files in a directory and subdirectories recursivly and size order. But the problem is how to delete the big files with a single shell script. Is there any command to find the files along with their path?
hi all
can anybody throw some idea how to find and delete big (waste) files in RHEL4. I used the command ls -ltRS which lists out all the files in a directory and subdirectories recursivly and size order. But the problem is how to delete the big files with a single shell script. Is there any command to find the files along with their path? Ofcourse i will select the waste files one by one and delete them with a single stroke.
If you have KDE installed, try using the disk space view in konqueror. This will scan all sub-directories of some directory (e.g. your HOME directory) and show you where the space is going.
A similar tool under Gnome is the Gnome Disk Analyser.
The core utils commandline tool to use for getting this sort of information is du. You need to experiment with it to understand how it works though. The -s option is useful. See the manual page for more information on that tool.
Or if you already can list all the files using ls or some other means (provided that the output of that command is "suitable"), just use xargs to perform rm on each of the files (note, this is pseudo-code):
That way they should get deleted too. Though I'd probably use find (as suggested above by allez), but it's your choice Maybe you should add the interactive switch to rm too, so that it asks on each file if it should be removed, or then you should maybe run the command without rm first (to see what's on the to-be-removed list), because it's nasty if you accidentally delete some important files..well, you have backups, don't you?
find / -size +10M -type f -exec rm {} \;
Modify the size part to your liking.
Beware of potential ill effects, e.g. deleting
a large log-file while a process is still writing
to it. The file will "disappear", but the space
it occupies won't be freed (and it will in fact
keep growing as it's a log) until the process
is stopped.
Or if you already can list all the files using ls or some other means (provided that the output of that command is "suitable"), just use xargs to perform rm on each of the files (note, this is pseudo-code):
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.