Search This Blog
Monday, February 25, 2013
Sunday, February 24, 2013
what "> /dev/null 2>&1" mean??
> /dev/null 2>&1
You need to understand the theory first and then its upto you how and where you want to apply that theory. I'll try to explain above to you.
The greater-than (>) in commands like these redirect the program’s output somewhere. In this case, something is being redirected into /dev/null, and something is being redirected into &1.
Standard in, out and error:
There are three standard sources of input and output for a program. Standard input usually comes from the keyboard if it’s an interactive program, or from another program if it’s processing the other program’s output. The program usually prints to standard output, and sometimes prints to standard error. These three file descriptors (you can think of them as “data pipes”) are often called STDIN, STDOUT, and STDERR.
Sometimes they’re not named, they’re numbered! The built-in numberings for them are 0, 1, and 2, in that order. By default, if you don’t name or number one explicitly, you’re talking about STDOUT.
That means file descriptor 0 or fd0 denotes STDIN or standard input and file descriptor 1 or fd1 denotes STDOUT or standard output and file descriptor 2 or fd2 denotes STDERR or standard error.
You can see the command above is redirecting standard output into /dev/null, which is a place you can dump anything you don’t want (often called the bit-bucket), then redirecting standard error into standard output (you have to put an & in front of the destination when you do this).
The short explanation, therefore, is “all output from this command should be shoved into a black hole.” That’s one good way to make a program be really quiet!
Friday, February 22, 2013
Thursday, February 7, 2013
What happens when you format a disk?
A new disk is like a blank sheet of paper. When it is formatted, it becomes organized into numbered blocks with an index to what is in each square, and which blocks are free to write to.
Each format type organizes the disk into a certain number of blocks of a certain size so that it can quickly read from and write to each block.
The index and the numbering system use space on the disk. So even though the empty size is 100% the formatted size is 90% or something.
When you format an old disk, you have two ways. Just erase the index, and the system thinks it can write to every block. This is a 'quick format' and leaves all the old information on the disk. A 'deep format' erases everything and starts over with no information on the disk. A disk recovery application can easily find information on a quick formatted disk.
The index and the numbering system use space on the disk. So even though the empty size is 100% the formatted size is 90% or something.
When you format an old disk, you have two ways. Just erase the index, and the system thinks it can write to every block. This is a 'quick format' and leaves all the old information on the disk. A 'deep format' erases everything and starts over with no information on the disk. A disk recovery application can easily find information on a quick formatted disk.
Subscribe to:
Posts (Atom)