linux的find命令查找不到,Linux中的查找命令find、which、whereis

which

[root@lynn-05 ~]# which ls

alias ls='ls --color=auto'

/usr/bin/ls

[root@lynn-05 ~]# echo $PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/tmp/:/root/bin

whereis

[root@lynn-05 ~]# whereis ls

ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz

find

find 路径 -name "文件名"     指定路径下查找指定名称的文件

[root@lynn-05 ~]# find /etc/ -name "sshd_config"

/etc/ssh/sshd_config

[root@lynn-05 ~]# find /etc/ -name "sshd*"

/etc/ssh/sshd_config

/etc/systemd/system/multi-user.target.wants/sshd.service

/etc/sysconfig/sshd

/etc/pam.d/sshd

find 路径  -type  文件类型        指定路径下查找指定类型的文件

f 普通文件

b 目录

c 字符设备

l 链接

d 块设备

find 路径  -type  文件类型  -name "文件名"     指定路径下查找指定类型和名称的文件

[root@lynn-05 ~]# find /etc/ -type f -name "sshd*"

/etc/ssh/sshd_config

/etc/sysconfig/sshd

/etc/pam.d/sshd

atime  mtime  ctime

[root@lynn-05 ~]# stat 2.txt

File: '2.txt'

Size: 0               Blocks: 0          IO Block: 4096   regular empty file

Device: 803h/2051d      Inode: 33583016    Links: 1

Access: (0664/-rw-rw-r--)  Uid: ( 1001/   user1)   Gid: ( 1001/   user1)

Context: unconfined_u:object_r:admin_home_t:s0

Access: 2017-12-20 21:15:35.744733887 +0800

Modify: 2017-12-20 21:15:35.744733887 +0800

Change: 2017-12-20 21:15:35.744733887 +0800

Birth: -

[root@lynn-05 ~]# chmod 700 2.txt

[root@lynn-05 ~]# stat 2.txt

File: '2.txt'

Size: 0               Blocks: 0          IO Block: 4096   regular empty file

Device: 803h/2051d      Inode: 33583016    Links: 1

Access: (0700/-rwx------)  Uid: ( 1001/   user1)   Gid: ( 1001/   user1)

Context: unconfined_u:object_r:admin_home_t:s0

Access: 2017-12-20 21:15:35.744733887 +0800

Modify: 2017-12-20 21:15:35.744733887 +0800

Change: 2017-12-22 14:37:10.255541969 +0800

Birth: -

[root@lynn-05 ~]# echo "121212" >> 2.txt

[root@lynn-05 ~]# stat 2.txt

File: '2.txt'

Size: 7               Blocks: 8          IO Block: 4096   regular file

Device: 803h/2051d      Inode: 33583016    Links: 1

Access: (0700/-rwx------)  Uid: ( 1001/   user1)   Gid: ( 1001/   user1)

Context: unconfined_u:object_r:admin_home_t:s0

Access: 2017-12-20 21:15:35.744733887 +0800

Modify: 2017-12-22 14:38:50.562586007 +0800

Change: 2017-12-22 14:38:50.562586007 +0800

Birth: -

[root@lynn-05 ~]# cat 2.txt

121212

[root@lynn-05 ~]# stat 2.txt

File: '2.txt'

Size: 7               Blocks: 8          IO Block: 4096   regular file

Device: 803h/2051d      Inode: 33583016    Links: 1

Access: (0700/-rwx------)  Uid: ( 1001/   user1)   Gid: ( 1001/   user1)

Context: unconfined_u:object_r:admin_home_t:s0

Access: 2017-12-22 14:40:21.342530884 +0800

Modify: 2017-12-22 14:38:50.562586007 +0800

Change: 2017-12-22 14:38:50.562586007 +0800

Birth: -

find /etc/ -type f -mtime -1              查看一天以内更改过的文件  【-1一天以内 +1一天以外】

[root@lynn-05 ~]# find /etc/ -type f -mtime -1

/etc/resolv.conf

/etc/tuned/active_profile

/etc/7.txt

find /etc/ -type f -mtime -1 -o -name 文件名   【-o表示或者】

find / -inum 33583016

