搜索工具 which :用于查找可执行文件的绝对路径;node
[root@linux-128 ~]# which ls alias ls='ls --color=auto' /usr/bin/ls
whereis:经过预先生成的一个文件列表库查找与给出的文件名相关的文件; 格式: whereis [选项] 文件名 -b:只查找二进制文件; -m:只查找帮助文件; -s:只查找源代码文件;linux
[root@linux-128 ~]# whereis -b ls ls: /usr/bin/ls [root@linux-128 ~]# whereis ls ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz
locate:和whereis相似,也是经过查找预先生成的文件列表库来查找文件在哪里,后面直接跟文件名;须要安装mlocate软件包:shell
[root@linux-128 ~]# yum install -y mlocate [root@linux-128 ~]# updatedb [root@linux-128 ~]# locate yum.log /var/log/yum.log
安装好后,第一次运行locate会报错,须要运行updatedb命令当即生成或者更新这个库文件;默认状况下这个库每周更新一次;locate不适合精准查找。windows
find命令bash
- -1 小于1天;1天之内
- +1 大于1天;1天之前
- 不能等于1
例子:less
[root@linux-128 ~]# find /etc/ -type f -mtime -1 -name "*.conf" /etc/resolv.conf
[root@linux-128 ~]# find /root/ -type f -mtime -1 /root/.bash_history /root/321.txt
[root@linux-128 ~]# find /root/ -type f -mmin -10 /root/11.txt
[root@linux-128 ~]# find /root/ -type f -mmin -10 -exec ls -l {} \; -rw-r--r-- 1 root root 0 10月 27 22:03 /root/11.txt
小知识:{}表示前面列出来的文件,\脱意符号,;换行符ssh
[root@linux-128 ~]# find /root/ -type f -mtime -1 -exec cp {} {}.bak \; [root@linux-128 ~]# ls -al /root/ 总用量 84 dr-xr-x---. 4 root root 288 10月 27 22:13 . dr-xr-xr-x. 17 root root 265 10月 19 15:07 .. -rw-r--r-- 1 root root 0 10月 27 22:03 11.txt -rw-r--r-- 1 root root 0 10月 27 22:13 11.txt.bak lrwxrwxrwx 1 root root 9 10月 27 01:12 12 -> /tmp/111/ drwxr-xr-x 2 root root 6 10月 27 22:03 123 -rw-------. 2 root root 0 10月 17 03:40 1.log -rw-r--r-- 1 root root 16816 10月 27 01:31 321.txt -rw-r--r-- 1 root root 16816 10月 27 22:13 321.txt.bak -rw-------. 1 root root 1422 10月 17 03:51 anaconda-ks.cfg -rw-------. 1 root root 6339 10月 27 01:40 .bash_history -rw------- 1 root root 6339 10月 27 22:13 .bash_history.bak -rw-r--r--. 1 root root 18 12月 29 2013 .bash_logout -rw-r--r--. 1 root root 176 12月 29 2013 .bash_profile -rw-r--r--. 1 root root 176 12月 29 2013 .bashrc -rw-r--r--. 1 root root 100 12月 29 2013 .cshrc -rw------- 1 root root 41 10月 25 00:48 .lesshst drwx------. 2 root root 80 10月 19 17:04 .ssh -rw-r--r--. 1 root root 129 12月 29 2013 .tcshrc
[root@linux-128 ~]# find /root/ -type f -size -6k -exec ls -lh {} \; -rw-r--r--. 1 root root 18 12月 29 2013 /root/.bash_logout -rw-r--r--. 1 root root 176 12月 29 2013 /root/.bash_profile -rw-r--r--. 1 root root 176 12月 29 2013 /root/.bashrc -rw-r--r--. 1 root root 100 12月 29 2013 /root/.cshrc -rw-r--r--. 1 root root 129 12月 29 2013 /root/.tcshrc -rw-------. 1 root root 1.4K 10月 17 03:51 /root/anaconda-ks.cfg -rw-r--r--. 1 root root 806 10月 18 19:41 /root/.ssh/authorized_keys -rw-r--r-- 1 root root 176 10月 19 16:24 /root/.ssh/known_hosts -rw------- 1 root root 1.7K 10月 19 17:04 /root/.ssh/id_rsa -rw-r--r-- 1 root root 396 10月 19 17:04 /root/.ssh/id_rsa.pub -rw------- 1 root root 41 10月 25 00:48 /root/.lesshst -rw-------. 2 root root 0 10月 17 03:40 /root/1.log -rw-r--r-- 1 root root 0 10月 27 22:03 /root/11.txt -rw-r--r-- 1 root root 0 10月 27 22:13 /root/11.txt.bak
[root@linux-128 ~]# ls -i 1.log 8388681 1.log [root@linux-128 ~]# find -inum 8388681 ./1.log [root@linux-128 ~]# find / -inum 8388681 /root/1.log /tmp/yum.log
stat命令能够列出文件的atime,mtime,ctime;工具
[root@linux-128 ~]# stat 11.txt 文件:"11.txt" 大小:0 块:0 IO 块:4096 普通空文件 设备:803h/2051d Inode:16799023 硬连接:1 权限:(0644/-rw-r--r--) Uid:( 0/ root) Gid:( 0/ root) 最近访问:2017-10-27 22:13:47.084544630 +0800 //atime 最近更改:2017-10-27 22:03:41.825691647 +0800 //mtime 最近改动:2017-10-27 22:03:41.825691647 +0800 //ctime 建立时间:-
linux文件后缀名 在linux系统中,文件的后缀名没有具体的意义,加或者不加都无所谓。code
工具:xshell securecet
安装lrzsz包软件
yum install -y lrzsz 命令:sz 文件名 linux上传到windows rz 直接回车,windows上传文件到linux,传到当前目录中