Linux 命令笔记
来源:互联网 发布:怎么注册淘宝网店步骤 编辑:程序博客网 时间:2024/05/11 23:32
Linux 命令笔记 - 001 (ls)
以下来自于 man ls
Name
ls - list directory contents // ls - 显示目录内容
DESCRIPTION
List information about the FILEs (the current directory by default). // 显示文件信息列表(默认值为当前文件夹)
Sort entries alphabetically if none of -cftuvSUX nor --sort. // 如果没有附加选项参数,按字母表顺序排列
Mandatory arguments to long options are mandatory for short options too.// 长选项的有强制参数,短选项也同样需要
以下来自于 info ls
The `ls' program lists information about files (of any type, including directories). Options and file arguments can be intermixed arbitrarily, as usual.
For non-option command-line arguments that are directories, by default `ls' lists the contents of directories, not recursively, and omitting files with names beginning with `.'. For other non-option arguments, by default `ls' lists just the file name. If no non-option argument is specified, `ls' operates on the current directory, acting as if it had been invoked with a single argument of `.'.
By default, the output is sorted alphabetically, according to the locale settings in effect.(1) If standard output is a terminal, the output is in columns (sorted vertically) and control characters are output as question marks; otherwise, the output is listed one per line and control characters are output as-is.
Because `ls' is such a fundamental program, it has accumulated many options over the years. They are described in the subsections below; within each section, options are listed alphabetically (ignoring case). The division of options into the subsections is not absolute, since some options affect more than one aspect of `ls''s operation.
// 简要翻译并脑补部分内容
// ls 程序列出有关文件信息。ls后接[参数表]和[目录位置]。默认状态下,不会递归出子目录内容并省略“ . 和.. ”。默认状态下仅输出文件名等价于 ls . 。默认状态下,按字母顺序排列,输出为列,纵向排序。
常用参数表:
ls -l // 显示长列表
ls -a // 显示所有,包含隐藏文件和文件夹 ls -A // 显示所有包含隐藏文件和文件夹,但不包括“ .和 .. ”
ls -h // 已常见的形式显示文件大小
ls -i // 显示文件索引数值
ls -d // 显示目录 而不是显示目录下的内容
ls -F // 显示加标识 <颜色不好时真晃眼>
ls -p // 给目录结尾加上 / 作为标记 <-F的一部分>
ls -r // 排倒叙
ls -t // 修改时间倒叙
ls -S // 按文件大小,降序排列 <如果接多个顺序排列方式,依次进行,输出最后结果>
ls -X // 按文件扩展名排序
ls -R // 递归列出子目录
ls -Z // 显示文件和文件夹的 SElinux 的信息
ls --version // 显示命令当前版本
排序例子:
[root@eva000 /]# mkdir -p test
[root@eva000 /]# cd test
[root@eva000 test]# touch a.txt
[root@eva000 test]# touch b.txt
[root@eva000 test]# touch d.txt
[root@eva000 test]# touch c.txt
[root@eva000 test]# ls
a.txt b.txt c.txt d.txt
[root@eva000 test]# ls -t
c.txt d.txt b.txt a.txt
[root@eva000 test]# ls -tr
a.txt b.txt d.txt c.txt
[root@eva000 test]# ls -r
d.txt c.txt b.txt a.txt
[root@eva000 test]# echo
[root@eva000 test]# echo '123456' > d.txt
[root@eva000 test]# echo '12345' > a.txt
[root@eva000 test]# echo '1234' > c.txt
[root@eva000 test]# echo '123' > b.txt
[root@eva000 test]# ls -S
d.txt a.txt c.txt b.txt
[root@eva000 test]# ls -Sr
b.txt c.txt a.txt d.txt
- LINUX命令学习笔记
- Linux命令笔记
- Linux命令笔记
- Linux 命令学习笔记
- linux 命令笔记
- Linux批处理命令笔记
- linux笔记 tar命令
- linux学习笔记--命令
- linux--命令笔记
- linux shell命令笔记
- linux命令笔记
- Linux 命令笔记
- linux 命令 笔记
- linux命令练习 笔记
- Linux命令笔记
- linux命令学习笔记
- linux命令笔记
- linux命令笔记
- C++学习之路C++Primer学习笔记(四)_变量
- JQuery
- pd建表
- 关于EditText屏蔽Emoji表情及屏蔽其它非法字符带来的光标不准确问题
- 快排二
- Linux 命令笔记
- 在 Eclipse 中,开发 Android 项目的常用快捷键介绍
- Sleep()函数和wait()函数的区别
- python spynner库
- handler机制
- 数据结构
- Opencv_contrib编译错误file DOWNLOAD cannot open file for write.
- 波束形成的一点思考
- 干货!嵌入式Linux系统的构成和启动总结