windows
1.统计代码行数,统计src文件夹下的所有.h和.cpp文件代码行数
在PowerShell中执行命令:
(Get-ChildItem .\src -Recurse | Where-Object {$_.Name -like "*.h" -or $_.Name -like "*.cpp"} | Get-Content | Measure-Object).Count
linux
1.统计代码.h.cpp行数
xxx@xxx:~/VTKDemo/src$ find . -name "*.cpp" -o -name "*.h" | xargs cat | grep -v '^$' | wc -l
67854
//不过滤空行
xxx@xxx:~/VTKDemo/src$ find . -name "*.cpp" -o -name "*.h" | xargs cat | wc -l
75402
2.统计xxxxx进程正在运行的个数,如果没有wc -l,会列出所有正在运行的xxxxx进程列表
ps -ef|grep xxxxx进程名称|wc -l
3.查找文件
//使用locate,locate经常需要在之前执行sudo updatedb命令更新数据库
locate xxx.cpp
//使用find命令,假设文件在home下,就从~/查找
find ~/ -name xxx.cpp
Linux常用命令整理
2130

被折叠的 条评论
为什么被折叠?



