Skip to main content
added 7 characters in body
Source Link
Stéphane Chazelas
  • 587.9k
  • 96
  • 1.1k
  • 1.7k

Normally, when the output doesn't go to a terminal, procps' ps does not truncate fieldscommand lines, but that's unless the $COLUMNS environment variable is set and the procps implementation of watch does happen to set it based on the width of the terminal it is running in¹.

But here, rather than running ps | grep (here using non-standard ps aux API that is actually ignored by busybox ps), you could just do:

watch 'pgrep -af languagetool' 

(or watch -x pgrep -af languagetool with procps' watch to avoid the unnecessary shell invocations).

pgrep, with -f will match the regexp against the full² process argument list³ only and not report itself or its ancestry (such as the watch command here).

Note that while busybox does have a pgrep applet, it's not always enabled.

Here, to match on command line only without including the sh, grep/awk and watch commands portably between procps and busybox implementations of ps, you could do:

watch ' COLUMNS=0 ps -o args= | awk "/languagetool/ && ! /exclude-me-please/" ' 

¹ Shells such as ksh, zsh, bash or fish also set a $COLUMNS shell variable (not when non-interactive in the case of bash) but do not export it to the environment by default.

² Or as much it is possible to obtain as earlier versions of the Linux kernel only made the first 4096 bytes available.

³ Joined with spaces and with transformation of some characters such as control ones similarly to what ps -wwo args does.

Normally, when the output doesn't go to a terminal, procps' ps does not truncate fields, but that's unless the $COLUMNS environment variable is set and the procps implementation of watch does happen to set it based on the width of the terminal it is running in¹.

But here, rather than running ps | grep (here using non-standard ps aux API that is actually ignored by busybox ps), you could just do:

watch 'pgrep -af languagetool' 

(or watch -x pgrep -af languagetool with procps' watch to avoid the unnecessary shell invocations).

pgrep, with -f will match the regexp against the full² process argument list³ only and not report itself or its ancestry (such as the watch command here).

Note that while busybox does have a pgrep applet, it's not always enabled.

Here, to match on command line only without including the sh, grep/awk and watch commands portably between procps and busybox implementations of ps, you could do:

watch ' COLUMNS=0 ps -o args= | awk "/languagetool/ && ! /exclude-me-please/" ' 

¹ Shells such as ksh, zsh, bash or fish also set a $COLUMNS shell variable (not when non-interactive in the case of bash) but do not export it to the environment by default.

² Or as much it is possible to obtain as earlier versions of the Linux kernel only made the first 4096 bytes available.

³ Joined with spaces and with transformation of some characters such as control ones similarly to what ps -wwo args does.

Normally, when the output doesn't go to a terminal, procps' ps does not truncate command lines, but that's unless the $COLUMNS environment variable is set and the procps implementation of watch does happen to set it based on the width of the terminal it is running in¹.

But here, rather than running ps | grep (here using non-standard ps aux API that is actually ignored by busybox ps), you could just do:

watch 'pgrep -af languagetool' 

(or watch -x pgrep -af languagetool with procps' watch to avoid the unnecessary shell invocations).

pgrep, with -f will match the regexp against the full² process argument list³ only and not report itself or its ancestry (such as the watch command here).

Note that while busybox does have a pgrep applet, it's not always enabled.

Here, to match on command line only without including the sh, grep/awk and watch commands portably between procps and busybox implementations of ps, you could do:

watch ' COLUMNS=0 ps -o args= | awk "/languagetool/ && ! /exclude-me-please/" ' 

¹ Shells such as ksh, zsh, bash or fish also set a $COLUMNS shell variable (not when non-interactive in the case of bash) but do not export it to the environment by default.

² Or as much it is possible to obtain as earlier versions of the Linux kernel only made the first 4096 bytes available.

³ Joined with spaces and with transformation of some characters such as control ones similarly to what ps -wwo args does.

added 195 characters in body
Source Link
Stéphane Chazelas
  • 587.9k
  • 96
  • 1.1k
  • 1.7k

Normally, when the output doesn't go to a terminal, procps' ps does not truncate fields, but that's unless the $COLUMNS environment variable is set and the procps implementation of watch does happen to set it based on the width of the terminal it is running in¹.

But here, rather than running ps | grep (here using non-standard ps aux API that is actually ignored by busybox ps), you could just do:

watch 'pgrep -af languagetool' 

(or watch -x pgrep -af languagetool with procps' watch to avoid the unnecessary shell invocations).

pgrep, with -f will match the regexp against the full¹² process argument list²list³ only and not report itself or its ancestry (such as the watch command here).

Note that while busybox does have a pgrep applet, it's not always enabled.

Here, to match on command line only without including the sh, grep/awk and watch commands portably between procps and busybox implementations of ps, you could do:

watch ' COLUMNS=0 ps -o args= | awk "/languagetool/ && ! /exclude-me-please/" ' 

¹ Shells such as ksh, zsh, bash or fish also set a $COLUMNS shell variable (not when non-interactive in the case of bash) but do not export it to the environment by default.

² Or as much it is possible to obtain as earlier versions of the Linux kernel only made the first 4096 bytes available.

²³ Joined with spaces and with transformation of some characters such as control ones similarly to what ps -wwo args does.

Normally, when the output doesn't go to a terminal, procps' ps does not truncate fields, but that's unless the $COLUMNS environment variable is set and the procps implementation of watch does happen to set it based on the width of the terminal it is running in.

But here, rather than running ps | grep (here using non-standard ps aux API that is actually ignored by busybox ps), you could just do:

watch 'pgrep -af languagetool' 

(or watch -x pgrep -af languagetool with procps' watch to avoid the unnecessary shell invocations).

pgrep, with -f will match the regexp against the full¹ process argument list² only and not report itself or its ancestry (such as the watch command here).

Note that while busybox does have a pgrep applet, it's not always enabled.

Here, to match on command line only without including the sh, grep/awk and watch commands portably between procps and busybox implementations of ps, you could do:

watch ' COLUMNS=0 ps -o args= | awk "/languagetool/ && ! /exclude-me-please/" ' 

¹ Or as much it is possible to obtain as earlier versions of the Linux kernel only made the first 4096 bytes available.

² Joined with spaces and with transformation of some characters such as control ones similarly to what ps -wwo args does.

Normally, when the output doesn't go to a terminal, procps' ps does not truncate fields, but that's unless the $COLUMNS environment variable is set and the procps implementation of watch does happen to set it based on the width of the terminal it is running in¹.

But here, rather than running ps | grep (here using non-standard ps aux API that is actually ignored by busybox ps), you could just do:

watch 'pgrep -af languagetool' 

(or watch -x pgrep -af languagetool with procps' watch to avoid the unnecessary shell invocations).

pgrep, with -f will match the regexp against the full² process argument list³ only and not report itself or its ancestry (such as the watch command here).

Note that while busybox does have a pgrep applet, it's not always enabled.

Here, to match on command line only without including the sh, grep/awk and watch commands portably between procps and busybox implementations of ps, you could do:

watch ' COLUMNS=0 ps -o args= | awk "/languagetool/ && ! /exclude-me-please/" ' 

¹ Shells such as ksh, zsh, bash or fish also set a $COLUMNS shell variable (not when non-interactive in the case of bash) but do not export it to the environment by default.

² Or as much it is possible to obtain as earlier versions of the Linux kernel only made the first 4096 bytes available.

³ Joined with spaces and with transformation of some characters such as control ones similarly to what ps -wwo args does.

Source Link
Stéphane Chazelas
  • 587.9k
  • 96
  • 1.1k
  • 1.7k

Normally, when the output doesn't go to a terminal, procps' ps does not truncate fields, but that's unless the $COLUMNS environment variable is set and the procps implementation of watch does happen to set it based on the width of the terminal it is running in.

But here, rather than running ps | grep (here using non-standard ps aux API that is actually ignored by busybox ps), you could just do:

watch 'pgrep -af languagetool' 

(or watch -x pgrep -af languagetool with procps' watch to avoid the unnecessary shell invocations).

pgrep, with -f will match the regexp against the full¹ process argument list² only and not report itself or its ancestry (such as the watch command here).

Note that while busybox does have a pgrep applet, it's not always enabled.

Here, to match on command line only without including the sh, grep/awk and watch commands portably between procps and busybox implementations of ps, you could do:

watch ' COLUMNS=0 ps -o args= | awk "/languagetool/ && ! /exclude-me-please/" ' 

¹ Or as much it is possible to obtain as earlier versions of the Linux kernel only made the first 4096 bytes available.

² Joined with spaces and with transformation of some characters such as control ones similarly to what ps -wwo args does.