Friday, March 28, 2008
Dumbest kid!!!!!!!!
"This is the dumbest kid in the world. Watch while I prove it to you."
The barber puts a dollar in one hand and two quarters in the other,
then calls the boy over and asks, "Which do you want, son?"
The boy takes the quarters and leaves.
"What did I tell you?" said the barber. "That kid never learns!"
Later, when the customer leaves, he sees the same young boy coming out of the ice cream store.
"Hey, son! May I ask you a question? Why did you take the quarters instead of the dollar?"
The boy licked his cone and replied, "Because the day I take the dollar, the game's over!"
~~~~~~~~
Thursday, March 27, 2008
Handling of signals in Shell scripting..
The command arg is to be read and executed when the shell receives signal(s) sigspec। If arg is absent or -, all specified signals are reset to their original values (the values they had upon entrance to the shell)।
If arg is the null string the signal specified by each sigspec is ignored by the shell and by the commands it invokes।
If arg is not present and -p has been supplied, then the trap commands associated with each sigspec are displayed।
If no arguments are supplied or if only -p is given, trap prints the list of commands associated with each signal number।
Each sigspec is either a signal name defined in <signal.h>, or a signal number।
If a sigspec is EXIT (0) the command arg is executed on exit from the shell। If a
sigspec is DEBUG, the command arg is executed after every simple command (see SHELL GRAMMAR above)।
If a sigspec is ERR, the command arg is executed whenever a simple command has a non-zero exit status।
The ERR trap is not executed if the failed command is part of an until or while loop, part of an if statement, part of a && or || list, or if the command's return value is being inverted via !. The -l option causes the shell to print a list of signal names and their corresponding numbers। Signals ignored upon entry to the shell cannot be trapped or reset। Trapped signals are reset to their original values in a child process when it is created। The return status is false if any sigspec is invalid; otherwise trap returns true.
Wednesday, March 26, 2008
To Take Backup of Files in Linux/+
cpio {-o|--create} [-0acvABLV] [-C bytes] [-H format] [-M message] [-O [[user@]host:]archive] [-F [[user@]host:]archive] [--file=[[user@]host:]archive] [--format=format] [--message=message] [--null] [--reset-access-time] [--verbose] [--dot] [--append] [--block-size=blocks] [--dereference] [--io-size=bytes] [--quiet] [--force-local] [--rsh-command=command] [--help] [--version] <> archive]
cpio {-i|--extract} [-bcdfmnrtsuvBSV] [-C bytes] [-E file] [-H format] [-M message] [-R [user][:.][group]] [-I [[user@]host:]archive] [-F [[user@]host:]archive] [--file=[[user@]host:]archive] [--make-directories] [--nonmatching] [--preserve-modification-time] [--numeric-uid-gid] [--rename] [-t|--list] [--swap-bytes] [--swap] [--dot] [--unconditional] [--verbose] [--block-size=blocks] [--swap-halfwords] [--io-size=bytes] [--pattern-file=file] [--format=format] [--owner=[user][:.][group]] [--no-preserve-owner] [--message=message] [--force-local] [--no-absolute-filenames] [--sparse] [--only-verify-crc] [--quiet] [--rsh-command=command] [--help] [--version] [pattern...] [< archive]
cpio {-p|--pass-through} [-0adlmuvLV] [-R [user][:.][group]] [--null] [--reset-access-time] [--make-directories] [--link] [--quiet] [--preserve-modification-time] [--unconditional] [--verbose] [--dot] [--dereference] [--owner=[user][:.][group]] [--no-preserve-owner] [--sparse] [--help] [--version] destination-directory < name-list
cpio copies files into or out of a cpio or tar archive, which is a file that contains other files plus information about them, such as their file name, owner, timestamps, and access permissions. The archive can be another file on the disk, a magnetic tape, or a pipe. cpio has three operating modes.
In copy-out mode, cpio copies files into an archive. It reads a list of filenames, one per line, on the standard input, and writes the archive onto the standard output. A typical way to generate the list of filenames is with the find command; you should give find the -depth option to minimize problems with permissions on directories that are unwritable or not searchable.
In copy-in mode, cpio copies files out of an archive or lists the archive contents. It reads the archive from the standard input. Any non-option command line arguments are shell globbing patterns; only files in the archive whose names match one or more of those patterns are copied from the archive. Unlike in the shell, an initial `.' in a filename does match a wildcard at the start of a pattern, and a `/' in a filename can match wildcards. If no patterns are given, all files are extracted.
In copy-pass mode, cpio copies files from one directory tree to another, combining the copy-out and copy-in steps without actually using an archive. It reads the list of files to copy from the standard input; the directory into which it will copy them is given as a non-option argument.
cpio supports the following archive formats: binary, old ASCII, new ASCII, crc, HPUX binary, HPUX old ASCII, old tar, and POSIX.1 tar. The binary format is obsolete because it encodes information about the files in a way that is not portable between different machine architectures. The old ASCII format is portable between different machine architectures, but should not be used on file systems with more than 65536 i-nodes. The new ASCII format is portable between different machine architectures and can be used on any size file system, but is not supported by all versions of cpio; currently, it is only supported by GNU and Unix System V R4. The crc format is like the new ASCII format, but also contains a checksum for each file which cpio calculates when creating an archive and verifies when the file is extracted from the archive. The HPUX formats are provided for compatibility with HPUX's cpio which stores device files differently.
The tar format is provided for compatability with the tar program. It can not be used to archive files with names longer than 100 characters, and can not be used to archive "special" (block or character devices) files. The POSIX.1 tar format can not be used to archive files with names longer than 255 characters (less unless they have a "/" in just the right place).
By default, cpio creates binary format archives, for compatibility with older cpio programs. When extracting from archives, cpio automatically recognizes which kind of archive it is reading and can read archives created on machines with a different byte-order.
OPTIONS
-0, --null
In copy-out and copy-pass modes, read a list of filenames terminated by a null character instead of a newline, so that files whose names contain newlines can be archived. GNU find is one way to produce a list of null-terminated filenames.
-a, --reset-access-time
Reset the access times of files after reading them, so that it does not look like they have just been read.
-A, --append
Append to an existing archive. Only works in copy-out mode. The archive must be a disk file specified with the -O or -F (--file) option.
-b, --swap
In copy-in mode, swap both halfwords of words and bytes of halfwords in the data. Equivalent to -sS. Use this option to convert 32-bit integers between big-endian and little-endian machines.
-B
Set the I/O block size to 5120 bytes. Initially the block size is 512 bytes.
--block-size=BLOCK-SIZE
Set the I/O block size to BLOCK-SIZE * 512 bytes.
-c
Identical to "-H newc", use the new (SVR4) portable format. If you wish the old portable (ASCII) archive format, use "-H odc" instead.
-C IO-SIZE, --io-size=IO-SIZE
Set the I/O block size to IO-SIZE bytes.
-d, --make-directories
Create leading directories where needed.
-E FILE, --pattern-file=FILE
In copy-in mode, read additional patterns specifying filenames to extract or list from FILE. The lines of FILE are treated as if they had been non-option arguments to cpio.
-f, --nonmatching
Only copy files that do not match any of the given patterns.
-F, --file=archive
Archive filename to use instead of standard input or output. To use a tape drive on another machine as the archive, use a filename that starts with `HOSTNAME:'. The hostname can be preceded by a username and an `@' to access the remote tape drive as that user, if you have permission to do so (typically an entry in that user's `~/.rhosts' file).
--force-local
With -F, -I, or -O, take the archive file name to be a local file even if it contains a colon, which would ordinarily indicate a remote host name.
-H FORMAT, --format=FORMAT
Use archive format FORMAT. The valid formats are listed below; the same names are also recognized in all-caps. The default in copy-in mode is to automatically detect the archive format, and in copy-out mode is "bin".
bin
The obsolete binary format.
odc
The old (POSIX.1) portable format.
newc
The new (SVR4) portable format, which supports file systems having more than 65536 i-nodes.
crc
The new (SVR4) portable format with a checksum added.
tar
The old tar format.
ustar
The POSIX.1 tar format. Also recognizes GNU tar archives, which are similar but not identical.
hpbin
The obsolete binary format used by HPUX's cpio (which stores device files differently).
hpodc
The portable format used by HPUX's cpio (which stores device files differently).
-i, --extract
Run in copy-in mode.
-I archive
Archive filename to use instead of standard input. To use a tape drive on another machine as the archive, use a filename that starts with `HOSTNAME:'. The hostname can be preceded by a username and an `@' to access the remote tape drive as that user, if you have permission to do so (typically an entry in that user's `~/.rhosts' file).
-k
Ignored; for compatibility with other versions of cpio.
-l, --link
Link files instead of copying them, when possible.
-L, --dereference
Dereference symbolic links (copy the files that they point to instead of copying the links).
-m, --preserve-modification-time
Retain previous file modification times when creating files.
-M MESSAGE, --message=MESSAGE
Print MESSAGE when the end of a volume of the backup media (such as a tape or a floppy disk) is reached, to prompt the user to insert a new volume. If MESSAGE contains the string "%d", it is replaced by the current volume number (starting at 1).
-n, --numeric-uid-gid
In the verbose table of contents listing, show numeric UID and GID instead of translating them into names. Also extracts tar archives using the numeric UID and GID instead of the user/group names. (cpio archives are always extracted using the numeric UID and GID.)
--no-absolute-filenames
In copy-in mode, create all files relative to the current directory, even if they have an absolute file name in the archive.
--no-preserve-owner
In copy-in mode and copy-pass mode, do not change the ownership of the files; leave them owned by the user extracting them. This is the default for non-root users, so that users on System V don't inadvertantly give away files.
-o, --create
Run in copy-out mode.
-O archive
Archive filename to use instead of standard output. To use a tape drive on another machine as the archive, use a filename that starts with `HOSTNAME:'. The hostname can be preceded by a username and an `@' to access the remote tape drive as that user, if you have permission to do so (typically an entry in that user's `~/.rhosts' file).
--only-verify-crc
When reading a CRC format archive in copy-in mode, only verify the CRC's of each file in the archive, don't actually extract the files.
-p, --pass-through
Run in copy-pass mode.
--quiet
Do not print the number of blocks copied.
-r, --rename
Interactively rename files.
-R [user][:.][group], --owner [user][:.][group]
In copy-out and copy-pass modes, set the ownership of all files created to the specified user and/or group. Either the user or the group, or both, must be present. If the group is omitted but the ":" or "." separator is given, use the given user's login group. Only the super-user can change files' ownership.
--rsh-command=COMMAND
Notifies mt that it should use COMMAND to communicate with remote devices instead of /usr/bin/ssh or /usr/bin/rsh.
--sparse
In copy-in and copy-pass modes, write files with large blocks of zeros as sparse files.
-s, --swap-bytes
In copy-in mode, swap the bytes of each halfword (pair of bytes) in the files.
-S, --swap-halfwords
In copy-in mode, swap the halfwords of each word (4 bytes) in the files.
-t, --list
Print a table of contents of the input.
-u, --unconditional
Replace all files, without asking whether to replace existing newer files with older files.
-v, --verbose
List the files processed, or with -t, give an `ls -l' style table of contents listing. In a verbose table of contents of a ustar archive, user and group names in the archive that do not exist on the local system are replaced by the names that correspond locally to the numeric UID and GID stored in the archive.
-V --dot
Print a "." for each file processed.
--version
Print the cpio program version number and exit.
Tuesday, March 25, 2008
The Loyal Wife!!
Just before he died, he said to his wife, "When I die, I want you to take all my money and put it in the casket with me.
I want to take my money to the afterlife with me."
And so he got his wife to promise him with all of her heart that when he died, she would put all of the money in the casket with him.
Well, he died. He was stretched out in the casket, his wife was sitting there in black, and her friend was sitting next to her.
When they finished the ceremony, just before the undertakers got ready to close the casket, the wife said, "Wait just a minute!"
She had a box her; she came over with the box and put it in the casket.
Then the undertakers locked the casket down, and they rolled it away.
So her friend said, "Girl, I know you weren't fool enough to put all that money in there with your husband."
The loyal wife replied, "Listen, I'm an honest loyal wife, I can't go back on my word.
I promised him that I was going to put that money in that casket with him."
"You mean to tell me you put that money in the casket with him!!!!?"
"I sure did," said the wife. "I got it all together, put it into my account and wrote him a check.. If he can cash it, he can spend it."
Monday, March 24, 2008
Some Fun!
Sales girl : The fiction department is on the other side, sir.
~~~~~~~~~
Said to a railroad engineer:
What's the use of having a train schedule if the trains are always late.
The reply from the railroad engineer:
How would we know they were late, if we didn't have a schedule?
~~~~~~~~~
~~~~~~~~~
I dropped a coin in sea and prayed for a smart & intelligent friend.
Then God gifted me you and said...
.
.
.
.
.
.
.
.
.
.
.
ITNE PAISE ME TO YAHI MILEGA.... :)
~~~~~~~~~
Boy & Girl in restaurant :
Boy:-I Love u
Girl:-I don't Love u
Boy:- Think again?
Girl:-I told u. No no & no
Boy:-Ok!!! Waiter,bring separate bills.
Girl:- ok ok....... I Love u too........
~~~~~~~~~
Way for a long life!!
Doctor : Get married.
Man : Will it help?
Doctor : No, but the thought of long life will never come.
3 detectives!!
To test their skills in recognizing a suspect, he shows the first guy a picture for 5 seconds and then hides it. "This is your suspect, how would you recognize him?" The first guy answers, "That's easy, we'll catch him fast because he only has one eye!"
The policeman says, "Well...uh...that's because the picture I showed is his side profile."
Slightly flustered by this ridiculous response, he flashes the picture for 5 seconds at the second guy and asks him, "This is your suspect, how would you recognize him?"
The second guy smiles and says, "Ha! He'd be too easy to catch because he only has one ear!" The policeman angrily responds,"What's the matter with you two? Of course only one eye and one ear are showing because it's a picture of his side profile! Is that the best answer you can come up with?"
Extremely frustrated at this point, he shows the picture to the third guy and in a very testy voice asks, "This is your suspect, how would you recognize him?
He quickly adds, "Think hard before giving me a stupid answer." The guy looks at the picture intently for a moment and says, "The suspect wears contact lenses."
The policeman is surprised and speechless because he really doesn't know himself if the suspect wears contacts or not. "Well, that's an interesting answer. Wait here for a few minutes while I check his file and I'll get back to you on that."
He leaves the room and goes to his office, checks the suspect's file in his computer, and comes back with a beaming smile on his face.
"Wow! I can't believe it. It's TRUE! The suspect does in fact wear contact lenses. Good work! How were you able to make such an astute observation?"
"That's easy," the guy replied. "He can't wear regular glasses because he only has one eye and one ear."
********
I want a divorce!!
Her husband suddenly looks over at her and says, "Honey, I know we've been married for 20 years, but I want a divorce."
The wife says nothing but slowly increases speed to 70 mph.
He then says, "I don't want you to try to talk me out of it, because I've been having an affair with your best friend,
and she's a better lover than you are."
Again the wife stays quiet but speeds up as her anger increases.
"I want the house," he insists, pressing his luck. Again the wife speeds up, to eighty mph.
He says, "I want the car, too," but she just drives faster and faster.
By now she's up to ninety mph. "All right," he says, "I want the bank accounts, and all the credit cards, too."
The wife slowly starts to veer toward a bridge.
This makes him a bit nervous, so he says, "Isn't there anything you want?"
The wife says, "No, I've got everything I need."
"Oh, really," he says, "so what have you got?"
Right before they slam into the wall at a 100 mph, the wife smiles and says, " The airbag."
Thursday, March 20, 2008
Do u Marry Again !!!
Wife: no, I'll stay with my sister.
Wife: if I die will u remarry?
Husband: no I'll also stay with your sister.
Hospital fun!!!
"I'm sorry," said the receptionist, "we can't fit you in for at least two weeks."
"But I could be dead by then!"
"No problem. If your wife lets us know, we'll cancel the appointment. "
**********
Patient: Nurse, I keep seeing spots in front of my eyes.
Nurse: Have you seen a doctor?
Patient: No, just spots.
Unopened CDs!!!
He was 18 years old and he could die anytime. All his life, he was stuck in his house being taken cared by his mother.
He never went outside but he was sick of staying home and wanted to go out for once.
So he asked his mother and she gave him permission. He walked down his block and found a lot of stores.
He passed a CD store and looked through the front door for a second as he walked.
He stopped and went back to look into the store.
He saw a young girl about his age and he knew it was love at first sight.
He opened the door and walked in, not looking at anything else but her.
He walked closer and closer until he was finally at the front desk where she sat.
She looked up and asked "Can I help you?" She smiled and he thought it was the most beautiful smile he has ever seen before and wanted to kiss her right there.
He said "Uh... Yeah... Umm... I would like to buy a CD." He picked one out and gave her money for it.
"Would you like me to wrap it for you?" she asked, smiling her cute smile again.
He nodded and she went to the back.
She came back with the wrapped CD and gave it to him. He took it and walked out of the store.
He went home and from then on, he went to that store everyday and bought a CD, and she wrapped it for him.
He took the CD home and put it in his closet. He was still too shy to ask her out and he really wanted to but he couldn't.
His mother found out about this and told him to just ask her.
So the next day, he took all his courage and went to the store. He bought a CD like he did everyday and once again she went to the back of the store and came back with it wrapped.
He took it and when she wasn't looking, he left his phone number on the desk and ran out...
------------------
!!!RRRRRING!!!
The mother picked up the phone and said, "Hello?"
It was the girl!!! She asked for the boy and the mother started to cry and said, "You don't know? He passed away yesterday..."
The line was quiet except for the cries of the boy's mother.
Later in the day. the mother went into the boy's room because she wanted to remember him. She thought she would start by looking at his clothes.
So she opened the closet. She was face to face with piles and piles and piles of unopened CDs. She was surprised to find all those CDs and she picked one up and sat down on the bed and she started to open one.
Inside, there was a CD and as she took it out of the wrapper, out fell a piece of paper. The mother picked it up and started to read it.
It said: Hi... I think U R really cute. Do u wanna go out with me? Love, Jacelyn The mother opened another CD...
Again there was a piece of paper. It said: Hi... I think U R really cute. Do u wanna go out with me? Love, Jacelyn
Love is... when you've had a huge fight but then decide to put aside your egos, hold hands and say, "I Love You . . . "
------------------
If you Really Love Someone please Expressed your feeling and let them know how much you Love them,
That person might also love you in the same way as you love them Before it is too late................
Fresh Fish!!!!
But the waters close to Japan have not held many fish for decades.
So to feed the Japanese population, fishing boats got bigger and went farther than ever.
The farther the fishermen went, the longer it took to bring in the fish.
If the return trip took more than a few days, the fish were not fresh. The Japanese did not like the taste.
To solve this problem, fishing companies installed freezers on their boats.
They would catch the fish and freeze them at sea. Freezers allowed the boats to go farther and stay longer.
However, the Japanese could taste the difference between fresh and frozen and they did not like frozen fish.
The frozen fish brought a lower price. So fishing companies installed fish tanks. They would catch the fish and stuff them in the tanks, fin to fin.
After a little thrashing around, the fish stopped moving.
They were tired and dull, but alive. Unfortunately, the Japanese could still taste the difference.
Because the fish did not move for days, they lost their fresh-fish taste.
The Japanese preferred the lively taste of fresh fish, not sluggish fish.
So how did Japanese fishing companies solve this problem? How do they get fresh-tasting fish to Japan?
If you were consulting the fish industry, what would you recommend?
scroll down for answer :
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
Here is How Japanese Fish Stay Fresh:
To keep the fish tasting fresh, the Japanese fishing companies still put the fish in the tanks.
But now they add a small shark to each tank. The shark eats a few fish, but most of the fish arrive in a very lively state. The fish are challenged.
Have you realized that some of us are also living in a pond but most of the time tired & dull,
so we need a Shark in our life to keep us awake and moving?
Basically in our lives Sharks are new challenges to keep us active and lively.....
Worms ....!!!!
so he produced an experiment that involved a glass of water,
A glass of whiskey, and two worms.
"Now, class. Observe closely the worms," said the professor putting a worm first into the water. The worm in the water writhed about, happy as a worm in water could be.
The second worm, he put into the whiskey. It writhed painfully, and quickly sank to the bottom, dead as a doornail.
"Now, what lesson can we derive from this experiment?" the professor asked. Johnny, who naturally sits in back, raised his hand and wisely, responded, "Drink whiskey and you won't get worms."
Junior!!
After junior had called, he got back to mummy to inform her that there was a lady that picked up daddy's phone the three times he tried reaching dad on the mobile.
Women!!
She waited impatiently for her husband to return from work and upon seeing him in the driveway, she rushed out and gave him a tight slap, and she slapped him again, for good measure.
People from the neighborhood rushed around to find out what the cause of the commotion was.
The woman asked junior to tell everybody what the lady said to him when he called.
Junior said
"The subscriber you have dialed is not available at present. Please Try Again Later"...
never judged anyone by their appearance again!!!!
Another tree said, "Dear pine, do not be sad, we can not have everything."
The rose turned its head and remarked, "It seems that I am the most beautiful plant in this forest."
A sunflower raised its yellow head and asked, "Why do you say that? In this forest there are many beautiful plants. You are just one of them." The red rose replied, "I see everyone looking at me and admiring me."
Then the rose looked at a cactus and said, "Look at that ugly plant full of thorns!" The pine tree said, "Red rose, what kind of talk is this? Who can say what beauty is? You have thorns too."
The proud red rose looked angrily at the pine and said, "I thought you had good taste! You do not know what beauty is at all. You can not compare my thorns to that of the cactus."
"What a proud flower", thought the trees.
The rose tried to move its roots away from the cactus, but it could not move. As the days passed, the red rose would look at the cactus and say insulting things, like: This plant is useless? How sorry I am to be his neighbor."
The cactus never got upset and he even tried to advise the rose, saying, "God did not create any form of life without a purpose."
Spring passed, and the weather became very warm. Life became difficult in the forest, as the plants and animals needed water and no rain fell. The red rose began to wilt. One day the rose saw sparrows stick their beaks into the cactus and then fly away, refreshed.
This was puzzling, and the red rose asked the pine tree what the birds were doing. The pine tree explained that the birds got water from the cactus. "Does it not hurt when they make holes?" asked the rose.
"Yes, but the cactus does not like to see any birds suffer," replied the pine.
The rose opened its eyes in wonder and said, "The cactus has water?"
"Yes you can also drink from it. The sparrow can bring water to you if you ask the cactus for help."
The red rose felt too ashamed of its past words and behavior to ask for water from the cactus, but then it finally did ask the cactus for help. The cactus kindly agreed and the birds filled their beaks with water and watered the rose's roots.
Best joke in Britan !!!
As he was a great fan of his movies, he rushes over to him, and asks for his autograph.
Instead, Spielberg gives him a slap and says, "You Chinese people bombed our Pearl Habour, get outta here."
The astonished Chinese man replied, "It was not the Chinese who bombed your PearlHarbour, it was the Japanese".
"Chinese, Japanese, Taiwanese, you're all the same," replied Spielberg.
In return, the Chinese gives Spielberg a slap and says, "You sank the Titanic, my forefathers were on that ship."
Shocked, Spielberg replies, "It was the iceberg that sank the ship, not me."
The Chinese replies, "Iceberg, Spielberg, Carlsberg, you're all the same."
( This particular joke won an award for the best joke in a competition organized in Britain )
Nail In The Fence!!!
His Father gave him a bag of nails and told him that every time he lost his temper, he must hammer a nail into the back of the fence.
The first day the boy had driven 37 nails into the fence.
Over the next few weeks, as he learned to control his anger,the number of nails hammered daily gradually dwindled down. He discovered it was easier to hold his temper than to drive those nails into the fence.
Finally the day came when the boy didn't lose his temper at all. He told his father about it and the father suggested that the boy now pull out one nail for each day that he was able to hold his temper.
The days passed and the young boy was finally able to tell his father that all the nails were gone.
The father took his son by the hand and led him to the fence. He said, "You have done well, my son, but look at the holes in the fence.
The fence will never be the same.
When you say things in anger, they leave a scar just like this one. You can put a knife in a man and draw it out.
It won't matter how many times you say I'm sorry, the wound is still there."
A verbal wound is as bad as a physical one. Friends are very rare jewels, indeed. They make you smile and encourage you to succeed. They lend an ear, they share words of praise and they always want to open their hearts to us."
please ! make me women ....
He wanted her to see what he went through so he prayed:
"Dear Lord: I go to work every day and put in 8 hours while my wife merely stays at home.
I want her to know what I go through, so please allow her body to switch with mine for a day. Amen.
God, in his infinite wisdom, granted the man'swish.
The next morning, sure enough, the man awoke as a woman.
He arose, cooked breakfast forhis mate, awakened the kids,
Set out their school clothes, fed them breakfast, packed their lunches,
Drove them to school, came home andpicked up the dry cleaning, took it to the cleaners
And stopped at the bank to make a deposit, went grocery shopping,
Then drove home to put away the groceries,
Paid the bills and balanced the checkbook.
He cleaned the cat's litter box andbathed the dog.
Then it was already 1 P.M.and he hurried to make the beds,do the laundry, vacuum, dust, and sweep and mop the kitchen floor.
Ran to the school to pick up the kids and got into an argument with them on the way home.
Set out milk and cookies and got the kids organized to do their homework,
Then set up the ironing board and watched TV while he did the ironing.
At 4:30 he began peelingpotatoes and washing vegetables for salad, breaded the pork chops and snapped fresh beans for supper.
After supper, he cleaned the kitchen, ran the dishwasher, folded laundry, bathed the kids, and put them to bed. At 9 P.M. he was exhausted and,
though his daily chores weren'tfinished, he went to bed where he was expected to make love, which he managed to get through without complaint.
The next morning, he awoke and immediately knelt by the bed and said, Lord,
I don't know what I was thinking. Iwas so wrong to envy my wife's being able to stay home all day. Please, oh please, let us trade back."
The Lord, in his infinite wisdom, replied, "My son, I feel you have learned your lesson and I will be happy to change things back to the way they were.
You'll just have to wait nine months,though. You got pregnant last night."
Conclusion!!!!
"chal", it walks.
He cuts 2nd and 3rd legs and said, "chal" , it walks.
He cuts all the legs and said, "chal...." Finally he wrote the conclusion......
..... "after all the legs of a cockroach are cut - it becomes deaf......"
~~~~~~~~~
Sardar shouting 2 his girl friend " u said v will do register marriage and cheated me,
I was waiting 4 u yesterday whole day in the post office...."
~~~~~~~~~
A Tamilian call up sardar and asks " Tamil therima??"
Sardar got mad, angrily replied.... "Hindi tera baap!!!"
~~~~~~~~~
2 sardars are driving a Car,
One puts on the indicator and asks the other to check whether its working,
He puts his head out and says - YES...NO...YES...NO...YES...NO...
This is the maid !! (Little Fun)
The guy says, "Who is this?"
"This is the maid," answers the woman.
"We don't have a maid," says the man.
The woman says, "I was hired this morning by the woman of the house."
The man says, "Well, this is her husband. Is she there?"
The woman replies, "She is upstairs in the bed room with someone who I figured was her husband."
The guy is fuming and says to the maid, "Listen, would you like to make 50,000?"
The maid asks, "What will I have to do?"
The man tells her, "I want you to get my gun from the desk, and shoot the Bitch and the jerk she's with."
The maid puts the phone down; the man hears footsteps and then two gun shots.
The maid comes back to the phone, "What do I do with the bodies?"
The man says, "Throw them in the swimming pool."
Puzzled, the maid answers, "But you don't have a pool."
A long pause and the man asks, "Oops..! Is this 2261-1382?"
Study in US get Green card easily...
According to reports, a new US Senate proposal would allow limitless H1-B visas and green cards for foreigners with master’s degrees or higher in any field from an American university — or anyone with such credentials in the science, technology, engineering or math fields from abroad.
That number could climb by 20% in each subsequent year, to as high as 180,000 if the previous year's quota was exhausted.
Right now, there's also a 20,000 visa cap beyond the existing H1-B quota for foreigners who have advanced degrees in the US. The new Senate Bill would remove that cap. It would also broaden the exemption from the H1-B limit beyond just those with advanced degrees to include foreigners with 'medical specialty certification based on post-doctoral training and experience in the United States'.
According to government sources, the private sector is woefully inadequate to tackle this perception in the US, even though Nasscom has proposed a "professional visa" which has been forwarded in the CEO's Forum between US and India.
In a statement, Lieberman, who may even run for president in 2008, said, "To remain competitive, American companies need access to highly educated individuals. But today's system makes it difficult for innovative employers to recruit and retain highly educated talent, which puts the US at a competitive disadvantage globally."
The Bill also safeguards these H1-B visas from abuse — it would prohibit companies from advertising jobs solely to H1-B immigrants or indicating preference for such workers. It would limit the number of employees on H1-B to no more than half a company's workforce. It would also double fines for employers that violate H1-B programme requirements.
The Bill drew immediate applause from Microsoft, whose high-powered chairman Bill Gates recently urged Congress again to allow for infinite quantities of the work permits.
But there are other groups that prefer a Bill introduced earlier this year by two other senators, Chuck Grassley and Dick Durbin that attempts to prevent H1-B abuse by imposing a number of new obligations on employers.
High-tech companies have protested these obligations as too overbearing. Employers would have to certify that they had made a "good faith" effort to hire an American before taking on an H1-B worker and that the foreigner was not displacing a prospective US worker. That Bill's sponsors on Monday issued inquiries to a number of Indian companies, targeting statistics showing some of them were among the top 20 H1-B recipients last year.
H1B allocation this Year
"To ensure a fair and orderly distribution of available H-1B visas, USCIS will deny or revoke multiple petitions filed by an employer for the same H-1B worker and will not refund the filing fees submitted with multiple or duplicative petitions," the US Citizenship and Immigration Services said in an announcement.
The Congress has set a limit of 65,000 for most H-1B workers for the fiscal 2009.
Additionally, the first 20,000 H-1B workers who have a US Master's degree or higher are exempted from the cap.
Under current procedures, which are not changed by this rule, once USCIS receives 20,000 petitions for aliens with a US Master's degree or higher, all other cases requesting the educational exemption are counted toward the 65,000 cap.
Once the 65,000 cap is reached for a fiscal year, USCIS will announce that the cap has been filled and reject further petitions subject to the cap.
The rule also stipulates that if USCIS determines the number of H-1B petitions received meets the cap within the first five business days of accepting applications for the coming fiscal year, USCIS will apply a random selection process among all H-1B petitions received during this time period.
"If the 20,000 advanced degree limit is reached during the first five business days, USCIS will randomly select from those petitions ahead of conducting the random selection for the 65,000 limit. Petitions subject to the 20,000 limit that are not selected in that random selection will be considered with the other H-1B petitions in the random selection for the 65,000 limit," the agency said.
The rule further clarifies that USCIS will deny petitions that incorrectly claim an exemption from any H-1B numerical limits and those filing fees will not be returned.
stat() function
stat, fstat, lstat - get file status
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int stat(const char *path, struct stat *buf);
int fstat(int filedes, struct stat *buf);
int lstat(const char *path, struct stat *buf);
Description
These functions return information about a file. No permissions are required on the file itself, but -- in the case of stat() and lstat() -- execute (search) permission is required on all of the directories in path that lead to the file.
stat() stats the file pointed to by path and fills in buf.
lstat() is identical to stat(), except that if path is a symbolic link, then the link itself is stat-ed, not the file that it refers to.
fstat() is identical to stat(), except that the file to be stat-ed is specified by the file descriptor filedes.
All of these system calls return a stat structure, which contains the following fields:
The following flags are defined for the st_mode field:struct stat {
dev_t st_dev; /* ID of device containing file */
ino_t st_ino; /* inode number */
mode_t st_mode; /* protection */
nlink_t st_nlink; /* number of hard links */
uid_t st_uid; /* user ID of owner */
gid_t st_gid; /* group ID of owner */
dev_t st_rdev; /* device ID (if special file) */
off_t st_size; /* total size, in bytes */
blksize_t st_blksize; /* blocksize for filesystem I/O */
blkcnt_t st_blocks; /* number of blocks allocated */
time_t st_atime; /* time of last access */
time_t st_mtime; /* time of last modification */
time_t st_ctime; /* time of last status change */
};
S_IFMT | 0170000 | bitmask for the file type bitfields |
S_IFSOCK | 0140000 | socket |
S_IFLNK | 0120000 | symbolic link |
S_IFREG | 0100000 | regular file |
S_IFBLK | 0060000 | block device |
S_IFDIR | 0040000 | directory |
S_IFCHR | 0020000 | character device |
S_IFIFO | 0010000 | FIFO |
S_ISUID | 0004000 | set UID bit |
S_ISGID | 0002000 | set-group-ID bit (see below) |
S_ISVTX | 0001000 | sticky bit (see below) |
S_IRWXU | 00700 | mask for file owner permissions |
S_IRUSR | 00400 | owner has read permission |
S_IWUSR | 00200 | owner has write permission |
S_IXUSR | 00100 | owner has execute permission |
S_IRWXG | 00070 | mask for group permissions |
S_IRGRP | 00040 | group has read permission |
S_IWGRP | 00020 | group has write permission |
S_IXGRP | 00010 | group has execute permission |
S_IRWXO | 00007 | mask for permissions for others (not in group) |
S_IROTH | 00004 | others have read permission |
S_IWOTH | 00002 | others have write permission |
S_IXOTH | 00001 | others have execute permission |
Linux Notes
Since kernel 2.5.48, the stat structure supports nanosecond resolution for the three file timestamp fields. Glibc exposes the nanosecond component of each field using names either of the form st_atim.tv_nsec, if the _BSD_SOURCE or _SVID_SOURCE feature test macro is defined, or of the form st_atimensec, if neither of these macros is defined. On file systems that do not support sub-second timestamps, these nanosecond fields are returned with the value 0.For most files under the /proc directory, stat() does not return the file size in the st_size field; instead the field is returned with the value 0.
Return Value
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.Wednesday, March 19, 2008
What is Effective Communication??
Jack and Max are walking from religious service. Jack wonders whether it would
be all right to smoke while praying.
Max replies, "Why don't you ask the Priest?"
So Jack goes up to the Priest and asks, "Priest,may I smoke while I pray?"
But the Priest says,
"No, my son, you may not. That's utter disrespect to our religion."
Jack goes back to his friend and tells him what the good Priest told him.
Max says, "I'm not surprised. You asked the wrong question. Let me try."
And so Max goes up to the Priest and asks, "Priest, may I pray while I smoke?"
To which the Priest eagerly replies, "By all means, my son. By all means."
Moral : The reply you get depends on the question you ask.
For Example : Can I work on this project while I'm on vacation ?!?
Linux CLI commands
Command | Description | |
• | apropos whatis | Show commands pertinent to string. See also threadsafe |
• | man -t man | ps2pdf - > man.pdf | make a pdf of a manual page |
which command | Show full path name of command | |
time command | See how long a command takes | |
• | time cat | Start stopwatch. Ctrl-d to stop. See also sw |
• | nice info | Run a low priority command (The "info" reader in this case) |
• | renice 19 -p $$ | Make shell (script) low priority. Use for non interactive tasks |
dir navigation | ||
• | cd - | Go to previous directory |
• | cd | Go to $HOME directory |
(cd dir && command) | Go to dir, execute command and return to current dir | |
• | pushd . | Put current dir on stack so you can popd back to it |
file searching | ||
• | alias l='ls -l --color=auto' | quick dir listing |
• | ls -lrt | List files by date. See also newest and find_mm_yyyy |
• | ls /usr/bin | pr -T9 -W$COLUMNS | Print in 9 columns to width of terminal |
find -name '*.[ch]' | xargs grep -E 'expr' | Search 'expr' in this dir and below. See also findrepo | |
find -type f -print0 | xargs -r0 grep -F 'example' | Search all regular files for 'example' in this dir and below | |
find -maxdepth 1 -type f | xargs grep -F 'example' | Search all regular files for 'example' in this dir | |
find -maxdepth 1 -type d | while read dir; do echo $dir; echo cmd2; done | Process each item with multiple commands (in while loop) | |
• | find -type f ! -perm -444 | Find files not readable by all (useful for web site) |
• | find -type d ! -perm -111 | Find dirs not accessible by all (useful for web site) |
• | locate -r 'file[^/]*\.txt' | Search cached index for names. This re is like glob *file*.txt |
• | look reference | Quickly search (sorted) dictionary for prefix |
• | grep --color reference /usr/share/dict/words | Highlight occurances of regular expression in dictionary |
archives and compression | ||
gpg -c file | Encrypt file | |
gpg file.gpg | Decrypt file | |
tar -c dir/ | bzip2 > dir.tar.bz2 | Make compressed archive of dir/ | |
bzip2 -dc dir.tar.bz2 | tar -x | Extract archive (use gzip instead of bzip2 for tar.gz files) | |
tar -c dir/ | gzip | gpg -c | ssh user@remote 'dd of=dir.tar.gz.gpg' | Make encrypted archive of dir/ on remote machine | |
find dir/ -name '*.txt' | tar -c --files-from=- | bzip2 > dir_txt.tar.bz2 | Make archive of subset of dir/ and below | |
find dir/ -name '*.txt' | xargs cp -a --target-directory=dir_txt/ --parents | Make copy of subset of dir/ and below | |
( tar -c /dir/to/copy ) | ( cd /where/to/ && tar -x -p ) | Copy (with permissions) copy/ dir to /where/to/ dir | |
( cd /dir/to/copy && tar -c . ) | ( cd /where/to/ && tar -x -p ) | Copy (with permissions) contents of copy/ dir to /where/to/ | |
( tar -c /dir/to/copy ) | ssh -C user@remote 'cd /where/to/ && tar -x -p' | Copy (with permissions) copy/ dir to remote:/where/to/ dir | |
dd bs=1M if=/dev/sda | gzip | ssh user@remote 'dd of=sda.gz' | Backup harddisk to remote machine | |
rsync (Use the --dry-run option for testing) | ||
rsync -P rsync://rsync.server.com/path/to/file file | Only get diffs. Do multiple times for troublesome downloads | |
rsync --bwlimit=1000 fromfile tofile | Locally copy with rate limit. It's like nice for I/O | |
rsync -az -e ssh --delete ~/public_html/ remote.com:'~/public_html' | Mirror web site (using compression and encryption) | |
rsync -auz -e ssh remote:/dir/ . && rsync -auz -e ssh . remote:/dir/ | Synchronize current directory with remote one | |
ssh (Secure SHell) | ||
ssh $USER@$HOST command | Run command on $HOST as $USER (default command=shell) | |
• | ssh -f -Y $USER@$HOSTNAME xeyes | Run GUI command on $HOSTNAME as $USER |
scp -p -r $USER@$HOST: file dir/ | Copy with permissions to $USER's home directory on $HOST | |
ssh -g -L 8080:localhost:80 root@$HOST | Forward connections to $HOSTNAME:8080 out to $HOST:80 | |
ssh -R 1434:imap:143 root@$HOST | Forward connections from $HOST:1434 in to imap:143 | |
wget (multi purpose download tool) | ||
• | (cd cli && wget -nd -pHEKk http://www.pixelbeat.org/cmdline.html) | Store local browsable version of a page to the current dir |
wget -c http://www.example.com/large.file | Continue downloading a partially downloaded file | |
wget -r -nd -np -l1 -A '*.jpg' http://www.example.com/dir/ | Download a set of files to the current directory | |
wget ftp://remote/file[1-9].iso/ | FTP supports globbing directly | |
• | wget -q -O- http://www.pixelbeat.org/timeline.html | grep 'a href' | head | Process output directly |
echo 'wget url' | at 01:00 | Download url at 1AM to current dir | |
wget --limit-rate=20k url | Do a low priority download (limit to 20KB/s in this case) | |
wget -nv --spider --force-html -i bookmarks.html | Check links in a file | |
wget --mirror http://www.example.com/ | Efficiently update a local copy of a site (handy from cron) | |
networking (Note ifconfig, route, mii-tool, nslookup commands are obsolete) | ||
ethtool eth0 | Show status of ethernet interface eth0 | |
ethtool --change eth0 autoneg off speed 100 duplex full | Manually set ethernet interface speed | |
iwconfig eth1 | Show status of wireless interface eth1 | |
iwconfig eth1 rate 1Mb/s fixed | Manually set wireless interface speed | |
• | iwlist scan | List wireless networks in range |
• | ip link show | List network interfaces |
ip link set dev eth0 name wan | Rename interface eth0 to wan | |
ip link set dev eth0 up | Bring interface eth0 up (or down) | |
• | ip addr show | List addresses for interfaces |
ip addr add 1.2.3.4/24 brd + dev eth0 | Add (or del) ip and mask (255.255.255.0) | |
• | ip route show | List routing table |
ip route add default via 1.2.3.254 | Set default gateway to 1.2.3.254 | |
• | tc qdisc add dev lo root handle 1:0 netem delay 20msec | Add 20ms latency to loopback device (for testing) |
• | tc qdisc del dev lo root | Remove latency added above |
• | host pixelbeat.org | Lookup DNS ip address for name or vice versa |
• | hostname -i | Lookup local ip address (equivalent to host `hostname`) |
• | whois pixelbeat.org | Lookup whois info for hostname or ip address |
• | netstat -tupl | List internet services on a system |
• | netstat -tup | List active connections to/from system |
windows networking (Note samba is the package that provides all this windows specific networking support) | ||
• | smbtree | Find windows machines. See also findsmb |
nmblookup -A 1.2.3.4 | Find the windows (netbios) name associated with ip address | |
smbclient -L windows_box | List shares on windows machine or samba server | |
mount -t smbfs -o fmask=666,guest //windows_box/share /mnt/share | Mount a windows share | |
echo 'message' | smbclient -M windows_box | Send popup to windows machine (off by default in XP sp2) | |
text manipulation (Note sed uses stdin and stdout, so if you want to edit files, append | ||
sed 's/string1/string2/g' | Replace string1 with string2 | |
sed 's/\(.*\)1/\12/g' | Modify anystring1 to anystring2 | |
sed '/ *#/d; /^ *$/d' | Remove comments and blank lines | |
sed ':a; /\\$/N; s/\\\n//; ta' | Concatenate lines with trailing \ | |
sed 's/[ \t]*$//' | Remove trailing spaces from lines | |
sed 's/\([\\`\\"$\\\\]\)/\\\1/g' | Escape shell metacharacters active within double quotes | |
• | seq 10 | sed "s/^/ /; s/ *\(.\{7,\}\)/\1/" | Right align numbers |
sed -n '1000p;1000q' | Print 1000th line | |
sed -n '10,20p;20q' | Print lines 10 to 20 | |
sed -n 's/.* | Extract title from HTML web page | |
sort -t. -k1,1n -k2,2n -k3,3n -k4,4n | Sort IPV4 ip addresses | |
• | echo 'Test' | tr '[:lower:]' '[:upper:]' | Case conversion |
• | tr -dc '[:print:]' < /dev/urandom | Filter non printable characters |
• | history | wc -l | Count lines |
set operations (Note you can export LANG=C for speed. Also these assume no duplicate lines within a file) | ||
sort file1 file2 | uniq | Union of unsorted files | |
sort file1 file2 | uniq -d | Intersection of unsorted files | |
sort file1 file1 file2 | uniq -u | Difference of unsorted files | |
sort file1 file2 | uniq -u | Symmetric Difference of unsorted files | |
join -a1 -a2 file1 file2 | Union of sorted files | |
join file1 file2 | Intersection of sorted files | |
join -v2 file1 file2 | Difference of sorted files | |
join -v1 -v2 file1 file2 | Symmetric Difference of sorted files | |
math | ||
• | echo '(1 + sqrt(5))/2' | bc -l | Quick math (Calculate φ). See also bc |
• | echo 'pad=20; min=64; (100*10^6)/((pad+min)*8)' | bc | More complex (int) e.g. This shows max FastE packet rate |
• | echo 'pad=20; min=64; print (100E6)/((pad+min)*8)' | python | Python handles scientific notation |
• | echo 'pad=20; plot [64:1518] (100*10**6)/((pad+x)*8)' | gnuplot -persist | Plot FastE packet rate vs packet size |
• | echo 'obase=16; ibase=10; 64206' | bc | Base conversion (decimal to hexadecimal) |
• | echo $((0x2dec)) | Base conversion (hex to dec) ((shell arithmetic expansion)) |
• | units -t '100m/9.74s' 'miles/hour' | Unit conversion (metric to imperial) |
• | units -t '500GB' 'GiB' | Unit conversion (SI to IEC prefixes) |
• | units -t '1 googol' | Definition lookup |
• | seq 100 | (tr '\n' +; echo 0) | bc | Add a column of numbers. See also add and funcpy |
calendar | ||
• | cal -3 | Display a calendar |
• | cal 9 1752 | Display a calendar for a particular month year |
• | date -d fri | What date is it this friday. See also day |
• | date --date='25 Dec' +%A | What day does xmas fall on, this year |
• | date --date '1970-01-01 UTC 2147483647 seconds' | Convert number of seconds since the epoch to a date |
• | TZ=':America/Los_Angeles' date | What time is it on West coast of US (use tzselect to find TZ) |
echo "mail -s 'get the train' P@draigBrady.com < /dev/null" | at 17:45 | Email reminder | |
• | echo "DISPLAY=$DISPLAY xmessage cooker" | at "NOW + 30 minutes" | Popup reminder |
locales | ||
• | printf "%'d\n" 1234 | Print number with thousands grouping appropriate to locale |
• | BLOCK_SIZE=\'1 ls -l | get ls to do thousands grouping appropriate to locale |
• | echo "I live in `locale territory`" | Extract info from locale database |
• | LANG=en_IE.utf8 locale int_prefix | Lookup locale info for specific country. See also ccodes |
• | locale | cut -d= -f1 | xargs locale -kc | less | List fields available in locale database |
recode (Obsoletes iconv, dos2unix, unix2dos) | ||
• | recode -l | less | Show available conversions (aliases on each line) |
recode windows-1252.. file_to_change.txt | Windows "ansi" to local charset (auto does CRLF conversion) | |
recode utf-8/CRLF.. file_to_change.txt | Windows utf8 to local charset | |
recode iso-8859-15..utf8 file_to_change.txt | Latin9 (western europe) to utf8 | |
recode ../b64 <> file.b64 | Base64 encode | |
recode /qp.. <> file.qp | Quoted printable decode | |
recode ..HTML <> file.html | Text to HTML | |
• | recode -lf windows-1252 | grep euro | Lookup table of characters |
• | echo -n 0x80 | recode latin-9/x1..dump | Show what a code represents in latin-9 charmap |
• | echo -n 0x20AC | recode ucs-2/x2..latin-9/x | Show latin-9 encoding |
• | echo -n 0x20AC | recode ucs-2/x2..utf-8/x | Show utf-8 encoding |
CDs | ||
gzip < /dev/cdrom > cdrom.iso.gz | Save copy of data cdrom | |
mkisofs -V LABEL -r dir | gzip > cdrom.iso.gz | Create cdrom image from contents of dir | |
mount -o loop cdrom.iso /mnt/dir | Mount the cdrom image at /mnt/dir (read only) | |
cdrecord -v dev=/dev/cdrom blank=fast | Clear a CDRW | |
gzip -dc cdrom.iso.gz | cdrecord -v dev=/dev/cdrom - | Burn cdrom image (use dev=ATAPI -scanbus to confirm dev) | |
cdparanoia -B | Rip audio tracks from CD to wav files in current dir | |
cdrecord -v dev=/dev/cdrom -audio *.wav | Make audio CD from all wavs in current dir (see also cdrdao) | |
oggenc --tracknum='track' track.cdda.wav -o 'track.ogg' | Make ogg file from wav file | |
disk space (See also FSlint) | ||
• | ls -lSr | Show files by size, biggest last |
• | du -s * | sort -k1,1rn | head | Show top disk users in current dir. See also dutop |
• | df -h | Show free space on mounted filesystems |
• | df -i | Show free inodes on mounted filesystems |
• | fdisk -l | Show disks partitions sizes and types (run as root) |
• | rpm -q -a --qf '%10{SIZE}\t%{NAME}\n' | sort -k1,1n | List all packages by installed size (Bytes) on rpm distros |
• | dpkg-query -W -f='${Installed-Size;10}\t${Package}\n' | sort -k1,1n | List all packages by installed size (KBytes) on deb distros |
• | dd bs=1 seek=2TB if=/dev/null of=ext3.test | Create a large test file (taking no space). See also truncate |
monitoring/debugging | ||
• | tail -f /var/log/messages | Monitor messages in a log file |
• | strace -c ls >/dev/null | Summarise/profile system calls made by command |
• | strace -f -e open ls >/dev/null | List system calls made by command |
• | ltrace -f -e getenv ls >/dev/null | List library calls made by command |
• | lsof -p $$ | List paths that process id has open |
• | lsof ~ | List processes that have specified path open |
• | tcpdump not port 22 | Show network traffic except ssh. See also tcpdump_not_me |
• | ps -e -o pid,args --forest | List processes in a hierarchy |
• | ps -e -o pcpu,cpu,nice,state,cputime,args --sort pcpu | sed '/^ 0.0 /d' | List processes by % cpu usage |
• | ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS | List processes by mem usage. See also ps_mem.py |
• | ps -C firefox-bin -L -o pid,tid,pcpu,state | List all threads for a particular process |
• | ps -p 1,2 | List info for particular process IDs |
• | last reboot | Show system reboot history |
• | free -m | Show amount of (remaining) RAM (-m displays in MB) |
• | watch -n1 'cat /proc/interrupts' | Watch changeable data continuously |
system information (see also sysinfo) ('#' means root access is required) | ||
• | uname -a | Show kernel version and system architecture |
• | head -n1 /etc/issue | Show name and version of distribution |
• | cat /proc/partitions | Show all partitions registered on the system |
• | grep MemTotal /proc/meminfo | Show RAM total seen by the system |
• | grep "model name" /proc/cpuinfo | Show CPU(s) info |
• | lspci -tv | Show PCI info |
• | lsusb -tv | Show USB info |
• | mount | column -t | List mounted filesystems on the system (and align output) |
# | dmidecode -q | less | Display SMBIOS/DMI information |
# | smartctl -A /dev/sda | grep Power_On_Hours | How long has this disk (system) been powered on in total |
# | hdparm -i /dev/sda | Show info about disk sda |
# | hdparm -tT /dev/sda | Do a read speed test on disk sda |
# | badblocks -s /dev/sda | Test for unreadable blocks on disk sda |
interactive (see also linux keyboard shortcuts) | ||
• | readline | Line editor used by bash, python, bc, gnuplot, ... |
• | screen | Virtual terminals with detach capability, ... |
• | mc | Powerful file manager that can browse rpm, tar, ftp, ssh, ... |
• | gnuplot | Interactive/scriptable graphing |
• | links | Web browser |
miscellaneous | ||
• | alias hd='od -Ax -tx1z -v' | Handy hexdump. (usage e.g.: • hd /proc/self/cmdline | less) |
• | alias realpath='readlink -f' | Canonicalize path. (usage e.g.: • realpath ~/../$USER) |
• | set | grep $USER | Search current environment |
touch -c -t 0304050607 file | Set file timestamp (YYMMDDhhmm) |
waitpid()
waitpid - wait for process termination
Headers:
#include
#include
DESCRIPTION
The waitpid function suspends execution of the current
process until a child as specified by the pid argument has
exited, or until a signal is delivered whose action is to
terminate the current process or to call a signal handling
function. If a child as requested by pid has already
exited by the time of the call (a so-called "zombie" pro-
cess), the function returns immediately. Any system
resources used by the child are freed.
The value of pid can be one of:
< -1 which means to wait for any child process whose
process group ID is equal to the absolute value of
-1 which means to wait for any child process; this is
the same behaviour which wait exhibits.
0 which means to wait for any child process whose
process group ID is equal to that of the calling
process.
> 0 which means to wait for the child whose process ID
is equal to the value of pid.
The value of options is an exclusive OR of zero or more of
the following constants:
WNOHANG which means to return immediately if no child has
exited.
WUNTRACED
which means to also return for children which are
If status is not NULL, wait or waitpid store status infor-
mation in the location pointed to by statloc.
This status can be evaluated with the following macros
(these macros take the stat buffer as an argument -- not a
pointer to the buffer!):
WIFEXITED(status)
is non -zero if the child exited normally.
WEXITSTATUS(status)
evaluates to the least significant eight bits of
the return code of the child which terminated,
which may have been set as the argument to a call
to exit() or as the argument for a return state-
ment in the main program. This macro can only be
evaluated if WIFEXITED returned non-zero.
WIFSIGNALED(status)
returns true if the child process exited because
of a signal which was not caught.
WTERMSIG(status)
returns the number of the signal that caused the
child process to terminate. This macro can only be
evaluated if WIFSIGNALED returned non-zero.
WIFSTOPPED(status)
returns true if the child process which caused the
return is currently stopped; this is only possible
if the call was done using WUNTRACED.
WSTOPSIG(status)
returns the number of the signal which caused the
child to stop. This macro can only be evaluated
if WIFSTOPPED returned non-zero.
stopped, and whose status has not been reported.
signal management 1 in linux/+
#include <signal.h>
int sighold(int sig);
int sigignore(int sig);
int sigpause(int sig);
int sigrelse(int sig);
void (*sigset(int sig, void (*disp)(int)))(int);
Description :
The sighold(), sigignore(), sigpause(), sigrelse(), and sigset() functions provide simplified signal management.
The sigset() function shall modify signal dispositions. The sig argument specifies the signal, which may be any signal except SIGKILL and SIGSTOP. The disp argument specifies the signal's disposition, which may be SIG_DFL, SIG_IGN, or the address of a signal handler. If sigset() is used, and disp is the address of a signal handler, the system shall add sig to the calling process' signal mask before executing the signal handler; when the signal handler returns, the system shall restore the calling process' signal mask to its state prior to the delivery of the signal. In addition, if sigset() is used, and disp is equal to SIG_HOLD, sig shall be added to the calling process' signal mask and sig's disposition shall remain unchanged. If sigset() is used, and disp is not equal to SIG_HOLD, sig shall be removed from the calling process' signal mask.
The sighold() function shall add sig to the calling process' signal mask.
The sigrelse() function shall remove sig from the calling process' signal mask.
The sigignore() function shall set the disposition of sig to SIG_IGN.
The sigpause() function shall remove sig from the calling process' signal mask and suspend the calling process until a signal is received. The sigpause() function shall restore the process' signal mask to its original state before returning.
If the action for the SIGCHLD signal is set to SIG_IGN, child processes of the calling processes shall not be transformed into zombie processes when they terminate. If the calling process subsequently waits for its children, and the process has no unwaited-for children that were transformed into zombie processes, it shall block until all of its children terminate, and wait(), waitid(), and waitpid() shall fail and set errno to [ECHILD].
RETURN VALUE
pon successful completion, sigset() shall return SIG_HOLD if the signal had been blocked and the signal's previous disposition if it had not been blocked. Otherwise, SIG_ERR shall be returned and errno set to indicate the error.The sigpause() function shall suspend execution of the thread until a signal is received, whereupon it shall return -1 and set errno to [EINTR].
For all other functions, upon successful completion, 0 shall be returned. Otherwise, -1 shall be returned and errno set to indicate the error.
FAILING CONDITIONS :
These functions shall fail if:
- The sig argument is an illegal signal number.
- An attempt is made to catch a signal that cannot be caught, or to ignore a signal that cannot be ignored.
Xtem Syntax
Terminal emulator for X-windows Terminal
xterm [-toolkitoption ...] [-option]
-help | This causes xterm to print out a verbose message describing its options. |
-132 | Normally, the VT102 DECCOLM escape sequence that switches between 80 and 132 column mode is ignored. This option causes the DECCOLM escape sequence to be recognized, and the xterm window will resize appropriately. |
-ah | This option indicates that xterm should always highlight the text cursor. By default, xterm will display a hollow text cursor whenever the focus is lost or the pointer leaves the window. |
+ah | This option indicates that xterm should do text cursor highlighting based on focus. |
-b number | This option specifies the size of the inner border (the distance between the outer edge of the characters and the window border) in pixels. The default is 2. |
-cb | Set the vt100 resource cutToBeginningOfLine to FALSE. |
+cb | Set the vt100 resource cutToBeginningOfLine to TRUE. |
-cc | This sets classes indicated by the given ranges for using in selecting by words. See the section specifying character classes. |
-cn | This option indicates that newlines should not be cut in line-mode selections. |
+cn | This option indicates that newlines should be cut in line-mode selections. |
-cr color | This option specifies the color to use for text cursor. The default is to use the same foreground color that is used for text. |
-cu | This option indicates that xterm should work around a bug in the more program that causes it to incorrectly display lines that are exactly the width of the window and are followed by a line beginning with a tab (the leading tabs are not displayed). This option is so named because it was originally thought to be a bug in the curses(3x) cursor motion package. |
+cu | This option indicates that xterm should not work around the more(3x) bug mentioned above. |
-e program [arguments] | This option specifies the program (and its command line arguments) to be run in the xterm window. It also sets the window title and icon name to be the basename of the program being executed if neither -T nor -n are given on the command line. This must be the last option on the command line. |
-fb font | This option specifies a font to be used when displaying bold text. This font must be the same height and width as the normal font. If only one of the normal or bold fonts is specified, it will be used as the normal font and the bold font will be produced by overstriking this font. The default is to do overstriking of the normal font. |
-im | Turn on the useInsertMode resource. |
+im | Turn off the useInsertMode resource. |
-j | This option indicates that xterm should do jump scrolling. Normally, text is scrolled one line at a time; this option allows xterm to move multiple lines at a time so that it doesn't fall as far behind. Its use is strongly recommended since it make xterm much faster when scanning through large amounts of text. The VT100 escape sequences for enabling and disabling smooth scroll as well as the ``VT Options'' menu can be used to turn this feature on or off. |
+j | This option indicates that xterm should not do jump scrolling. |
-ls | This option indicates that the shell that is started in the xterm window will be a login shell (i.e., the first character of argv[0] will be a dash, indicating to the shell that it should read the user's .login or .profile). |
+ls | This option indicates that the shell that is started should not be a login shell (i.e. it will be a normal ``subshell''). |
-mb | This option indicates that xterm should ring a margin bell when the user types near the right end of a line. This option can be turned on and off from the ``VT Options'' menu. |
+mb | This option indicates that margin bell should not be rung. |
-mc milliseconds | This option specifies the maximum time between multi-click selections. |
-ms color | This option specifies the color to be used for the pointer cursor. The default is to use the foreground color. |
-nb number | This option specifies the number of characters from the right end of a line at which the margin bell, if enabled, will ring. The default is 10. |
-rw | This option indicates that reverse-wraparound should be allowed. This allows the cursor to backup from the leftmost column of one line to the rightmost column of the previous line. This is very useful for editing long shell command lines and is encouraged. This option can be turned on and off from the ``VT Options'' menu. |
+rw | This option indicates that reverse-wraparound should not be allowed. |
-aw | This option indicates that auto-wraparound should be allowed. This allows the cursor to automatically wrap to the beginning of the next line when when it is at the rightmost position of a line and text is output. |
+aw | This option indicates that auto-wraparound should not be allowed. |
-s | This option indicates that xterm may scroll asynchronously, meaning that the screen does not have to be kept completely up to date while scrolling. This allows xterm to run faster when network latencies are very high and is typically useful when running across a very large Internet or many gateways. |
+s | This option indicates that xterm should scroll synchronously. |
-sb | This option indicates that some number of lines that are scrolled off the top of the window should be saved and that a scrollbar should be displayed so that those lines can be viewed. This option may be turned on and off from the ``VT Options'' menu. |
+sb | This option indicates that a scrollbar should not be displayed. |
-sf | This option indicates that Sun Function Key escape codes should be generated for function keys. |
+sf | This option indicates that the standard escape codes should be generated for function keys. |
-si | This option indicates that output to a window should not automatically reposition the screen to the bottom of the scrolling region. This option can be turned on and off from the ``VT Options'' menu. |
+si | This option indicates that output to a window should cause it to scroll to the bottom. |
-sk | This option indicates that pressing a key while using the scrollbar to review previous lines of text should cause the window to be repositioned automatically in the normal position at the bottom of the scroll region. |
+sk | This option indicates that pressing a key while using the scrollbar should not cause the window to be repositioned. |
-sl number | This option specifies the number of lines to save that have been scrolled off the top of the screen. The default is 64. |
-t | This option indicates that xterm should start in Tektronix mode, rather than in VT102 mode. Switching between the two windows is done using the ``Options'' menus. |
+t | This option indicates that xterm should start in VT102 mode. |
-tm string | This option specifies a series of terminal setting keywords followed by the characters that should be bound to those functions, similar to the stty program. Allowable keywords include: intr, quit, erase, kill, eof, eol, swtch, start, stop, brk, susp, dsusp, rprnt, flush, weras, and lnext. Cotrol characters may be specified as ^char (e.g. ^c or ^u) and ^? may be used to indicate delete. |
-tn name | This option specifies the name of the terminal type to be set in the TERM environment variable. This terminal type must exist in the termcap database and should have li# and co# entries. |
-ut | This option indicates that xterm shouldn't write a record into the the system log file /etc/utmp. |
+ut | This option indicates that xterm should write a record into the system log file /etc/utmp. |
-vb | This option indicates that a visual bell is preferred over an audible one. Instead of ringing the terminal bell whenever a Control-G is received, the window will be flashed. |
+vb | This option indicates that a visual bell should not be used. |
-wf | This option indicates that xterm should wait for the window to be mapped the first time before starting the subprocess so that the initial terminal size settings and environment variables are correct. It is the application's responsibility to catch subsequent terminal size changes. |
+wf | This option indicates that xterm show not wait before starting the subprocess. |
-C | This option indicates that this window should receive console output. This is not supported on all systems. To obtain console output, you must be the owner of the console device, and you must have read and write permission for it. If you are running X under xdm on the console screen you may need to have the session startup and reset programs explicitly change the ownership of the console device in order to get this option to work. |
Sccn | This option specifies the last two letters of the name of a pseudoterminal to use in slave mode, plus the number of the inherited file descriptor. The option is parsed ``%c%c%d''. This allows xterm to be used as an input and output channel for an existing program and is sometimes used in specialized applications. |
%geom | This option specifies the preferred size and position of the Tektronix window. It is shorthand for specifying the ``*tekGeometry'' resource. |
#geom | This option specifies the preferred position of the icon window. It is shorthand for specifying the ``*iconGeometry'' resource. |
-T string | This option specifies the title for xterm's windows. It is equivalent to -title. |
-n string | This option specifies the icon name for xterm's windows. It is shorthand for specifying the ``*icon- Name'' resource. Note that this is not the same as the toolkit option -name (see below). The default icon name is the application name. |
-r | This option indicates that reverse video should be simulated by swapping the foreground and background colors. It is equivalent to -rv. |
-w number | This option specifies the width in pixels of the border surrounding the window. It is equivalent to -borderwidth or -bw. |
-bg color | This option specifies the color to use for the background of the window. The default is ``white.'' |
-bd color | This option specifies the color to use for the border of the window. The default is ``black.'' |
-bw color | This option specifies the width in pixels of the border surrounding the window. |
-fg color | This option specifies the color to use for displaying text. The default is ``black.'' |
-fn color | This option specifies the font to be used for displaying normal text. The default is fixed. |
-fn font | This option specifies the font to be used for displaying normal text. The default is fixed. |
-name name | This option specifies the application name under which resources are to be obtained, rather than the default executable file name. Name should not contain ``.'' or ``*'' characters. |
-title string | This option specifies the window title string, which may be displayed by window managers if the user so chooses. The default title is the command line specified after the -e option, if any, otherwise the application name. |
-rv | This option indicates that reverse video should be simulated by swapping the foreground and background colors. |
-geometry geometry | This option specifies the preferred size and position of the VT102 window; see X(1). |
-display display | This option specifies the X server to contact; see X. |
-xrm resourcestring | This option specifies a resource string to be used. This is especially useful for setting resources that do not have separate command line options. |
-iconic | This option indicates that xterm should ask the window manager to start it as an icon rather than as the normal window. |
-dc | This option disables the escape sequence to change the vt100 foreground and background colors, the text cursor color, the mouse cursor foreground and background colors and the Tektronix emulator foreground and background colors. |
+dc | This option enables the escape sequence to change the vt100 foreground and background colors, the text cursor color, the mouse cursor foreground and background colors and the Tektronix emulator foreground and background |
xterm - runs the X terminal (if supported).