Day09-Linux文件类型及查找文件精讲

2024-02-19 02:20

本文主要是介绍Day09-Linux文件类型及查找文件精讲,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

Day09-Linux文件类型及查找文件精讲

  • 1. Linux文件类型
  • 2. wc 查看行数,字符数等
  • 3. find 查找

属性:

人:性别、身高、体重、年龄

文件:大小、用户 组 权限 创建时间

[root@oldboy ~]# stat ab.txtFile: ‘ab.txt’Size: 184             Blocks: 8          IO Block: 4096   regular file
Device: fd00h/64768d    Inode: 33729481    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Context: unconfined_u:object_r:admin_home_t:s0
Access: 2023-12-15 11:32:37.460161262 +0800
Modify: 2023-12-15 11:32:27.436160735 +0800
Change: 2023-12-15 11:32:27.436160735 +0800

最近访问:2021-05-12 12:13:30 access 访问,浏览,针对内容

最近更改:2021-05-10 10:31:31 modify 最后更改时间,针对内容

最近改动:2021-05-10 10:31:31 change 状态改变,属性改变

查看文件属性:

[root@oldboy ~]# ls -li
总用量 32
33583628 -rw-r--r--. 1 root root 184 512 11:56 oldboy.txt

第1列,索引节点,形态是数字

第2列,首字符代表文件类型
​ 中间9个字符,文件权限
​ . 和selinux(高级安全组件)相关符号

第3列,硬链接数

第4列,用户

第5列,用户组

第6列,文件大小(目录不是)

第7-9列,日期时间

第10列,文件名

1. Linux文件类型

windows文件类型,根据扩展名来的。

.doc word文档

.mp4 .avi 视频

.ppt .md .txt

Linux下面不根据扩展名确定类型,但是依然会有扩展名,为了给人看。一眼看清楚。

系统不识别扩展名,

那么系统怎么确定文件类型呢?

ls -li 第2列,首字符代表文件类型

一切皆文件。

- 普通文件 .doc word文档 .mp4  .avi 视频.ppt .md .txt 
d 目录 directory
l 软链接文件 link
c 字符设备
b 块设备
s socket文件

- 普通文件 显示为白色

d 目录 directory 显示为浅蓝色

l 软链接文件 link 快捷方式

[root@oldboy ~]# ls  -l /bin
lrwxrwxrwx. 1 root root 7 57 09:21 /bin -> usr/bin

Linux下创建快捷方式

[root@oldboy ~]# ln -s /etc/hosts  /tmp/a.hosts
[root@oldboy ~]# cat /tmp/a.hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.0.0.129  oldboy

c 字符设备

[root@oldboy ~]# ls -l /dev/
total 0
crw-rw----. 1 root video    10, 175 Dec 14 09:23 agpgart
crw-------. 1 root root     10, 235 Dec 14 09:23 autofs
drwxr-xr-x. 2 root root         160 Dec 14 09:23 block
drwxr-xr-x. 2 root root          80 Dec 14 09:23 bsg
crw-------. 1 root root     10, 234 Dec 14 09:23 btrfs-control
lrwxrwxrwx. 1 root root           3 Dec 14 09:23 cdrom -> sr0
drwxr-xr-x. 2 root root          80 Dec 14 09:23 centos
drwxr-xr-x. 2 root root        2780 Dec 14 09:23 char
crw-------. 1 root root      5,   1 Dec 14 09:23 console
lrwxrwxrwx. 1 root root          11 Dec 14 09:23 core -> /proc/kcore
drwxr-xr-x. 6 root root         120 Dec 14 09:23 cpu
crw-------. 1 root root     10,  61 Dec 14 09:23 cpu_dma_latency
crw-------. 1 root root     10,  62 Dec 14 09:23 crash
drwxr-xr-x. 6 root root         120 Dec 14 09:23 disk
brw-rw----. 1 root disk    253,   0 Dec 14 09:23 dm-0
brw-rw----. 1 root disk    253,   1 Dec 14 09:23 dm-1
drwxr-xr-x. 2 root root          80 Dec 14 09:23 dri
crw-rw----. 1 root video    29,   0 Dec 14 09:23 fb0
lrwxrwxrwx. 1 root root          13 Dec 14 09:23 fd -> /proc/self/fd
crw-rw-rw-. 1 root root      1,   7 Dec 14 09:23 full
crw-rw-rw-. 1 root root     10, 229 Dec 14 09:23 fuse
......

