Skip to content

Commit 9a727ba

Browse files
committed
improve help message: one line contains less 80 chars
1 parent 73dfbfc commit 9a727ba

File tree

3 files changed

+76
-47
lines changed

3 files changed

+76
-47
lines changed

docs/java.md

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ show-busy-java-threads -l
111111
# 帮助信息
112112
$ show-busy-java-threads -h
113113
Usage: show-busy-java-threads [OPTION]... [delay [count]]
114-
Find out the highest cpu consumed threads of java, and print the stack of these threads.
114+
Find out the highest cpu consumed threads of java processes,
115+
and print the stack of these threads.
115116

116117
Example:
117118
show-busy-java-threads # show busy java threads info
@@ -120,30 +121,39 @@ Example:
120121

121122
Output control:
122123
-p, --pid <java pid> find out the highest cpu consumed threads from
123-
the specified java process, default from all java process.
124+
the specified java process.
125+
default from all java process.
124126
-c, --count <num> set the thread count to show, default is 5.
125127
-a, --append-file <file> specifies the file to append output as log.
126-
-S, --store-dir <dir> specifies the directory for storing intermediate files, and keep files.
127-
default store intermediate files at tmp dir, and auto remove after run.
128-
use this option to keep files so as to review jstack/top/ps output later.
128+
-S, --store-dir <dir> specifies the directory for storing
129+
the intermediate files, and keep files.
130+
default store intermediate files at tmp dir,
131+
and auto remove after run. use this option to keep
132+
files so as to review jstack/top/ps output later.
129133
delay the delay between updates in seconds.
130134
count the number of updates.
131-
delay/count arguments imitates the style of vmstat command.
135+
delay/count arguments imitates the style of
136+
vmstat command.
132137

133138
jstack control:
134139
-s, --jstack-path <path> specifies the path of jstack command.
135-
-F, --force set jstack to force a thread dump.
136-
use when jstack <pid> does not respond (process is hung).
137-
-m, --mix-native-frames set jstack to print both java and native frames (mixed mode).
138-
-l, --lock-info set jstack with long listing. Prints additional information about locks.
140+
-F, --force set jstack to force a thread dump. use when jstack
141+
does not respond (process is hung).
142+
-m, --mix-native-frames set jstack to print both java and native frames
143+
(mixed mode).
144+
-l, --lock-info set jstack with long listing.
145+
prints additional information about locks.
139146

140147
CPU usage calculation control:
141-
-d, --top-delay specifies the delay between top samples, default is 0.5 (second).
142-
get thread cpu percentage during this delay interval.
148+
-d, --top-delay specifies the delay between top samples.
149+
default is 0.5 (second). get thread cpu percentage
150+
during this delay interval.
143151
more info see top -d option. eg: -d 1 (1 second).
144-
-P, --use-ps use ps command to find busy thread(cpu usage) instead of top command,
145-
default use top command, because cpu usage of ps command is expressed as
146-
the percentage of time spent running during the *entire lifetime*
152+
-P, --use-ps use ps command to find busy thread(cpu usage)
153+
instead of top command.
154+
default use top command, because cpu usage of
155+
ps command is expressed as the percentage of
156+
time spent running during the *entire lifetime*
147157
of a process, this is not ideal in general.
148158

