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
相关推荐
ChoSeitaku42 分钟前
12.重复内容去重|添加日志|部署服务到Linux上(C++)
linux·c++·windows
一颗小树x1 小时前
Llama 3.1 本地电脑部署 Linux系统 【轻松简易】
linux·llama·本地部署·3.1
Java Fans1 小时前
微信小程序——访问服务器媒体文件的实现步骤
服务器·微信小程序·小程序
技术小齐1 小时前
网络运维学习笔记 017HCIA-Datacom综合实验01
运维·网络·学习
yourkin6661 小时前
HTTPS(下)
服务器·网络协议·https
KingDol_MIni2 小时前
Spring Boot 集成 T-io 实现客户端服务器通信
java·服务器·spring boot
大囚长2 小时前
AI工作流+专业知识库+系统API的全流程任务自动化
运维·人工智能·自动化
Struggle Sheep2 小时前
linux安装redis
linux·运维·redis
神一样的老师3 小时前
超越云计算:计算连续体中的无服务器函数
服务器
ITPUB-微风3 小时前
美团MTSQL特性解析:技术深度与应用广度的完美结合
java·服务器·开发语言