b 块设备

[root@oldboy ~]# ls -l /dev/sd*
brw-rw----. 1 root disk 8, 0 510 20:11 /dev/sda
brw-rw----. 1 root disk 8, 1 510 20:11 /dev/sda1
brw-rw----. 1 root disk 8, 2 510 20:11 /dev/sda2

s socket文件,进程通信才会用到

[root@oldboy ~]# find / -type s
/dev/log
/run/vmware/guestServicePipe
/run/abrt/abrt.socket
/run/dbus/system_bus_socket
......[root@oldboy ~]# ls -l /dev/log
srw-rw-rw-. 1 root root 0 510 20:11 /dev/log

查看文件类型:file

[root@oldboy ~]# file /etc/hosts
/etc/hosts: ASCII text
[root@oldboy ~]# file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=aaf05615b6c91d3cbb076af81aeff531c5d7dfd9, stripped
[root@oldboy ~]# file /var/log/wtmp 
/var/log/wtmp: data

2. wc 查看行数,字符数等

-l 查看行数

-L 查看字符数

实践:

[root@oldboy ~]# wc -l /etc/hosts
5 /etc/hosts[root@oldboy ~]# echo oldboy|wc -L
6

查找命令:

1)which 查看二进制命令所在路径(从PATH环境变量路径里查找)

[root@oldboy ~]# which ls
alias ls='ls --color=auto'/usr/bin/ls
[root@oldboy ~]# which cp
alias cp='cp -i'/usr/bin/cp

特殊注意:

[root@oldboy ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
  • 分隔符为冒号:
  • 路径都是命令。

2)whereis 查看文件及文件的帮助等的路径

-b 查看二进制命令所在路径 which

[root@oldboy ~]# whereis -b ls
ls: /usr/bin/ls
[root@oldboy ~]# whereis ls
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz

3)locate 查找文件及相关内容(内置数据库,通过updatedb)(不需要了解)

yum install mlocate -y 
locate

3. find 查找

-name 按名字查找

find 路径 选项1 【参数1】 选项2 【参数2】

1)按名字查找:

[root@oldboy ~]# find / -name "hosts"
/etc/hosts
/tmp/hosts
/tmp/etc/hosts
/home/oldboy/hosts
/opt/etc/hosts

按名字模糊查找 *表示所有

[root@oldboy ~]# find / -name "ho*ts"

2)按类型查找

-type

f d l c b s

去哪看? man find 搜 /-type

  -type cFile is of type c:b      block (buffered) specialc      character (unbuffered) speciald      directoryf      regular filel      symbolic link;s      socket

查找目录

[root@oldboy ~]# find /root -type d 
/root
/root/oldboy_dir
/root/oldboy_dir/abc
/root/oldboy_dir/abc/def

查找文件

[root@oldboy ~]# find /root -type f
/root/.bash_logout
/root/.bash_profile

组合查找:find 默认就是取交集(-a)and,并集(-o)or

找女朋友:【高点】 [身材好点] 该有的要有,同时满足:交集
找男朋友:高的,帅的,有钱的
​ 热爱运动,特长多,热爱生活,渴望爱情,追求精神层次,经济基础,
​ 有才华(写诗、乐器),这样的男生,有没有女生喜欢?

例:查文件类型为文件,并且名字为hosts

find / -name "hosts" -a -type f
[root@oldboy ~]# find / -name "hosts" -a -type f
/etc/hosts
/tmp/hosts
/tmp/etc/hosts
/home/oldboy/hosts
/opt/etc/hosts
[root@oldboy ~]# find / -name "hosts" -type f
/etc/hosts
/tmp/hosts
/tmp/etc/hosts
/home/oldboy/hosts

并集:查找名为hosts,或者类型为d

[root@oldboy ~]# find / -name "hosts" -o -type d -name "oldboy"
/etc/hosts
/tmp/hosts
/tmp/etc/hosts
/home/oldboy
/home/oldboy/hosts
/opt/etc/hosts

