(1) 使用tree命令查看目录和文件个数
$ sudo apt install tree
在当前 目录下
$ tree
.
├── xxxxx.txt
├── xxx.cpp
├── xxx.o
├── Makefile
├── c.xml
└── readme.txt
0 directories, 6 files
查看其他目录
$ tree
(2)find指令
查找etc目录下的所有文件files并计数
$ find /etc -type f | wc -l
find: ‘/etc/polkit-1/localauthority’: Permission denied
find: ‘/etc/cni’: Permission denied
find: ‘/etc/dhcp/ddns-keys’: Permission denied
find: ‘/etc/ssl/private’: Permission denied
1678
如果觉得后面那些"Permission denied"很讨嫌,可以去掉(输出 到dev/null)
$ find /etc -type f 2> /dev/null | wc -l
1678
(3)ls命令
注意ls -l会包括文件夹本身。
$ ls -l | wc -l
269
$ ls | wc -l
268
如果你只想计算某一类文件,比如.png, .pdf的文件个数,可以这样,
$ ls *.png | wc -l
57
$ ls *.pdf | wc -l
30
(4) 如何查看文件包package的来源repository
apt-cache policy
dpkg -s
apt-cache showpkg
参考来源:apt - How do I find out which repository a package comes from? - Ask Ubuntuhttps://askubuntu.com/questions/8560/how-do-i-find-out-which-repository-a-package-comes-from
其中有一段解释是这样的,
dpkg -s
- allows you to find the version of that you have installed. (source)apt-cache showpkg
- will show a list of Versions of the package available. For each version, the source of the package, in the form of an index file name, will be given.
有时候,真的很想知道文件到底安装到哪里去了,比如
sudo apt-get install leptonica-dev
这条指令,到底都安装了些啥,安装到哪去了呢?这时,可以使用下面的指令来查询,
dpkg -L leptonica-dev
(6) 添加中。。。
持续更新添加。。。
附:
linux常用命令:查看硬件配置的方法示例(含Jetson)_高精度计算机视觉的博客-CSDN博客_linux硬件配置查询命令