149159
Miscellaneous:
@@ -412,22 +422,25 @@ find-in-jars 'log4j\.properties' -s ' ' | awk '{print $2}'
412422
# 帮助信息
413423
$ find-in-jars -h
414424
Usage: find-in-jars [OPTION]... PATTERN
415-
Find file in the jar files under specified directory(recursive, include subdirectory).
425+
Find files in the jar files under specified directory,
426+
search jar files recursively(include subdirectory).
416427
The pattern default is *extended* regex.
417428
418429
Example:
419430
find-in-jars 'log4j\.properties'
420-
find-in-jars '^log4j\.(properties|xml)$' # search file log4j.properties/log4j.xml at zip root
431+
# search file log4j.properties/log4j.xml at zip root
432+
find-in-jars '^log4j\.(properties|xml)$'
421433
find-in-jars 'log4j\.properties$' -d /path/to/find/directory
422434
find-in-jars '\.properties$' -d /path/to/find/dir1 -d path/to/find/dir2
423435
find-in-jars 'Service\.class$' -e jar -e zip
424436
find-in-jars 'Mon[^$/]*Service\.class$' -s ' <-> '
425437
426438
Find control:
427-
-d, --dir the directory that find jar files, default is current directory.
428-
this option can specify multiply times to find in multiply directories.
429-
-e, --extension set find file extension, default is jar.
430-
this option can specify multiply times to find in multiply extension.
439+
-d, --dir the directory that find jar files.
440+
default is current directory. this option can specify
441+
multiply times to find in multiply directories.
442+
-e, --extension set find file extension, default is jar. this option
443+
can specify multiply times to find multiply extension.
431444
-E, --extended-regexp PATTERN is an extended regular expression (*default*)
432445
-F, --fixed-strings PATTERN is a set of newline-separated strings
433446
-G, --basic-regexp PATTERN is a basic regular expression
@@ -436,7 +449,8 @@ Find control:
436449
437450
Output control:
438451
-a, --absolute-path always print absolute path of jar file
439-
-s, --seperator seperator for jar file and file entry, default is `!'.
452+
-s, --seperator specify the seperator between jar file and zip entry.
453+
default is `!'.
440454
441455
Miscellaneous:
442456
-h, --help display this help and exit