取反:! 查找名字不是file1

[root@oldboy ~]# mkdir /data -p
[root@oldboy ~]# touch /data/file{1..3}
[root@oldboy ~]# find /data -name "file1"
/data/file1
[root@oldboy ~]# find /data ! -name "file1"
/data
/data/file2
/data/file3

3)按大小查找

-size +1M #大于1M

-size 1M #1M

-size -1M #小于1M

其他单位k G

测试1

[root@oldboy ~]# cd /data
[root@oldboy data]# rz -E
rz waiting to receive.
[root@oldboy data]# ls
file1  file2  file3  老男孩Linux58期开班典礼3_-.pptx
[root@oldboy data]# find ./ -size +10M
./老男孩Linux58期开班典礼3_-.pptx
[root@oldboy data]# 
[root@oldboy data]# find ./ -size -10M
./
./file1
./file2
./file3
[root@oldboy data]# find ./ -size -10k
./
./file1
./file2
./file3
[root@oldboy data]# find ./ -size -10G
./
./file1
./file2
./file3
./老男孩Linux58期开班典礼3_-.pptx
[root@oldboy data]# find ./ -size +10G

4)-mtime 按修改时间查找*********

-atime 按【访问】时间查找

-ctime 按【改变】时间查找

-mtime +7 #7天以前的

-mtime 7 #第7天

-mtime -7 #最近7天

测试:复制即可。模拟每天创建一个文件,连续30天

mkdir -p /data
for n in {01..30};do date -s "2030/05/0$n";touch /data/file$n;done

.和./都表示当前目录

…和…/都表示上级目录

[root@oldboy data]# for n in {01..30};do date -s "2030/05/0$n";touch /data/file$n;done
Wed May  1 00:00:00 CST 2030
Thu May  2 00:00:00 CST 2030
Fri May  3 00:00:00 CST 2030
Sat May  4 00:00:00 CST 2030
Sun May  5 00:00:00 CST 2030
Mon May  6 00:00:00 CST 2030
Tue May  7 00:00:00 CST 2030
Wed May  8 00:00:00 CST 2030
Thu May  9 00:00:00 CST 2030
Fri May 10 00:00:00 CST 2030
Sat May 11 00:00:00 CST 2030
Sun May 12 00:00:00 CST 2030
Mon May 13 00:00:00 CST 2030
Tue May 14 00:00:00 CST 2030
Wed May 15 00:00:00 CST 2030
Thu May 16 00:00:00 CST 2030
Fri May 17 00:00:00 CST 2030
Sat May 18 00:00:00 CST 2030
Sun May 19 00:00:00 CST 2030
Mon May 20 00:00:00 CST 2030
Tue May 21 00:00:00 CST 2030
Wed May 22 00:00:00 CST 2030
Thu May 23 00:00:00 CST 2030
Fri May 24 00:00:00 CST 2030
Sat May 25 00:00:00 CST 2030
Sun May 26 00:00:00 CST 2030
Mon May 27 00:00:00 CST 2030
Tue May 28 00:00:00 CST 2030
Wed May 29 00:00:00 CST 2030
Thu May 30 00:00:00 CST 2030
[root@oldboy data]# ls -l
total 0
-rw-r--r--. 1 root root 0 May  1 00:00 file01
-rw-r--r--. 1 root root 0 May  2 00:00 file02
-rw-r--r--. 1 root root 0 May  3 00:00 file03
-rw-r--r--. 1 root root 0 May  4 00:00 file04
-rw-r--r--. 1 root root 0 May  5 00:00 file05
-rw-r--r--. 1 root root 0 May  6 00:00 file06
-rw-r--r--. 1 root root 0 May  7 00:00 file07
-rw-r--r--. 1 root root 0 May  8 00:00 file08
-rw-r--r--. 1 root root 0 May  9 00:00 file09
-rw-r--r--. 1 root root 0 May 10 00:00 file10
-rw-r--r--. 1 root root 0 May 11 00:00 file11
-rw-r--r--. 1 root root 0 May 12 00:00 file12
-rw-r--r--. 1 root root 0 May 13 00:00 file13
-rw-r--r--. 1 root root 0 May 14 00:00 file14
-rw-r--r--. 1 root root 0 May 15 00:00 file15
-rw-r--r--. 1 root root 0 May 16 00:00 file16
-rw-r--r--. 1 root root 0 May 17 00:00 file17
-rw-r--r--. 1 root root 0 May 18 00:00 file18
-rw-r--r--. 1 root root 0 May 19 00:00 file19
-rw-r--r--. 1 root root 0 May 20 00:00 file20
-rw-r--r--. 1 root root 0 May 21 00:00 file21
-rw-r--r--. 1 root root 0 May 22 00:00 file22
-rw-r--r--. 1 root root 0 May 23 00:00 file23
-rw-r--r--. 1 root root 0 May 24 00:00 file24
-rw-r--r--. 1 root root 0 May 25 00:00 file25
-rw-r--r--. 1 root root 0 May 26 00:00 file26
-rw-r--r--. 1 root root 0 May 27 00:00 file27
-rw-r--r--. 1 root root 0 May 28 00:00 file28
-rw-r--r--. 1 root root 0 May 29 00:00 file29
-rw-r--r--. 1 root root 0 May 30 00:00 file30[root@oldboy data]# find ./ -mtime -7
./
./file24
./file25
./file26
./file27
./file28
./file29
./file30
[root@oldboy data]# find ./ -mtime 7
./file23
[root@oldboy data]# find ./ -mtime +7
./file01
./file02
./file03
./file04
./file05
./file06
./file07
./file08
./file09
./file10
./file11
./file12
./file13
./file14
./file15
./file16
./file17
./file18
./file19
./file20
./file21
./file22
[root@oldboy data]# find ./ -mtime +7|sort -n -t"e" -k2
./file01
./file02
./file03
./file04
./file05
./file06
./file07
./file08
./file09
./file10
./file11
./file12
./file13
./file14
./file15
./file16
./file17
./file18
./file19
./file20
./file21
./file22

