Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1463
  • Last Modified:

dd if=/dev/null of=sparse-file-1 bs=1M seek=100352

i can't not interpret this command, what will it do


dd if=/dev/null of=sparse-file-1 bs=1M seek=100352
0
aashee
Asked:
aashee
  • 3
1 Solution
 
rowansmithCommented:
It will create a empty file called "sparse-file-1" of size 1Mb

0
 
rowansmithCommented:
rowan@daedalus:~/dd$ dd if=/dev/null of=sparse-file-1 bs=1M seek=100352
0+0 records in
0+0 records out
0 bytes (0 B) copied, 2.1698e-05 s, 0.0 kB/s
rowan@daedalus:~/dd$ ls -la
total 8
drwxr-xr-x  2 rowan users         4096 2011-02-19 11:50 .
drwxr-xr-x 14 rowan users         4096 2011-02-19 11:50 ..
-rw-r--r--  1 rowan users 105226698752 2011-02-19 11:50 sparse-file-1
0
 
aasheeAuthor Commented:
Hi Rowan,
but doesn't it checks some condition and then it iwll create file .
like if=/dev/null ? what does mean by if=/dev/null
what does doea mean by of=sparse-file-1

bs=1M ?

seek=100352, what does it explain?
i want to have a deep understanding of this ?
0
 
farzanjCommented:
if : means input file.  /dev/null is Unix/Linux file.  It is a special file that provides no data if you read from it and destroys all data when you write to it but returns success.

of: output file.  Path of file to be created
bs: Block size
seek: Skip 100352 byte blocks before copying from if to of
0
 
rowansmithCommented:
No, it does not check any condition.

What happens is it skips the first 100352 blocks of the output file and starts writing the contents of /dev/null at that point.  /dev/null is empty.  Your block size is 1Mbyte (given by bs=1M)

So 100352 * 1024 * 1024 = 105226698752 bytes of nothing.

It dosn't actua;ly take up that space but,because dev/null is empty.
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now