Is it possible to limit ps column output to a specified length starting from the back?

Solution 1:

Using some small unix programs chained together, you could do this-

ps -ax -o command | head -n 10 | rev | cut -c 1-100 | rev

ps -ax -o command prints only the command and arguemnts

Head prints the first 10 lines

rev reverses the string

cut produces the last 100 characters in reverse

rev reverses the string back

Using awk a text processing language-

ps -ax -o command | awk 'NR <=10 { print substr( $0, length($0) - 100, length($0) ) }'