不重要的

-perm 按权限查找

[root@oldboy data]# find /data/ -perm 755
/data/

-user 按用户查找

[root@oldboy data]# touch oldboy.txt
[root@oldboy data]# chown oldboy oldboy.txt
[root@oldboy data]# find /data/ -user oldboy
/data/oldboy.txt

要想成功,永远比别人多做一点点,早做一点点,做好一点点。————老男孩

【对找到的东西,进行处理】

方法一:

-exec 执行动作

find /data/ -name "file*" -mtime +7 -exec rm -f {} \;

原理:

rm -f file01
rm -f file02
rm -f file03
......
[root@oldboy data]# find /data/ -name "file*" -mtime +7
/data/file01
/data/file02
/data/file03
/data/file04
/data/file05
/data/file06
/data/file07
/data/file08
/data/file09
/data/file10
/data/file11
/data/file12
/data/file13
/data/file14
/data/file15
/data/file16
/data/file17
/data/file18
/data/file19
/data/file20
/data/file21
/data/file22
[root@oldboy data]# find /data/ -name "file*" -mtime +7|sort -r
/data/file22
/data/file21
/data/file20
/data/file19
/data/file18
/data/file17
/data/file16
/data/file15
/data/file14
/data/file13
/data/file12
/data/file11
/data/file10
/data/file09
/data/file08
/data/file07
/data/file06
/data/file05
/data/file04
/data/file03
/data/file02
/data/file01
[root@oldboy data]# find /data/ -name "file*" -mtime +7 -exec rm -f {} \;
[root@oldboy data]# find /data/ -name "file*" -mtime +7
[root@oldboy data]# find /data/ -name "file*" -mtime 7
/data/file23
[root@oldboy data]# find /data/ -name "file*" -mtime 7 -exec rm -f {} \;
[root@oldboy data]# find /data/ -name "file*" -mtime 7
[root@oldboy data]# find /data/ -name "file*" -mtime -7
/data/file24
/data/file25
/data/file26
/data/file27
/data/file28
/data/file29
/data/file30
[root@oldboy data]# find /data/ -name "file*" -mtime -7 -exec rm -f {} \;
[root@oldboy data]# find /data/ -name "file*" -mtime -7
[root@oldboy data]#

方法二:

