// 'out' is a []byte of the 'stty size' output out, err := exec.Command("stty", "-F", "/dev/tty", "size").Output() // convert []byte to string str := string(out)