linux入门2

命令的真实路径

 [root@localhost Packages]# which ls

alias ls='ls --color=auto'

        /usr/bin/ls

[root@localhost Packages]#

所以/usr/bin/ls=ls

 

查看这个文件是哪个软件包产生的

[root@localhost CentOS 7 x86_64]# rpm -qf /usr/bin/ls

coreutils-8.22-18.el7.x86_64

[root@localhost CentOS 7 x86_64]#

 

命令执行的实际过程:

 

 

[root@localhost ~]# alias pipi='ls'

[root@localhost ~]# pipi

a                b         initial-setup-ks.cfg  uu.txt  公共  视频  文档  音乐

anaconda-ks.cfg  b.yy.txt  pp                    yy      模板  图片  下载  桌面

[root@localhost ~]#

 

建函数

alias pipi='gprep firefox'

这个程序只能在一个终端上有效,如果要其他终端上都有效,就要写进文件中

vim /etc/profile 或vim /etc/bashrc 在文件的末尾填上面的命名

 

反引号可以引入引号内的结果作为输入

创建文件并输入

[root@localhost ~]# vim uu.txt

[root@localhost ~]#

uuuuuuuuuuuuuuuu

按esc -10p就复制黏贴了10行

 

清缓存的语句

[root@localhost ~]# echo 3 > /proc/sys/vm/drop_caches

[root@localhost ~]# free -m

              total        used        free      shared  buff/cache   available

Mem:            976         580         228           5         167         219

Swap:          2047           2        2045

[root@localhost ~]#

 

share共享内存:多道(多任务)隔离,给进程之间共享数据用的。

-/+buffers/cache:

used正在使用的buffers/cache

表头的buffers/cache是内存分配出去还没用的

free是还可以分配多少

 

Cache是我打开电影看,从硬盘放到内存,然后我看完关了,内存先存到cache中不清除,这样我下次打开就快了。所以两次打开的速度是不同的,其实就是缓存

Buffer就是我在word上写了很多,不会时刻都保存到硬盘上,会先到缓存放一会等到数量多才存硬盘。

 

 

代替计算器

[root@localhost ~]# echo $[1+2]

3

 

已经使用的内存663312,分了一部分出去20+103812,真正在使用的是559480,所以内存使用率是559480/1003432

而340120的意思是还可以分配到buffers和cached的内存大小,340120+20+103812=443952

 

 

posted @ 2017-11-10 16:51  森森2017  阅读(167)  评论(0编辑  收藏  举报