命令行:

$(命令)或`命令`,拼路径拼命令

[root@oldboy data]# !for
for n in {01..30};do date -s "2030/05/0$n";touch /data/file$n;done
Wed May  1 00:00:00 CST 2030
Thu May  2 00:00:00 CST 2030
Fri May  3 00:00:00 CST 2030
Sat May  4 00:00:00 CST 2030
Sun May  5 00:00:00 CST 2030
Mon May  6 00:00:00 CST 2030
Tue May  7 00:00:00 CST 2030
Wed May  8 00:00:00 CST 2030
Thu May  9 00:00:00 CST 2030
Fri May 10 00:00:00 CST 2030
Sat May 11 00:00:00 CST 2030
Sun May 12 00:00:00 CST 2030
Mon May 13 00:00:00 CST 2030
Tue May 14 00:00:00 CST 2030
Wed May 15 00:00:00 CST 2030
Thu May 16 00:00:00 CST 2030
Fri May 17 00:00:00 CST 2030
Sat May 18 00:00:00 CST 2030
Sun May 19 00:00:00 CST 2030
Mon May 20 00:00:00 CST 2030
Tue May 21 00:00:00 CST 2030
Wed May 22 00:00:00 CST 2030
Thu May 23 00:00:00 CST 2030
Fri May 24 00:00:00 CST 2030
Sat May 25 00:00:00 CST 2030
Sun May 26 00:00:00 CST 2030
Mon May 27 00:00:00 CST 2030
Tue May 28 00:00:00 CST 2030
Wed May 29 00:00:00 CST 2030
Thu May 30 00:00:00 CST 2030
[root@oldboy data]# ls
file01  file04  file07  file10  file13  file16  file19  file22  file25  file28  oldboy.txt
file02  file05  file08  file11  file14  file17  file20  file23  file26  file29
file03  file06  file09  file12  file15  file18  file21  file24  file27  file30
[root@oldboy data]# rm -f $(find /data/ -name "file*" -type f -mtime +7)
[root@oldboy data]# rm -f `find /data/ -name "file*" -type f -mtime -7`
[root@oldboy data]# ls
file23  oldboy.txt

方法三:xargs

-n 分组

[root@oldboy data]# seq 10 >oldboy.txt
[root@oldboy data]# xargs -n 3 <oldboy.txt
1 2 3
4 5 6
7 8 9
10

-i 可以让后面的{ }接受搜索到的内容

find /data/ -name "file*" -mtime -7|xargs -i rm -f {}find /data/ -name "file*" -mtime +7|xargs rm -f  #简写

原理:

rm -f file01 file02 file03....

效率更高

[root@oldboy data]# find /data/ -name "file*" -mtime -7
/data/file24
/data/file25
/data/file26
/data/file27
/data/file28
/data/file29
/data/file30
[root@oldboy data]# find /data/ -name "file*" -mtime -7|xargs -i rm -f {}
[root@oldboy data]# find /data/ -name "file*" -mtime -7
[root@oldboy data]#
[root@oldboy data]# find /data/ -name "file*" -mtime +7
/data/file01
/data/file02
/data/file03
/data/file04
/data/file05
/data/file06
/data/file07
/data/file08
/data/file09
/data/file10
/data/file11
/data/file12
/data/file13
/data/file14
/data/file15
/data/file16
/data/file17
/data/file18
/data/file19
/data/file20
/data/file21
/data/file22
[root@oldboy data]# find /data/ -name "file*" -mtime +7|xargs rm -f
[root@oldboy data]# find /data/ -name "file*" -mtime +7
[root@oldboy data]#

查找/data大于20K,修改时间为7天以内的文件,复制到/opt

cp 源 目标

cp -t 目标 源

[root@oldboy data]# cp /etc/services .
[root@oldboy data]# ll
total 660
-rw-r--r--. 1 root   root      0 May 23 00:00 file23
-rw-r--r--. 1 oldboy root     21 May 30 00:05 oldboy.txt
-rw-r--r--. 1 root   root 670293 May 30 00:30 services
[root@oldboy data]# find /data/ -size +20k -mtime -7|xargs -i cp {} /opt
[root@oldboy data]# ls /opt/
services[root@oldboy data]# find /data/ -size +20k -mtime -7|xargs cp -t /tmp
[root@oldboy data]# ls /tmp/
services

