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
相关推荐
湖北春晖信息7 分钟前
工业自动化实践:机器人上料系统如何优化生产流程?
运维·机器人·自动化
非自律懒癌患者30 分钟前
ubuntu 20.04 ping baidu.coom可以通,ping www.baidu.com不通 【DNS出现问题】解决方案
linux·tcp/ip·ubuntu
Xam_d_LM30 分钟前
【Linux】如何清除 Ubuntu 留下的 EFI 分区,Windows 磁盘管理器右键删除卷是灰色
linux·运维·windows·ubuntu·重装系统·磁盘管理器
自由鬼1 小时前
WebSphere Application Server(WAS)8.5.5教程第五讲
运维·服务器·程序人生·中间件·was·ibm·websphere
黄暄1 小时前
Linux项目部署全攻略:从环境搭建到前后端部署实战
java·linux·运维·服务器·前端·后端·持续部署
独行soc2 小时前
2025年渗透测试面试题总结-安恒[实习]安全服务工程师(题目+回答)
linux·数据库·安全·web安全·面试·职场和发展·渗透测试
L汐2 小时前
01 CentOS根分区满了扩容
linux·运维·centos
小峰编程2 小时前
Python函数——万字详解
linux·运维·服务器·开发语言·前端·网络·python
大筒木老辈子2 小时前
Linux笔记---内核态与用户态
linux·运维·笔记
厦门辰迈智慧科技有限公司3 小时前
大中型水闸安全监测系统解决方案
运维·服务器·安全