Home > Enterprise >  How to trim very long line in bash output?
How to trim very long line in bash output?

Time:01-09

When I use ps aux, some of the rows from the output are very long (thousands of characters) because its COMMAND has too many args. This makes the output unreadable because it those very long lines wrap around in my terminal.

How can I easily trim the output to, say, maximum of 256 characters for any bash command output?

CodePudding user response:

Try using cut, e.g.

ps aux | cut -c1-256
  •  Tags:  
  • Related