这篇关于Day09-Linux文件类型及查找文件精讲的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/723220

相关文章

linux ssh如何实现增加访问端口

《linuxssh如何实现增加访问端口》Linux中SSH默认使用22端口,为了增强安全性或满足特定需求,可以通过修改SSH配置来增加或更改SSH访问端口,具体步骤包括修改SSH配置文件、增加或修改... 目录1. 修改 SSH 配置文件2. 增加或修改端口3. 保存并退出编辑器4. 更新防火墙规则使用uf

Linux join命令的使用及说明

《Linuxjoin命令的使用及说明》`join`命令用于在Linux中按字段将两个文件进行连接,类似于SQL的JOIN,它需要两个文件按用于匹配的字段排序,并且第一个文件的换行符必须是LF,`jo... 目录一. 基本语法二. 数据准备三. 指定文件的连接key四.-a输出指定文件的所有行五.-o指定输出

Linux jq命令的使用解读

《Linuxjq命令的使用解读》jq是一个强大的命令行工具,用于处理JSON数据,它可以用来查看、过滤、修改、格式化JSON数据,通过使用各种选项和过滤器,可以实现复杂的JSON处理任务... 目录一. 简介二. 选项2.1.2.2-c2.3-r2.4-R三. 字段提取3.1 普通字段3.2 数组字段四.

Linux kill正在执行的后台任务 kill进程组使用详解

《Linuxkill正在执行的后台任务kill进程组使用详解》文章介绍了两个脚本的功能和区别,以及执行这些脚本时遇到的进程管理问题,通过查看进程树、使用`kill`命令和`lsof`命令,分析了子... 目录零. 用到的命令一. 待执行的脚本二. 执行含子进程的脚本,并kill2.1 进程查看2.2 遇到的

Linux云服务器手动配置DNS的方法步骤

《Linux云服务器手动配置DNS的方法步骤》在Linux云服务器上手动配置DNS(域名系统)是确保服务器能够正常解析域名的重要步骤,以下是详细的配置方法,包括系统文件的修改和常见问题的解决方案,需要... 目录1. 为什么需要手动配置 DNS?2. 手动配置 DNS 的方法方法 1:修改 /etc/res

Linux创建服务使用systemctl管理详解

《Linux创建服务使用systemctl管理详解》文章指导在Linux中创建systemd服务,设置文件权限为所有者读写、其他只读,重新加载配置,启动服务并检查状态,确保服务正常运行,关键步骤包括权... 目录创建服务 /usr/lib/systemd/system/设置服务文件权限:所有者读写js,其他

Linux下利用select实现串口数据读取过程

《Linux下利用select实现串口数据读取过程》文章介绍Linux中使用select、poll或epoll实现串口数据读取,通过I/O多路复用机制在数据到达时触发读取,避免持续轮询,示例代码展示设... 目录示例代码(使用select实现)代码解释总结在 linux 系统里,我们可以借助 select、

Linux挂载linux/Windows共享目录实现方式

《Linux挂载linux/Windows共享目录实现方式》:本文主要介绍Linux挂载linux/Windows共享目录实现方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地... 目录文件共享协议linux环境作为服务端(NFS)在服务器端安装 NFS创建要共享的目录修改 NFS 配

linux系统中java的cacerts的优先级详解

《linux系统中java的cacerts的优先级详解》文章讲解了Java信任库(cacerts)的优先级与管理方式,指出JDK自带的cacerts默认优先级更高,系统级cacerts需手动同步或显式... 目录Java 默认使用哪个?如何检查当前使用的信任库?简要了解Java的信任库总结了解 Java 信

Linux命令rm如何删除名字以“-”开头的文件

《Linux命令rm如何删除名字以“-”开头的文件》Linux中,命令的解析机制非常灵活,它会根据命令的开头字符来判断是否需要执行命令选项,对于文件操作命令(如rm、ls等),系统默认会将命令开头的某... 目录先搞懂:为啥“-”开头的文件删不掉?两种超简单的删除方法(小白也能学会)方法1:用“--”分隔命