/dev/zero 与 /dev/null
2011-11-11 20:26
162 查看
/dev/zero,是一个输入设备,你可你用它来初始化文件。
/dev/zero------该设备无穷尽地提供0,可以使用任何你需要的数目——设备提供的要多的多。他可以用于向设备或文件写入字符串0。
/dev/zero 可以说就是一个无底洞,可以向里面放多少东西它都不会觉得多
oracle@localhost oracle]$if=/dev/zero of=./test.txt bs=1k count=1
oracle@localhost oracle]$ ls -l
total 4
-rw-r--r-- 1 oracle dba 1024 Jul 15 16:56 test.txt
eg,
find / -name access_log 2>/dev/null
这样,一些诸如一些错误信息就不会显示出来。
/dev/zero:
In Unix-like operating systems, /dev/zero is a special file that provides as many null characters (ASCII NULL, 0x00; not ASCII character "digit zero", "0", 0x30)
as are read from it. One of the typical uses is to provide a character stream for overwriting information. Another might be to generate a clean file of a certain size. Using mmap to map /dev/zero to RAM is the BSD way of implementing shared memory.
# Initialise partition (important note: trying out this command will eradicate
# any files that were on the partition, make sure you have a backup of any important data.)
dd if=/dev/zero of=/dev/hda7
# Create a large empty file called 'foobar'
dd if=/dev/zero of=foobar count=1000 bs=1000
Like /dev/null, /dev/zero acts as a source and sink for data. All writes to /dev/zero succeed with no other effects (the same as for /dev/null, although /dev/null
is the more commonly used data sink); all reads on /dev/zero return as many NULs as characters requested.
/dev/zero------该设备无穷尽地提供0,可以使用任何你需要的数目——设备提供的要多的多。他可以用于向设备或文件写入字符串0。
/dev/zero 可以说就是一个无底洞,可以向里面放多少东西它都不会觉得多
oracle@localhost oracle]$if=/dev/zero of=./test.txt bs=1k count=1
oracle@localhost oracle]$ ls -l
total 4
-rw-r--r-- 1 oracle dba 1024 Jul 15 16:56 test.txt
eg,
find / -name access_log 2>/dev/null
这样,一些诸如一些错误信息就不会显示出来。
/dev/zero:
In Unix-like operating systems, /dev/zero is a special file that provides as many null characters (ASCII NULL, 0x00; not ASCII character "digit zero", "0", 0x30)
as are read from it. One of the typical uses is to provide a character stream for overwriting information. Another might be to generate a clean file of a certain size. Using mmap to map /dev/zero to RAM is the BSD way of implementing shared memory.
# Initialise partition (important note: trying out this command will eradicate
# any files that were on the partition, make sure you have a backup of any important data.)
dd if=/dev/zero of=/dev/hda7
# Create a large empty file called 'foobar'
dd if=/dev/zero of=foobar count=1000 bs=1000
Like /dev/null, /dev/zero acts as a source and sink for data. All writes to /dev/zero succeed with no other effects (the same as for /dev/null, although /dev/null
is the more commonly used data sink); all reads on /dev/zero return as many NULs as characters requested.
相关文章推荐
- Linux 下的两个特殊的文件 -- /dev/null 和 /dev/zero 简介及对比
- /dev/null 于 /dev/zero文件
- /dev/null 和/dev/zero(摘)
- Linux 中的 “/dev/null” 和 "/dev/zero"
- linux文件系统下的 /dev/null 和 /dev/zero
- Linux - 文件 /dev/null 和 /dev/zero
- /dev/null和/dev/zero的用法
- linux /dev 常见特殊设备介绍与应用[loop,null,zero,full,random]
- /dev/zero和/dev/null (转)
- 关于"/dev/null"和"/dev/zero"
- /dev/zero和/dev/null的区别
- Linux 下的两个特殊的文件 -- /dev/null 和 /dev/zero 简介及对比
- dev/null和dev/zero区别 以及换回设备(loopback device)
- /dev/null /dev/zero
- linux /dev 常见特殊设备介绍与应用[loop,null,zero,full,random]
- linux命令之dd命令详解和/dev/zero、/dev/null
- /dev/zero和/dev/null的区别
- /dev/zero和/dev/null的区别
- /dev/null与dev/zero
- /dev/null && /dev/zero