Monitor Terminals Using script Command

Open a terminal and type as below

[raja@AGRAJA ~]$ mkfifo output
[raja@AGRAJA ~]$ script -f output

Open another terminal and type as below

[raja@AGRAJA ~]$ cat output

Now return to first terminal and execute any command.

Everything on the first terminal is updated on the second terminal also.


Multiple Windows in a Terminal

Manage multiple terminals using screen utility

[raja@AGRAJA ~]$ screen -t name_of_screen
[raja@AGRAJA ~]$ screen -t name_of_screen2 screen_no

To navigate between screens:

1) CTRL+a

2.1) Type to list available screens; use arrow keys to select


2.2) Type w to list screens on the title bar for a moment.

i) CTRL+a

ii) type screen_no (it can be 0, 1, 2 … )

To scroll within a screen

1) CTRL+a

2) ESC

3) Page-Up/Page-Down


Never type ls Again

It is compelling to type “ls” every time after

1) changing directory

2) copy/remove files

3) program is run; output file is created

etc. etc. …
Here’s a script that runs on an infinite loop that

1) allows type any command as usual (no auto-complete is available)

2) automatically “ls” after every command

# save file as cdls
# chmod 755 cdls
# type "exit" to terminate
while [ 1 ]
    read shell_command


A more useful form of the script is given below

# save as cdls
# chmod 755 cdls
# cp cdls /bin  
tput cup 24 0
while [ 1 ] do
tput setb 9
tput setf 0
echo --------------------------------------------------------------------------------
ls -F --color=auto
echo [`whoami` `pwd` `date`]$
tput setb 0
tput setf 7
read cmd1
tput cup 24 0

GCC Include Files Path

GCC looks in several different places for headers.

On a normal Unix system, if you do not instruct it otherwise, it will look for headers requested with #include <file> in:

You can add to this list with the -Idir command line option.

Below is a small demo

///////////     defines.c   ////////
#include <stdio.h>
#include <defines.h>
int main()
    return 0;

This requires the folowing header file

///////     headers/defines.h   ///////////
#define begin {
#define end }
//////  save this file in directory named headers

Compile defines.c as below

[raja@AGRAJA ~] gcc defines.c -Iheaders

Microsoft Windows Weird Bugs


An Indian discovered that nobody can create a FOLDER anywhere on the computer which can be named as “CON”. This is something pretty cool…and unbelievable… At Microsoft the whole Team, couldn’t answer why this happened!



For those of you using Windows, do the following:

1.) Open an empty notepad file

2.) Type “Bush hid the facts” (without the quotes)

3.) Save it as whatever you want.

4.) Close it, and re-open it.

is it just a really weird bug? :-??

Similar to this: At step 2.) Type “this app can break ”


microsoft crazy facts

This is something pretty cool and neat…and unbelievable… At Microsoft the whole Team, including Bill Gates, couldn’t answer why this happened!

It was discovered by a Brazilian. Try it out yourself…

Open Microsoft Word and type

=rand (200, 99)

And then press ENTER

then see the magic………………………….

Source or DOT operator

. (source or dot operator)

      . filename [arguments]

      source filename [arguments]

Read and execute commands from the filename argument in the current shell context.

If filename does not contain a slash, the PATH variable is used to find filename. The current directory is searched if filename is not found in $PATH.

If any arguments are supplied, they become the positional parameters when filename is executed. Otherwise the positional parameters are unchanged.

The return status is the exit status of the last command executed, or zero if no commands are executed. If filename is not found, or cannot be read, the return status is non-zero.

A period `.’ is a synonym for `source’

source is a bourne shell builtin and a POSIX `special’ builtin

Executing a script

[raja@AGRAJA~]$ source script_name
[raja@AGRAJA~]$ sh script_name
[raja@AGRAJA~]$ csh script_name
[raja@AGRAJA~]$ ./script_name
[raja@AGRAJA~]$ bash script_name