Tuesday 27 December 2011

Screens on linux.


In our training session on screens by  mr.kamesh. He teaches us the way to switch to different screens..
this is actually a very cool session to know the tricky things in screens.after these sessions we search about this in google and we come to know even more shortcuts to play with that i just share that here..

Screens

Screen is a terminal  multiplexer that allows us to manage many process through one terminal.By that each process gets its own virtual window.so that we can switch between windows..

Interacting with Screens.

Before we get start interacting with screens..we are suppose to know how to open and switch to different windows..

If you want  to play with the screens just try the following keys in the terminal.

To open a new screen: Type screen

It will enter in to the screen after that u can open a new window using

Ctrl+a c: open a new screen

Ctrl+a n: next screen

Ctrl+a p: previous screen

Ctrl+a ": select the windows from the list  (Try this is good one)

Ctrl+a  S: split terminal horizontally into region

Ctrl+a |: split terminal vertically into regions

Ctrl+a :resize resize region  

Ctrl+a :fit fit screen size to new terminal size Ctrl+a F is the same. Do after resizing xterm

Ctrl+a :remove remove region Ctrl+a X is the same

Ctrl+a tab Move to next region  
   
Ctrl+a d: detach screen from terminal Start screen with -r option to reattach

Ctrl+a A: set window title  

Ctrl+a x: lock session Enter user password to unlock

Ctrl+a [: enter scrollback/copy mode Enter to start and end copy region. Ctrl+a ] to leave this mode

Ctrl+a ]: paste buffer Supports pasting between windows

Ctrl+a >: write paste buffer to file useful for copying between screens

Ctrl+a <: read paste buffer from file useful for pasting between screens
   
Ctrl+a ?: show key bindings/command names Note unbound commands only in man page

Ctrl+a : goto screen command prompt up shows last command entered


Just enjoy playing with screens..


Monday 26 December 2011

session on ltrace and strace in linux


We had a very nice session about these ltrace and strace in linux commands by mr.vijay guru..
let me share certain things on those topics here..

Before we getting in to the topic.we first see the unix architecture..


This architecture helps us to know how the system and library calls reach the kernel and get the response..
as we are going deep in to the topic the question nudges our mind how the calls from our application reaches the kernel of the os and respond back to us..


This is how the directions of calls have requested and responded to the commands..


ltrace- A library call tracer.
strace-A system call tracer.

ltrace is a debugging utility in linux to monitor the library calls used by a program and all the signals it receives. It can also show system calls, used by a program.
ltrace [-CdfhiLrStttV] [-a column] [-e expr] [-l filename] [-n nr] [-o filename] [-p pid] ... [-s strsize] [-u username] [-X extern] [-x extern] ... [--align=column] [--debug] [--demangle] [--help] [--indent=nr] [--library=filename] [--output=filename] [--version] [command [arg ...]]


starce is a tool which enables tracing the System calls made by a process during its execution. It also reports the signals that are recieved by the process.

According to the Linux manual page, in the simplest case 'strace runs the specified command until it exits. It intercepts and records the system calls which are called by a process and the signals which are received by a process. .


$strace
usage: strace [-dffhiqrtttTvVxx] [-a column] [-e expr] ... [-o file] [-p pid] ... [-s strsize] [-u username] [-E var=val] ... [command [arg ...]] or: strace -c [-e expr] ... [-O overhead] [-S sortby] [-E var=val] ... [command [arg ...]] -c -- count time, calls, and errors for each syscall and report summary

here i just show u screenshot of strace..





Tuesday 20 December 2011

Its great to know about SMTP

We all are handling with loads of emails..But we are not aware of things happening behind. This Simple Mail Transfer Protocol (SMTP) is an Internet Standard email transmission across Internet Protocol (IP) networks. 


Let us know what exactly happens when we send emails. client applications usually use either the Post Office Protocol (POP) or the Internet Message Access Protocol (IMAP) on a proprietary system (such as Microsoft Outlook or Thunderbird) to access their mail box accounts on a mail server. As ”Picture speaks far more than words” we’ll deal this with a picture. 





  • MUA(Mail User Agent) 
  • MSA(Mail Submission Agent) 
  • MTA(Mail Transfer Agent) 
  • MDA(Mail Delivery Agent) 



From the above picture we can clearly arrive at how stuff works behind the email servers.

Our email client will act as the MUA’s.when we send the mails it searches for the MSA and this submits the mail to the MTA.This MTA is playing a very vital role in  transferring the mail to the MDA.Thereafter the mails are finally drop into the receiver’s mail box.




When we compose a message and press the Send button, here's what happens:

1. Outlook Express connects to the SMTP server at mail.yahoo.com using port 25.

2. Outlook Express has a conversation with the SMTP server, telling the SMTP server the address of the sender and the address of the recipient, as well as the body of the message.

3. The SMTP server takes the "to" address (sathish@yahoo.com) and breaks it into two parts: the recipient name (sathish) and the domain name (yahoo.com). If the "to" address had been another user at yahoo.com, the SMTP server would simply hand the message to the POP3 server for yahoo.com (using a little program called the delivery agent). Since the recipient is at another domain, SMTP needs to communicate with that domain.

4. The SMTP server has a conversation with a Domain Name Server, or DNS .It says, "Can you give me the IP address of the SMTP server for yahoo or gmail. The DNS replies with the one or more IP addresses for the SMTP server(s) that Server operates.

5. The SMTP server at yahoo.com connects with the SMTP server at gmail using port 25. It has the same simple text conversation that my e-mail client had with the SMTP server for Yahoo, and gives the message to the gmail The google server recognizes that the domain name for sathish is at , so it hands the message to gmail’s POP3 server, which puts the message in receipient mailbox.

If, for some reason, the SMTP server at Yahoo cannot connect with the SMTP server at Gmail, then the message goes into a queue. The SMTP server on most machines uses a program called sendmail to do the actual sending, so this queue is called the sendmail queue. Sendmail will periodically try to resend the messages in its queue. For example, it might retry every 15 minutes. After four hours, it will usually send you a piece of mail that tells you there is some sort of problem. After five days, most sendmail configurations give up and return the mail to you undelivered.


The SMTP server understands very simple text commands like HELO, MAIL, RCPT and DATA. The most common commands are:

· HELO - introduce yourself

· EHLO - introduce yourself and request extended mode

· MAIL FROM: - specify the sender

· RCPT TO: - specify the recipient

· DATA - specify the body of the message (To, From and Subject should be the first three lines.)

· RSET - reset

· QUIT - quit the session

· HELP - get help on commands

· VRFY - verify an address

· EXPN - expand an address

· VERB - verbose

If your very curious to try it from your terminal.follow the steps to do so.





MY FIRST POST

Hi all..this is my first post in my blog.I thought of sharing my exposure in field of computer science probably to all my friends.. This is the first idea that nudges in my mind.So from here you can feel the impact...