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
相关推荐
专注API从业者4 分钟前
Python/Java 代码示例:手把手教程调用 1688 API 获取商品详情实时数据
java·linux·数据库·python
Ribou37 分钟前
Ubuntu 24.04.2安装k8s 1.33.4 配置cilium
linux·ubuntu·kubernetes
tan180°1 小时前
Boost搜索引擎 网络库与前端(4)
linux·网络·c++·搜索引擎
小小菜鸡ing2 小时前
pymysql
java·服务器·数据库
Mr. Cao code2 小时前
Docker:颠覆传统虚拟化的轻量级革命
linux·运维·ubuntu·docker·容器
抓饼先生2 小时前
Linux control group笔记
linux·笔记·bash
挺6的还3 小时前
25.线程概念和控制(二)
linux
wanhengidc3 小时前
云手机运行流畅,秒开不卡顿
运维·网络·科技·游戏·智能手机
您的通讯录好友3 小时前
conda环境导出
linux·windows·conda
笨小孩@GF 知行合一4 小时前
OSPF实验:外部路由引入
运维·网络·hcip·数通·ospf