【shell】【10】文件处理

来源:互联网 发布:linux下源码安装mysql 编辑:程序博客网 时间:2024/06/06 10:01

1/  列出文件

echo /bin/*sh

ls /bin/*sh

2/  使用touch 更新修改时间

#creat a new file

touch file

#update time of file

touch file

3/ 寻找文件

locate file

locate '*file*'

4/ 寻找命令存储

#where is gcc?

type gcc

gcc is /usr/local/bin/gcc

type cd

cd is a shell builtin

5/ find指令

find -name 'file'

find

6/ 文件系统的空间信息

df -k

df -h

xiewen@ubuntu:~/shell/dir-test$ df -h文件系统        容量  已用  可用 已用% 挂载点/dev/loop0       19G  6.4G   12G   36% /udev            1.9G  4.0K  1.9G    1% /devtmpfs           385M  860K  384M    1% /runnone            5.0M     0  5.0M    0% /run/locknone            1.9G   18M  1.9G    1% /run/shm/dev/sda4       143G   22G  122G   15% /host/dev/sda6       196G  174G   22G   90% /media/本地磁盘/dev/sda5        77G   67G   11G   87% /media/本地磁盘_/dev/sda2        51G   47G  4.7G   91% /media/924C18204C180221/dev/sda1       100M   31M   70M   31% /media/系统保留

7/比较文件diff

#file one, two

xiewen@ubuntu:~/shell/dir-test$ cat oneaaaa  eeebbbb

xiewen@ubuntu:~/shell/dir-test$ cat twoaaaa  dddbbbbffff


xiewen@ubuntu:~/shell/dir-test$ diff one two1c1< aaaa  eee---> aaaa  ddd2a3> ffff










0 0
原创粉丝点击