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
相关推荐
人工智能训练2 小时前
【极速部署】Ubuntu24.04+CUDA13.0 玩转 VLLM 0.15.0:预编译 Wheel 包 GPU 版安装全攻略
运维·前端·人工智能·python·ai编程·cuda·vllm
微露清风3 小时前
系统性学习Linux-第二讲-基础开发工具
linux·运维·学习
不会代码的小猴3 小时前
Linux环境编程第六天笔记--system-V IPC
linux·笔记
阳光九叶草LXGZXJ3 小时前
达梦数据库-学习-48-DmDrs控制台命令(同步之Manager、CPT模块)
linux·运维·数据库·sql·学习
诸神缄默不语3 小时前
Linux命令行教程
linux
小二李5 小时前
第11章 nestjs服务端开发:登录鉴权
运维·服务器
i建模6 小时前
如何在Arch Linux中重设忘记的root密码
linux·运维·服务器
chatexcel6 小时前
元空AI+Clawdbot:7×24 AI办公智能体新形态详解(长期上下文/自动化任务/工具粘合)
运维·人工智能·自动化
kida_yuan7 小时前
【Linux】运维实战笔记 — 我常用的方法与命令
linux·运维·笔记
@syh.7 小时前
【linux】进程控制
linux