Linux找不到eyc,【CentOS 7笔记13】,find用法和文件传输#171025

hellopasswd

一. find

1. 跟find相似的命令

which ls #从环境变量$PATH中查找

whereis ls #在事前准备好的库中查找,但必须提前更新

locate

[root@localhost ~]# yum install -y mlocate

updatedb#手动更新

locate ls

find /etc/ -name "network-scripts"

find /etc/ -name "network*"

[root@localhost ~]# find /etc/ -type d -name "network*"#指定目录

[root@localhost ~]# find /etc/ -type f -name "network*"#目录或文件

[root@localhost ~]# find /bin/ -type l -name "system*"#软链接文件

[root@localhost ~]# find /dev/ -type b -name "tty*"#块设备文件

[root@localhost ~]# find /dev/ -type c -name "vcsa*"

[root@localhost ~]# stat 2.txt#查看文件的具体信息

mtime#最近更改信息Modify

ctime#Change

atime#Access

[root@localhost ~]# echo "123" >> 2.txt

[root@localhost ~]# start 2.txt

#Modify变化了

#Change变化了

[root@localhost ~]# cat 2.txt

[root@localhost ~]# stat 2.txt

#Access

[root@localhost ~]# find / -type f -mtime -1 #一天以内

[root@localhost ~]# find / -type f -mtime +1 #大于一天

[root@localhost ~]# find /etc/ -type f -mtime -1 -name "*.conf"#时间一天以内并且后缀为.conf的文件或目录

[root@localhost ~]# find /etc/ -type f -o -mtime -1 -o -name "*.conf"#-o或者,时间一天以内或者后缀为.conf的文件或目录

硬链接查找方式

[root@localhost ~]# find / -inum (inode号)

硬链接查找实验

[root@localhost ~]# ln /home/1.txt /tmp/2.txt

[root@localhost ~]# ls -i /home/1.txt

[root@localhost ~]# find / -inum (inode号)

[root@localhost ~]# find /root/ -type f -mmin -60 #60分钟,一个小时

[root@localhost ~]# find /root/ -type f -mmin -60 -exec ls -l {} \;

[root@localhost ~]# find /root/ -type f -mmin -60 -exec mv {}{}.bak \;

[root@localhost ~]# find /root/ -type f -mmin -60

[root@localhost ~]# find /root/ -size +10K #大于

[root@localhost ~]# find /root/ -size -10K #小于

[root@localhost ~]# find /root/ -type f -size -10K -exec ls -lh {} \;

[root@localhost ~]# find /root/ -type f -size +10M -exec ls -lh {} \;

二. 常见文件名后缀

*.php #php文件

*.so #库文件

*.bz2 #bzip2压缩文件

*.gz #gzip压缩文件

*.tar #tar打包文件

*.tbz #tar打包并用bzip压缩

*.tgz #tar打包并用gzip压缩

*.txt #纯文本

*.conf #配置文件

*.lock #用于判断一个文件或设备是否被使用

*.rpm #软件包

*.c #c语言源程序代码文件

*.cpp #c++源程序代码文件

*.h #c\c++程序头文件

*.o #程序目标文件

*.java #java源程序代码文件

*.class #java编译文件

*.py #python源程序代码文件

*.pl #perl脚本文件

三. 使用宿主机和虚拟机传输文件

使用xshell或者secure CRT

[root@localhost ~]# yum install -y lrzsz #安装包

[root@localhost ~]# sz file#linux传输到windows

[root@localhost ~]# rz#windows传输到linux

适用于SecureCRT和XShell

修改于171025

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值