Fixing Terminal Row & Columns Display on Docker and Linux

Ever faced garbled screen on a terminal, text wrapping over and screen command string messed up!
It happens because the terminal is using default row and column value (e.g. columns = 80).

The following command fixes it (tested on Docker container’s terminal)

docker exec -e COLUMNS="`tput cols`" -e LINES="`tput lines`" -ti 

How it Works?

  • tput initializes or reset a terminal by providing terminal info to the shell.
  • From man page of tput:
    The tput utility uses the terminfo database to make the
    values of terminal-dependent capabilities and information available to the shell
  • Let’s find the type of terminal
    # echo $TERM
  • Let’s see what’s suggested rows and columns for this terminal.
    # tput cols
    # tput lines
  • While accessing the container terminal, we passed the number of columns and rows to COLUMNS & LINES variable.
  • The terminal database is present at /usr/share/terminfo.


Written with StackEdit.


Forgot wifi router password? How to update it on Windows?

  • Assuming you are on your wi-fi.
  • Go to run, and type ipconfig. The gateway IP is the IP of your router.
Windows IP Configuration
Wireless LAN adapter Wireless Network Connection:
   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . : 192.168.x.x
   Subnet Mask . . . . . . . . . . . :
   Default Gateway . . . . . . . . . : 192.168.x.x
  • Open a browser, type the router IP as the target address
  • An authentication pop-up would flash. Enter user ID and password. Cisco router use admin/admin.
    • Search here for default user ID and password. Click here
  • Go to wi-fi tab, set your new password
  • Restart your router.
  • Done 🙂