linux下统计文件的数目,Linux下如何统计文件数目

若只是查看当前目录下的文件数目(除开.和..文件),使用下面的命令:

$ find ./ -type f | wc -l

若查看当前目录下面的所有文件,含.和..使用如下命令即可:

$wc -l

ps:find command and wc command

1、FIND命令

NAME

find - search for files in a directory hierarchy

SYNOPSIS

find [path...] [expression]

DESCRIPTION

This  manual page documents the GNU version of find.  find searches the

directory tree rooted at each given file name by evaluating  the  given

expression  from  left  to  right, according to the rules of precedence

(see section OPERATORS), until the outcome is known (the left hand side

is false for and operations, true for or), at which point find moves on

to the next file name.

The first argument that begins with `-', `(', `)', `,', or `!' is taken

to  be  the  beginning  of  the expression; any arguments before it are

paths to search, and any arguments after it are the rest of the expres-

sion.   If  no  paths  are given, the current directory is used.  If no

expression is given, the expression `-print' is used.

find exits with status 0  if  all  files  are  processed  successfully,

greater than 0 if errors occur.

OPTIONS

All  options  always return true.  They always take effect, rather than

being processed only when their place in  the  expression  is  reached.

Therefore,  for  clarity,  it is best to place them at the beginning of

the expression.

-daystart

Measure times (for -amin,  -atime,  -cmin,  -ctime,  -mmin,  and

-mtime)  from  the  beginning of today rather than from 24 hours

ago.

-depth Process each directory's contents before the directory itself.

-follow

Dereference symbolic links.  Implies -noleaf.

-help, --help

Print a summary of the command-line usage of find and exit.

-maxdepth levels

Descend at most levels (a non-negative integer) levels of direc-

tories  below  the  command line arguments.  `-maxdepth 0' means

only apply the tests and actions to the command line  arguments.

-mindepth levels

Do  not apply any tests or actions at levels less than levels (a

non-negative integer).  `-mindepth 1' means  process  all  files

except the command line arguments.

-mount Don't  descend  directories  on other filesystems.  An alternate

name for -xdev, for compatibility with some  other  versions  of

find.

-noleaf

Do  not  optimize  by  assuming that directories contain 2 fewer

subdirectories than their  hard  link  count.   This  option  is

needed  when  searching  filesystems that do not follow the Unix

directory-link convention, such as CD-ROM or MS-DOS  filesystems

or  AFS  volume  mount  points.  Each directory on a normal Unix

filesystem has at least 2 hard  links:  its  name  and  its  `.'

entry.   Additionally,  its  subdirectories (if any) each have a

`..'  entry linked to that directory.  When find is examining  a

directory,  after it has statted 2 fewer subdirectories than the

directory's link count, it knows that the rest of the entries in

the directory are non-directories (`leaf' files in the directory

tree).  If only the files' names need to be examined,  there  is

no  need  to  stat  them;  this  gives a significant increase in

search speed.

-version, --version

Print the find version number and exit.

-xdev  Don't descend directories on other filesystems.

2、WC命令

wc - print the number of bytes, words, and lines in files

SYNOPSIS

wc [OPTION]... [FILE]...

DESCRIPTION

Print byte, word, and newline counts for each FILE, and a total line if

more than one FILE is specified.  With no FILE, or when FILE is -, read

standard input.

-c, --bytes

print the byte counts

-m, --chars

print the character counts

-l, --lines

print the newline counts

-L, --max-line-length

print the length of the longest line

-w, --words

print the word counts

--help display this help and exit

--version               output version information and exit

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/410881.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Delphi编程修改ProgressBar的颜色

delphi编程修改ProgressBar的颜色关键代码如下:uses CommCtrl; procedure TForm1.Button1Click(Sender: TObject); begin // Set the Background color to teal Progressbar1.Brush.Color : clTeal; // Set bar color to yellow SendMessage(ProgressBar1.Handle, P…

sql 中优化视图或sql语句的执行效率的方法

参见引用http://www.alixixi.com/program/a/2010062662233.shtml转载于:https://www.cnblogs.com/thornfield_he/archive/2010/09/28/1837811.html

删除数据库的表中某字段的值《转》

方法一: update 表名 set 字段名NULL 方法二: update 表名 set 字段名 转载于:https://www.cnblogs.com/LceMeaning/p/3415711.html

linux分区从1开始,Linux 学习笔记 1 使用最小的系统,从分区安装系统开始

我们常用的linux系统在安装过程中大多都省略了对系统进行分区的操作,以至于后期,不了解什么是分区以及分区当中最基本的一些概念,我们不说最细的知识,只求了解这个过程,那直接步入正题,开始第一节的学习。开…

理解Javascript_02_理解undefined和null

来自普遍的回答: 其实在 ECMAScript 的原始类型中,是有Undefined 和 Null 类型的。 这两种类型都分别对应了属于自己的唯一专用值,即undefined 和 null。 值 undefined 实际上是从值 null 派生来的,因此 ECMAScript 把它们定义为相等的&#…

服务器虚拟多台linux,VirtualBox环境下基于多台Ubuntu虚拟机的Hadoop分布式计算环境搭建...

export PATH$HADOOP_HOME/bin:$PATH接下来需要修改hadoop/conf/目录下的配置文件,共有6个文件需要修改,分别是masters、slaves、core-site.xml、mapred-site.xml、hdfs-site.xml、hadoop-env.sh,修改如下文件mastersUB01文件slavesUB02UB03文…

