How To Send Mail Using Mail Command in UNIX

Sometimes we need to send e-mails from UNIX command-line itself. Sometimes we need to write a small script to do so. Here’s what we need to do for such tasks. We can send mail in UNIX using “mail” command. Syntax is as follows, mail -s “Subject” -c “any_cc_email_id” -b “any_bc_email_id” “comma_separated_To_email_id” But the above syntax […]

Find all files having some pattern using grep in UNIX

How to find all files under a directory, having a pattern, in their name or content, in UNIX? grep command can be used in conjunction with xargs to fetch filenames having some pattern in them. find /search_dir/ -iname “*.*” -print0 | xargs -0 grep “PATTERN” where, search_dir is the directory where search has to begin […]