Wednesday, December 14, 2011

important system information files in ubuntu

In ubuntu there is a directory which contains all the information of the hardware of the running system,which is /proc.

Given below are important and frequently used files you can find inside /proc directory.

/proc/cpuinfo – this file contains information about CPU such as vendor_id,cpu family,model
,model name,cpu MHz,cache size etc.

/proc/meminfo – this file contains information about memory such as MemTotal, MemFree, BuffersCached,SwapCached,Active,Inactive etc.

/proc/loadvg – this file contains cpu load average information in last 1,5,15 minutes respectively.

/proc/partitions – this file contains partition related information.

/proc/version – this file contains linux version and gcc version of the system.

How to send an email using a python script

Hi all,
If you want to send a mail you have to follow several steps including the following.
open up the web browser.
login into your account.
click on compose mail.
compose the message specify receiver and send the mail.

But if you can send a mail through a script it will save time for you.
Here is a python code for send a mail.

import smtplib
sender= 'senders_name@gmail.com'
receiver = 'receivers_name@gmail.com'
subject='Python is a powerful scripting language'
text = 'This is an auto generated email using python!!!'

# Credentials (if needed)
username = 'senders_name'
password = 'password'

msg = """\
From: %s
To: %s
Subject: %s

%s
""" % (sender, receiver, subject, text)


# The actual mail send
server = smtplib.SMTP('smtp.gmail.com:587')
server.starttls()
server.login(username,password)
server.sendmail(sender, receiver, msg)
server.quit()

if the file name is mail.py
run this command in terminal by typing

>>python mail.py

Monday, December 12, 2011

How to access and see web contents without a browser

Hi all,
Have you ever seen contents of web pages without a web browser? There is a method in ubuntu to read web pages in terminal.This is really easy and it is a matter of installing just a one package.


sudo apt-cache search elinks
elinks - advanced text-mode WWW browser

sudo apt-get install elinks

to visit google :
>>elinks www.google.com