Linux中的20个基本“ls”命令示例

LS command & how to use rmdir command

I) ls command

URL source : https://zhuanlan.zhihu.com/p/635083904

Linux中的20个基本"ls"命令示例

这里将介绍以下ls 命令参数。

选项 功能描述

ls -m 列出以逗号分隔的目录内容。

ls -Q 显示用引号括起来的目录内容。

ls -l 以长列表格式显示文件。

ls -lh 以人类可读的格式显示文件大小。

ls -g 省略组所有权列。

ls -F 向目录添加正斜杠。

ls -i 显示文件和目录的 inode 数量。

ls -a 显示所有文件,包括隐藏文件。

ls *. 根据文件扩展名过滤文件。
ls -la 以长列表格式显示所有文件和目录。

ls -R 递归显示文件和目录。

ls -r 反向排序文件。

ls -X 按文件扩展名的字母顺序对文件进行排序。

ls -tl 根据文件创建日期和时间显示文件。

ls -n 列出 UID 和 GID。

bash 复制代码
[root@iZ2vc5lqzt23aweti4j777Z ~]# ls -al
total 96
dr-xr-x---.  7 root root  4096 Dec 19 19:52 .
dr-xr-xr-x. 18 root root  4096 Dec 19 10:22 ..
-rw-------   1 root root  4230 Dec 19 19:37 .bash_history
-rw-r--r--.  1 root root    18 May 18  2020 .bash_logout
-rw-r--r--.  1 root root   176 May 18  2020 .bash_profile
-rw-r--r--.  1 root root   176 May 18  2020 .bashrc
drwx------   3 root root  4096 Oct 11 11:49 .config
-rw-r--r--.  1 root root   100 May 18  2020 .cshrc
drwxr-xr-x   3 root root  4096 Dec 19 11:52 folder_Dec19th202
drwxr-xr-x   2 root root  4096 Dec 19 19:52 folder_Dec19th2023
-rw-r--r--   1 root root 25548 Apr  7  2017 mysql57-community-release-el7-10.noarch.rpm
-rw-------   1 root root   162 Dec 19 16:51 .mysql_history
drwxr-xr-x   2 root root  4096 Oct 11 11:38 .pip
-rw-r--r--   1 root root   206 Dec 19 10:22 .pydistutils.cfg
drwx------   2 root root  4096 Oct 11 11:47 .ssh
-rw-r--r--.  1 root root   129 May 18  2020 .tcshrc
-rw-r--r--   1 root root   168 Dec 19 16:22 .wget-hsts

II) rmdir can not remove folder with entities (stuffed with files or folders)

bash 复制代码
[root@iZ2vc5lqzt23aweti4j777Z ~]# rmdir folder_Dec19th202
rmdir: failed to remove 'folder_Dec19th202': Directory not empty
相关推荐
熊思宇几秒前
ASP.NET Core Web API 发布到 IIS 服务器
服务器·microsoft·asp.net
搬砖的青蛙15 分钟前
本地web测试服务器快速域名映射工具
服务器·域名映射·ip映射
河藕Hou1 小时前
Linux - 磁盘/逻辑卷的分区&格式化&挂载
linux
半桔1 小时前
【网络编程】网络通信基石:从局域网到跨网段通信原理探秘
linux·运维·网络协议·php
叫我詹躲躲1 小时前
Linux 服务器磁盘满了?教你快速找到大文件,安全删掉不踩坑!
linux·前端·curl
sailwon1 小时前
自己搭建远程桌面服务器——私有化部署RustDesk
运维·服务器·云计算·远程工作
叫我詹躲躲1 小时前
3 分钟搞定 Linux 磁盘清理:实用命令 + 自动脚本,新手也会
linux·curl
Garc1 小时前
Zookeeper删除提供者服务中的指定IP节点
linux·运维·服务器
过往入尘土2 小时前
Linux:虚拟世界的大门
linux·人工智能
Wang's Blog2 小时前
Linux小课堂: Linux 系统的多面性与 CentOS 下载指南
linux·运维·centos