From owner-freebsd-questions@FreeBSD.ORG Wed Sep 24 01:03:12 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C26F6106566B for ; Wed, 24 Sep 2008 01:03:12 +0000 (UTC) (envelope-from ws@au.dyndns.ws) Received: from ipmail05.adl2.internode.on.net (ipmail05.adl2.internode.on.net [203.16.214.145]) by mx1.freebsd.org (Postfix) with ESMTP id 44BA18FC13 for ; Wed, 24 Sep 2008 01:03:11 +0000 (UTC) (envelope-from ws@au.dyndns.ws) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApUBAGYu2UiWZWdv/2dsb2JhbAAItnSBZw X-IronPort-AV: E=Sophos;i="4.33,296,1220193000"; d="scan'208";a="213725967" Received: from ppp103-111.static.internode.on.net (HELO [192.168.1.157]) ([150.101.103.111]) by ipmail05.adl2.internode.on.net with ESMTP; 24 Sep 2008 10:33:08 +0930 From: Wayne Sierke To: Chris St Denis In-Reply-To: <48D98542.6090007@smartt.com> References: <48D98542.6090007@smartt.com> Content-Type: text/plain Date: Wed, 24 Sep 2008 10:33:06 +0930 Message-Id: <1222218186.2581.152.camel@predator-ii.buffyverse> Mime-Version: 1.0 X-Mailer: Evolution 2.22.2 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: "freebsd-questions@freebsd.org" Subject: Re: Fix corrupted terminal output X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Sep 2008 01:03:12 -0000 On Tue, 2008-09-23 at 17:09 -0700, Chris St Denis wrote: > Occasionally, I accidentially cat a binary file or a directory casing > the terminal output to be corrupted with text looking like (don't know > if this will make it through the mail cleanly) > > E???? ??? ?? ?????????. > ????2# > > > To fix this normally I just close the window and open a new ssh > connection, but I am wondering if there is a more clean way to do this. > I've tried reset(1), but it doesn't seem to help any. The terminal has probably switched to an alternate charset mode. I recently encountered this situation while using tmux and found that issuing 'reset' was ineffectual. To recover from this try issuing a \017 character to the terminal, or the escape sequence: ^[[m. How you can do that most easily depends on which shell you're using at the time, so you can try: /bin/echo ^v^o (^v is ctrl-v ^o is ctrl-o) /bin/sh -c "echo -e \\017" /bin/echo ^v^[[m /bin/sh -c "echo -e \\033[m" Thanks go to Nicholas Marriott for pointing out this solution. Wayne