Set Linux Terminal Console Column Width

A quick trick I learned today was how to set the column width for a terminal console with stty. This way, the shell acts a bit more normal.

stty cols 80

A snippit from the stty man page reveals some more information and tricks:

* cols N
	      tell the kernel that the terminal has N columns
* rows N
	      tell the kernel that the terminal has N rows
* size print the number of rows and columns according to the kernel

I didn’t realize how useful this program was! Certainly worth taking a deeper look into if your always consoled into your embedded Linux system.

Feel free to donate if this post prevented any headaches! Another way to show your appreciation is to take a gander at these relative ads that you may be interested in:

There's 3 Comments So Far

  • venkatesh kareti
    March 8th, 2012 at 10:57 pm


    I was searching for this information from very very long time….. but every google search says about a function but not about the command in terminal to get the details….

    thank you very much!!!

  • Louie Bergsagel
    June 11th, 2013 at 10:23 am

    stty cols 132 does not work in my linux environment. I have no idea why not.
    Red Hat Enterprise Linux Server release 6.3 (Santiago)

  • clownzoid
    July 29th, 2014 at 2:58 am

    Very useful; Just came up with a slight modification you may appreciate; try:

    stty cols $(tput cols)

    Should reset the columns to th ecurrent terminal size after each command.

Share your thoughts, leave a comment!