LinuxQuestions.org
Help answer threads with 0 replies.
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 09-03-2009, 02:27 PM   #1
evil_empire
Member
 
Registered: Mar 2005
Distribution: Fedora Core 3
Posts: 176

Rep: Reputation: 31
bash script for listing all users with emails greater than 100mb


Hi,
Help me with a bash script to get a list of all users on a server with more than 100MB of mail. (Mail is kept in /home/username/Mail/ for each user.)

I've never written a script before.

Thanks,
 
Old 09-03-2009, 02:42 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,674
Blog Entries: 14

Rep: Reputation: 1021Reputation: 1021Reputation: 1021Reputation: 1021Reputation: 1021Reputation: 1021Reputation: 1021Reputation: 1021
find /home -name Mail -a -size +100M |awk -F/ '{print $3}'

The above used the find command.

It searches under /home for any file with the name "Mail" that is 100 MB or greater in size.

This is then piped into the awk command. The options there set the field delimiter to "/" (intead of white space) then prints the 3rd field which would be the user's home directory which typically is the same as the user's login ID.

type "man find" for more detail on find command.

type "man awk" for more detail on awk command.
 
Old 09-03-2009, 07:18 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,254

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
You'll want to bookmark & read these:
http://rute.2038bug.com/index.html.gz
http://tldp.org/LDP/Bash-Beginners-G...tml/index.html

Possibly these as well
http://www.tldp.org/LDP/abs/html/
http://www.grymoire.com/Unix/ (specifically awk & sed)
 
Old 09-04-2009, 01:27 PM   #4
evil_empire
Member
 
Registered: Mar 2005
Distribution: Fedora Core 3
Posts: 176

Original Poster
Rep: Reputation: 31
Thank you very much jlightner.
And thanks to chrism01 too.
 
  


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
Bash processing tips needed for listing passwordless users. green_dood Linux - Software 4 05-15-2009 01:13 PM
Bash script for listing FTP usage as the file name of a file created in each share jojothedogboy Programming 1 12-05-2008 04:35 PM
NIC inits at 100MB; won't at 1GB w/o first plugging in 100MB cable! JMCraig Linux - Hardware 3 01-17-2006 07:50 PM
Multiple 100mb pipes on 100mb switches DLinkOZ Linux - Networking 2 10-22-2003 12:35 PM


All times are GMT -5. The time now is 09:44 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