[root@lynn-05 ~]# ln 2.txt /tmp/88.txt

[root@lynn-05 ~]# ls -i 2.txt

33583016 2.txt

[root@lynn-05 ~]# find / -inum 33583016

/root/2.txt

/tmp/88.txt

find /root/  -type f  -mmin -6    【单位为分钟】

[root@lynn-05 ~]# find /root/ -type f -mmin -6

/root/6.txt

/root/8.txt

/root/16.txt

find /root/  -type f -mmin -6 -exec ls -l  {} \;

[root@lynn-05 ~]# find /root/ -type f -mmin -6 -exec ls -l {} \;

-rw-r--r--. 1 root root 0 Dec 22 15:10 /root/6.txt

-rw-r--r--. 1 root root 0 Dec 22 15:10 /root/8.txt

-rw-r--r--. 1 root root 0 Dec 22 15:10 /root/16.txt

find /root/ -type f -mmin -6 -exec mv {} {}.doc  \;

[root@lynn-05 ~]# find /root/ -type f -mmin -6 -exec mv {} {}.doc \;

[root@lynn-05 ~]# find /root/ -type f -mmin -6

/root/6.txt.doc

/root/8.txt.doc

/root/16.txt.doc

find /root/ -size +10k   查找大于10k的文件

[root@lynn-05 ~]# find /root/ -size +10k

/root/6.txt.doc

/root/8.txt.doc

/root/16.txt.doc

[root@lynn-05 ~]# find /root/ -size +10k -exec ls -lh {} \;

-rw-r--r--. 1 root root 13K Dec 22 15:23 /root/6.txt.doc

-rw-r--r--. 1 root root 20K Dec 22 15:24 /root/8.txt.doc

-rw-r--r--. 1 root root 29K Dec 22 15:24 /root/16.txt.doc

find /root/  -type f  -size -1M  查找小于1M的文件

[root@lynn-05 ~]# find /root/ -type f -size -1M

/root/1/2.txt

/root/666/2.txt

[root@lynn-05 ~]# find /root/ -type f -size -1M -exec ls -lh {} \;

-rw-r--r--. 1 root root 0 Dec 20 21:31 /root/1/2.txt

-rw-r--r--. 1 root user1 0 Dec 21 21:44 /root/666/2.txt

文件后缀

Linux的文件后缀

*.php ------用php语言解释器进行解释,能用浏览器打开的文件;

*.so -------库文件;

*.doc  *.obt --------这是OpenOffice 能打开的文件;

.bz2 ------bzip2的压缩文件

.gz ------gzip的压缩文件

.tar ------tar打包文件(是包文件不是压缩文件)

.tbz------tar打包并用bzip压缩文件

.tgz-----tar打包并用gzip压缩的文件

.au -----audio文件

.gif -----gif图象文件

.html/.htm-----HTML文件

.jpg-----JPEG图象文件

.pdf------电子文档(PDF格式的)

.png-----PNG图象文件

.ps------postscinpt文件(打印格式文件)

.txt------纯文本文件

.wav-----audio文件

.xpm-----图象文件

.conf-------配置文件

.lock-------LOCK文件(用来判断一个文件或设备是否被使用)

.rpm------REDHATPackage.Manager文件(套件包或软件包)

.c -------C源程序代码文件

.cpp------C++源程序代码文件

.h -------C或C++程序的头文件

.o------程序目标文件

.pl------perl脚本文件

.so-----类库文件

由于Linux文件后缀名的不严谨所以即使是以上的后缀名的文件也不一定就是对应类型的文件

为了方便大家我们应该按照以上相应的后缀来给文件定义后缀名

Linux与Windows的文件互传

要通过终端Linux与Windows文件互传要安装一个lrzsz这个包  【支持xshell、securecrt 不支持putty】

[root@lynn-05 ~]# yum install -y lrzsz

sz filename   从Linux把文件传输到Windows

f6742cb4a54a30b508d209734b19cd9e.png

6b0de920b72ac78653d18c4a02296a43.png

rz   从Windows传文件到linux

3dc538ad2791540aececed26c0e0f070.png

1aa81e790fd904354bd57ab75115da60.png

33ed4094c0da45a9eae783d0789763b3.png

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值