File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # isuint_Bash() { (( 10#$1 >= 0 )) 2>/dev/null ;}
4
+
5
+ for p in /proc/*
6
+ do
7
+ # part1=$(dirname "$p")
8
+ procid=$( basename " $p " )
9
+ if ! expr -- " $procid " + 0 > /dev/null 2>&1
10
+ then
11
+ # echo "Process $procid"
12
+ # else
13
+ # echo "isn't a number $procid"
14
+ continue
15
+ fi
16
+
17
+ opened_files_path=$p /fd/
18
+ if [ ! -d $opened_files_path ]
19
+ then
20
+ # echo "$opened_files_path No opened files "
21
+ continue
22
+ fi
23
+
24
+ # echo "ls $opened_files_path | wc -l"
25
+ opened_files_count=$( ls $opened_files_path | wc -l)
26
+ if [ $opened_files_count -gt 0 ]
27
+ then
28
+ nm=$( cat $p /cmdline)
29
+ echo -e " ${opened_files_count} \t${procid} \t$nm "
30
+ fi
31
+
32
+ # echo "\t $opened_files_count"
33
+
34
+ # if isuint_Bash $p
35
+ # then
36
+ # echo "Process: $p"
37
+ # fi
38
+
39
+ done
40
+
41
+ exit 0
You can’t perform that action at this time.
0 commit comments