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

Some shells like zsh, bash or mksh automatically set the $COLUMNS variable to the width of the terminal, so you don't need to invoke stty here.

My implementationAll the implementations of ps queriesI tried that support that non-standard (BSD-type) syntax query the terminal width by itselfthemselves. I'm surprised yours doesn't. I expect it will look at the content of the COLUMNS environment variable though.

So you could do:

export COLUMNS; ps aux

If not,

ps aux | cut -c"1-$COLUMNS"

You can also tell your terminal not to wrap lines:

tput rmam
ps aux

Some shells like zsh, bash or mksh automatically set the $COLUMNS variable to the width of the terminal, so you don't need to invoke stty here.

My implementation of ps queries the terminal width by itself. I'm surprised yours doesn't. I expect it will look at the content of the COLUMNS environment variable though.

So you could do:

export COLUMNS; ps aux

If not,

ps aux | cut -c"1-$COLUMNS"

You can also tell your terminal not to wrap lines:

tput rmam
ps aux

Some shells like zsh, bash or mksh automatically set the $COLUMNS variable to the width of the terminal, so you don't need to invoke stty here.

All the implementations of ps I tried that support that non-standard (BSD-type) syntax query the terminal width by themselves. I'm surprised yours doesn't. I expect it will look at the content of the COLUMNS environment variable though.

So you could do:

export COLUMNS; ps aux

If not,

ps aux | cut -c"1-$COLUMNS"

You can also tell your terminal not to wrap lines:

tput rmam
ps aux
Source Link
Stéphane Chazelas
  • 585k
  • 96
  • 1.1k
  • 1.7k

Some shells like zsh, bash or mksh automatically set the $COLUMNS variable to the width of the terminal, so you don't need to invoke stty here.

My implementation of ps queries the terminal width by itself. I'm surprised yours doesn't. I expect it will look at the content of the COLUMNS environment variable though.

So you could do:

export COLUMNS; ps aux

If not,

ps aux | cut -c"1-$COLUMNS"

You can also tell your terminal not to wrap lines:

tput rmam
ps aux