find-in-jars

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/bin/bash
22
# @Function
3-
# Find file in the jar files under current directory
3+
# Find files in the jar files under specified directory, search jar files recursively(include subdirectory).
44
#
55
# @Usage
66
# $ find-in-jars 'log4j\.properties'
7-
# $ find-in-jars '^log4j\.(properties|xml)$' # search file log4j.properties/log4j.xml at zip root
7+
# # search file log4j.properties/log4j.xml at zip root
8+
# $ find-in-jars '^log4j\.(properties|xml)$'
89
# $ find-in-jars 'log4j\.properties$' -d /path/to/find/directory
910
# $ find-in-jars '\.properties$' -d /path/to/find/dir1 -d path/to/find/dir2
1011
# $ find-in-jars 'Service\.class$' -e jar -e zip
@@ -70,22 +71,25 @@ usage() {
7071

7172
> $out cat <<EOF
7273
Usage: ${PROG} [OPTION]... PATTERN
73-
Find file in the jar files under specified directory(recursive, include subdirectory).
74+
Find files in the jar files under specified directory,
75+
search jar files recursively(include subdirectory).
7476
The pattern default is *extended* regex.
7577
7678
Example:
7779
${PROG} 'log4j\.properties'
78-
${PROG} '^log4j\.(properties|xml)$' # search file log4j.properties/log4j.xml at zip root
80+
# search file log4j.properties/log4j.xml at zip root
81+
${PROG} '^log4j\.(properties|xml)$'
7982
${PROG} 'log4j\.properties$' -d /path/to/find/directory
8083
${PROG} '\.properties$' -d /path/to/find/dir1 -d path/to/find/dir2
8184
${PROG} 'Service\.class$' -e jar -e zip
8285
${PROG} 'Mon[^$/]*Service\.class$' -s ' <-> '
8386
8487
Find control:
85-
-d, --dir the directory that find jar files, default is current directory.
86-
this option can specify multiply times to find in multiply directories.
87-
-e, --extension set find file extension, default is jar.
88-
this option can specify multiply times to find in multiply extension.
88+
-d, --dir the directory that find jar files.
89+
default is current directory. this option can specify
90+
multiply times to find in multiply directories.
91+
-e, --extension set find file extension, default is jar. this option
92+
can specify multiply times to find multiply extension.
8993
-E, --extended-regexp PATTERN is an extended regular expression (*default*)
9094
-F, --fixed-strings PATTERN is a set of newline-separated strings
9195
-G, --basic-regexp PATTERN is a basic regular expression
@@ -94,7 +98,8 @@ Find control:
9498
9599
Output control:
96100
-a, --absolute-path always print absolute path of jar file
97-
-s, --seperator seperator for jar file and file entry, default is \`!'.
101+
-s, --seperator specify the seperator between jar file and zip entry.
102+
default is \`!'.
98103
99104
Miscellaneous:
100105
-h, --help display this help and exit

show-busy-java-threads

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
# @Function
3-
# Find out the highest cpu consumed threads of java, and print the stack of these threads.
3+
# Find out the highest cpu consumed threads of java processes, and print the stack of these threads.
44
#
55
# @Usage
66
# $ ./show-busy-java-threads
@@ -89,7 +89,8 @@ usage() {
8989

9090
> $out cat <<EOF
9191
Usage: ${PROG} [OPTION]... [delay [count]]
92-
Find out the highest cpu consumed threads of java, and print the stack of these threads.
92+
Find out the highest cpu consumed threads of java processes,
93+
and print the stack of these threads.
9394
9495
Example:
9596
${PROG} # show busy java threads info
@@ -98,30 +99,39 @@ Example:
9899
99100
Output control:
100101
-p, --pid <java pid> find out the highest cpu consumed threads from
101-
the specified java process, default from all java process.
102+
the specified java process.
103+
default from all java process.
102104
-c, --count <num> set the thread count to show, default is 5.
103105
-a, --append-file <file> specifies the file to append output as log.
104-
-S, --store-dir <dir> specifies the directory for storing intermediate files, and keep files.
105-
default store intermediate files at tmp dir, and auto remove after run.
106-
use this option to keep files so as to review jstack/top/ps output later.
106+
-S, --store-dir <dir> specifies the directory for storing
107+
the intermediate files, and keep files.
108+
default store intermediate files at tmp dir,
109+
and auto remove after run. use this option to keep
110+
files so as to review jstack/top/ps output later.
107111
delay the delay between updates in seconds.
108112
count the number of updates.
109-
delay/count arguments imitates the style of vmstat command.
113+
delay/count arguments imitates the style of
114+
vmstat command.
110115
111116
jstack control:
112117
-s, --jstack-path <path> specifies the path of jstack command.
113-
-F, --force set jstack to force a thread dump.
114-
use when jstack <pid> does not respond (process is hung).
115-
-m, --mix-native-frames set jstack to print both java and native frames (mixed mode).
116-
-l, --lock-info set jstack with long listing. Prints additional information about locks.
118+
-F, --force set jstack to force a thread dump. use when jstack
119+
does not respond (process is hung).
120+
-m, --mix-native-frames set jstack to print both java and native frames
121+
(mixed mode).
122+
-l, --lock-info set jstack with long listing.
123+
prints additional information about locks.
117124
118125
CPU usage calculation control:
119-
-d, --top-delay specifies the delay between top samples, default is 0.5 (second).
120-
get thread cpu percentage during this delay interval.
126+
-d, --top-delay specifies the delay between top samples.
127+
default is 0.5 (second). get thread cpu percentage
128+
during this delay interval.
121129
more info see top -d option. eg: -d 1 (1 second).
122-
-P, --use-ps use ps command to find busy thread(cpu usage) instead of top command,
123-
default use top command, because cpu usage of ps command is expressed as
124-
the percentage of time spent running during the *entire lifetime*
130+
-P, --use-ps use ps command to find busy thread(cpu usage)
131+
instead of top command.
132+
default use top command, because cpu usage of
133+
ps command is expressed as the percentage of
134+
time spent running during the *entire lifetime*
125135
of a process, this is not ideal in general.
126136
127137
Miscellaneous:

0 commit comments

Comments
 (0)