linux中在vi编辑末行模式输入5,10 w rootfile1出现"~file1" 6L, 47C written 怎么理解,为什么?急啊

linux中在vi编辑末行模式输入5,10 w rootfile1出现"~file1" 6L, 47C written 怎么理解,为什么?急啊,第1张

5,10 w /root/file1 意思:把该文件第6行到第10行的内容写到/root/file1文件中

"~/file1" 6L, 47C written 意思:上面命令执行结果是file1文件中有6行 47个字符被写入

buffer 与cache 的区别

A buffer is something that has yet to be “written” to disk. A cache is something that has been “read” from the disk and stored for later use

缓冲(buffers)是根据磁盘的读写 设计的,把分散的写 *** 作集中进行,减少磁盘碎片和硬盘的反复寻道,从而提高系统性能。linux有一个守护进程定 期清空缓冲内容(即写如磁盘),也可以通过sync命令手动清空缓冲。

缓存(cached)是把读取过的数据 保存起来,重新读取时若命中(找到需要的数据)就不要去读硬盘了,若没有命中就读硬盘。其中的数据会根据读取频率进行组织,把最频繁读取的内容放在最容易找到的位置,把不再读的内容不断往后排,直至从中删除。

d

目录文件。

l

符号链接(指向另一个文件,类似于瘟下的快捷方式)。

s

套接字文件。

b

设备文件,二进制文件。

c

字符设备文件。

p

命名管道文件。

-

普通文件,或更准确地说,不属于以上几种类型的文件。

重点注意的是普通文件,在查看文件类型的时候使用file命令和ll命令结合来查看文件的类型

设备文件分为block

device

driver和character

device

drive两类。character

device

drive又被称为字符设备或裸设备raw

devices

block

device

driver通常成为块设备。而block

device

driver是以固定大小长度来传送转移资料

;character

device

driver是以不定长度的字元传送资料

。且所连接的devices也有所不同,block

device大致是可以随机存取(random

access)资料的设备,如硬碟机或光碟机;而character

device刚好相反,依循先後顺序存取资料的设备,如印表机

、终端机等皆是。

1.字符设备只能以字节为最小单位访问,而块设备以块为单位访问,例如512字节,1024字节等

2.块设备可以随机访问,但是字符设备不可以

3.字符和块没有访问量大小的限制,块也可以以字节为单位来访问

the

type

printed

will

usually

contain

one

of

the

words

text

(the

file

contains

only

printing

characters

and

a

few

common

control

characters

and

is

probably

safe

to

read

on

an

ascii

terminal),

executable

(the

file

contains

the

result

of

compiling

a

program

in

a

form

understandable

to

some

unix

kernel

or

another),

data

meaning

anything

else

(data

is

usually

`binary'

or

non-printable).

any

file

that

cannot

be

identified

as

having

been

written

in

any

of

the

character

sets

listed

above

is

simply

said

to

be

``data''.


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/yw/7360690.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-04
下一篇 2023-04-04

发表评论

登录后才能评论

评论列表(0条)

保存