Hot answers tagged

12

Terminal parameters are stored as $LINES and $COLUMNS variables. Additionally you can use special term-operation programm, for example tput: tput lines # outputs the number of lines of the present terminal window. tput cols # outputs the number of columns of the present terminal window.


6

This command should give you the number of lines on the terminal: stty size | cut '-d ' -f1 Some systems might not implement stty size so you might need something like this instead: stty -a | tr \; \\012 | grep rows | tr -d ' rows'


3

I worked out an approach that lets you find out specifically what terminals are available on the remote host and then set it. Usually, there is at least one ansi compatible terminal, so a 'hack' to fake it should be unnecessary. Done in one long'ish ssh command, it will look something like this: ssh -i ~/.ssh/some_key.pub -tty some_remote_server "export ...


3

tmux 1.8 added the -e option to capture-pane; using this new option causes the captured data to include the effective escape sequences. bind H capture-pane -e \; save-buffer ~/tmux.hardcopy \; delete-buffer (You can omit -b 0 since buffer 0 is the default buffer if one is not specified.)


3

There are a couple of fundamental problems with this question: For this to result in a general solution, the command would have to be supported by ANSI X3.64, the base standard for all modern terminals, but as far as I can tell, that is not an ANSI command. I'm uncertain because I don't have a copy of that standard, I can't find one online, and ANSI won't ...


3

First, it is unlikely that some alternative method (other than responses to control sequences) could be the basis of "a general solution" as requested by the OP, since the property sought is not (for example) amenable to methods using the window properties. Next, this is an example of control sequences which are implemented in xterm but not generally ...


3

The blink feature depends upon the terminal (or terminal emulator). Most terminals you will use accept the control sequences documented in ECMA-48, e.g., VT100-compatible. The control sequence may cause blinking on a given terminal, or show as a particular color, or simply ignored by a given terminal Applications usually use a terminal description ...


2

Use tput to get the control sequences (if they exist) for the user's terminal: red="`tput setaf 1`" green="`tput setaf 2`" cyan="`tput setaf 6`" bold="`tput bold`" norm="`tput sgr0`" echo "${red}invalid entries${norm}" echo "valid entries" echo "valid entry"


2

Have you got specific operations in mind? Here is an example of using standout mode, which on many terminals will give a strong visible result: tput smso; echo hello, world; tput rmso If you were to pipe the sequence to, say, cat, the highlighting would become an empty operation because a pipe isn't a device that understands standout mode: ( tput smso; ...


1

How about this command? M-x ansi-color-for-comint-mode-on


1

It works for me. Without a screenshot, there's not enough information in the question to guess what you were seeing. By the way, TERM=eterm-color (some users override TERM, which won't work well). Here is a screenshot to illustrate the graphic characters: If one sets TERM to xterm (something frequently done...), you can see it works not as well: ...


1

According to the Emacs wiki, the recommended TERM setting for ansi-term is "eterm-color". That terminal description is provided by ncurses; you probably would have to use the package with the complete terminfo database for platforms which make a distinction, e.g., Debian with ncurses-base and ncurses-term. The eterm-color description provides 16 colors, ...


1

You probably have a $LS_COLORS environment variable defined somewhere in your ~/.bashrc/~/.zshrc... (probably via a call of eval "$(dircolors)"). The php that you run on the command-line will inherit your shell's environment, including that $LS_COLORS variable. While the one started by apache2 will inherit apache2's environment which is unlikely to have ...


1

It works when I put export TERM="xterm" before dircolors.


1

Actually it is possible to inquire DEC terminals (and their clones and emulations, including xterm) about their capabilities; just not about individual escape sequence support (or its completeness). UNIX generally doesn't use this feature, relying on termcap/terminfo databases (which document the quirks as well). For reference, the sequences are DA ...


1

It's called blink mode. If your terminal supports it, syntax is echo -e "Normal \e[5mBlink" Bash tips: Colors and formatting ANSI/VT100 Control sequences


1

echo -e "\e[31minvalid entries\e[0m" Reference: Bash tips: Colors and formatting (ANSI/VT100 Control sequences)


1

According to XTerm Control Sequences, those are responses for a particular flavor of mouse, "SGR (1006)". Your terminal was perhaps initialized to send those, e.g., in continuous mode, and on resizing you are seeing the effect of your mouse movement relative to the screen.



Only top voted, non community-wiki answers of a minimum length are eligible