程序员的培养

作者: RayChase 来源: ITeye 发布时间: 2012-05-22 09:01 阅读: 2335 次 原文链接 全屏阅读  [收藏] 这篇文字是我好久以来的想法,有一些感悟,有一些激烈的言辞,我很自豪我就是一名程序员,我希望给程序员或者前程序员们带来…

[html] 你最喜欢html的哪个标签?为什么?

[html] 你最喜欢html的哪个标签?为什么? div,因为此标签是用得最多的也是最强大的HTML标签,许多其它标签也是基于此标签而产生的。个人简介 我是歌谣,欢迎和大家一起交流前后端知识。放弃很容易, 但坚持一…

linux普通用户发送信号,Linux信号发送与作业控制

前言Linux中进程间通信又称为IPC(Inter process communication),大致上可以分为这么几类:消息队列(message queue),旗语(semerpore),共享内存(shared memory),信号(signal),Unix域套接字,socket…

[html] 写一个三栏布局,中间固定,两边自适应(平均)

[html] 写一个三栏布局&#xff0c;中间固定&#xff0c;两边自适应&#xff08;平均&#xff09; <style>html,body {height: 100%;margin: 0;padding: 0;}.container {display: flex;flex-wrap: wrap;width: 100%;height: 100%;}.content {flex: 1;}.side,.right {wid…

《图解CSS3:核心技术与案例实战》

《图解CSS3&#xff1a;核心技术与案例实战》 基本信息 作者&#xff1a; 大漠 丛书名&#xff1a; Web开发技术丛书 出版社&#xff1a;机械工业出版社 ISBN&#xff1a;9787111469209 上架时间&#xff1a;2014-7-2 出版日期&#xff1a;2014 年7月 开本&#xff1a;16开 …

对页面文章过长的处理方法

当在 一个页面显示一个文章的内容时&#xff0c;如果文章太长&#xff0c;会造成页面无限高&#xff0c;样式很不好看&#xff0c;对此我有两种解决方法&#xff1a;一&#xff0c;将内容放在<div>标签中&#xff0c;然后设置标签的style&#xff0c;具体<div style&q…

kali linux重启网络服务报错,Web安全学习笔记之在Kali Linux上安装Openvas以及启动失败修复...

现在用的kali linux是2018.1的版本&#xff0c;在安装openvas的时候报错&#xff0c;无法通过网络下载和安装openvas。主要错误是源配置错误&#xff0c;可能现在用的kali很久没更新了。一、解决和配置更新源问题apt-get upgrade报错显示无法更新&#xff0c;apt-get install o…

This document is opened by another project error message

This is quite annoying error. Finally, Ive found the problem is caused by Visual SVN VS 2008, but no further solution or path to fix this problem by Visual SVN at the moment. So I have to kick it out of my HDD. :( 转载于:https://www.cnblogs.com/javafun/ar…

linux下解压 cpio.gz格式文件

我是在安装oracle10G时从官网找的压缩吧。我个人觉得第二个好。 第一种方法&#xff1a; zcat 10201_database_linux_x86_64.cpio.gz| cpio –idmv 第二种方法 &#xff1a;第一步&#xff1a; gunzip 10201_database_linux_x86_64.cpio.gz第二步&#xff1a; cpio -idmv <…

linux脚本语句,LINUX shell 脚本语句

LINUX中shell脚本中语句的基本用法一、if ...then...fiif [ 条件判断一 ] && (||) [ 条件判断二 ]; then <if 是起始&#xff0c;后面可以接若干个判断式&#xff0c;使用 && 或 || 执行判断elif [ 条件判断三 ] && (||) [ …

Rstudio调用plot()函数时,出现错误的处理方法

按照书上的例子敲出代码后&#xff0c;发现Rstudio无法识别C盘user文件夹下的中文用户名。如下图所示&#xff1a; 按照网上的做法&#xff0c;尝试修改计算机user下的用户名&#xff0c;没修改成功。 另一种做法是在plot()函数前面加上一句dev.new(),便可绘制成功&#xff0c;…

外挂的介绍 什么是外挂

一、 前言 所谓游戏外挂&#xff0c;其实是一种游戏外辅程序&#xff0c;它可以协助玩家自动产生游戏动作、修改游戏网络数据包以及修改游 戏内存数据等&#xff0c;以实现玩家用最少的时间和金钱去完成功力升级和过关斩将。虽然&#xff0c;现在对游戏外挂程序的“合法” 身份…

linux清理备份日志,服务器日志清理备份

"历史上的今天"有没有API接口的功能想添加一个历史上今天功能。人生就像一张有去无回的单程车票&#xff0c;没有彩排&#xff0c;每一场都是现场直播&#xff0c;把握好每次演出便是对人生最好的珍惜。?《历史上的今天》有没有API接口&#xff1f;这个可以参考 Lss…

人事面试的那些问题及背后的考察点

问题 请你自我介绍一下你自己&#xff1f; 你觉得你个性上最大的优点是什么&#xff1f; 说说你最大的缺点&#xff1f; 你对加班的看法&#xff1f; 你对薪资的要求&#xff1f; 在五年的时间内&#xff0c;你的职业规划&#xff1f; 你朋友对你的评价&#xff1f; 你还有什么…