Tag Info

Hot answers tagged

15

What is $TERM for? The $TERM variable is for use by applications to take advantage of capabilities of that terminal. For example, if a program want's to display colored text, it must first find out if the terminal you're using supports colored text, and then if it does, how to do colored text. The way this works is that the system keeps a library of known ...


14

VT100 terminals (which all modern terminal emulators emulate to some extent) supported a number of problematic commands, but modern emulators or distributions disable the more problematic and less useful ones. Here's a non-exhaustive list of potentially risky escape sequences (not including the ones that merely make the display unreadable in some way): The ...


9

Xterm is configured via X resources. This is how you might configure it for white on black, with a lighter blue than the default (adjust the color as you see fit, obviously): XTerm.VT100.background: Black XTerm.VT100.color0: Black XTerm.VT100.color1: Red XTerm.VT100.color2: Green XTerm.VT100.color3: ...


8

When you say "for only this bash session", I assume you mean the bash session that is calling the script. When you execute your script, it gets a new shell environment. Thus when you export variables, you are exporting it to the new shell environment and not its parent environment. As far as I know, there is no way to access the parent environment. ...


8

basically, you need: trap 'echo -ne "\033]0;$BASH_COMMAND\007"' DEBUG at the end of your .bashrc or similar. Took me a while to work this out -- see my answer here for more information :)


8

If you meant to distinguish interactive from noninteractive shells, use test's inbuilt support for detecting it (not sure if ksh has it, but the binary from coreutils supports it too): test -t 0 # will return 0 for interactive shells If you really meant whether you're on a tty/pty/pts or something else, parse the output from tty: $ tty # konsole ...


8

This is probably the urgency hint which can be set on windows. This hint is recognized by most window managers. Most terminals can be configured to set the urgency hint when receiving a bell. (u)xterm for example has the bellIsUrgent option and (u)rxvt has urgentOnBell. To ring the bell in a terminal just run tput bel or echo "\a" (depending on the shell ...


8

Update: It's nVidia Stephen Dowdy responded to the Debian bug report and suggested it may be an nVidia bug. where it is corrupting signal masks. Some searching found Debian Bug #728743, and indeed switching to Nouveau/MESA (the open-source driver) has fixed the problem. Note that downgrading to an older nVidia driver did not, which likely means that its ...


7

(Inspired by this SU answer) You can combine a couple bash tricks: If you trap a DEBUG signal, the handler is called before each command is executed The variable $BASH_COMMAND holds the currently executing command So, trap DEBUG and have the handler set the title to $BASH_COMMAND: trap 'echo -ne "\033]0;$BASH_COMMAND\007"' DEBUG This will keep the ...


7

VT100s responded to character sequences sent to them as output. So echo'ing characters works because the terminal sees it as output. Typing characters is input; the terminal will respond only if the characters are echoed by the receiving computer. Your typical shell doesn't echo ESC, it interprets ESC as the prefix for some interactive input command. Run ...


7

Each line of the file contains the string ^M 1 twice. That is, <carriage-return><tab>1 ^M^I1 \r\t1 (Those are three different representations of the same control characters) When this is sent directly to your terminal, as cat will do, the terminal interprets this as an instruction to move back to the beginning of the line, move over 8 ...


7

ls don't outputs colors by default, usually it is an alias to ls --color=auto setted in .bashrc. Check if you're invoking ls directly or through an alias with type ls. If it outputs ls is /bin/ls maybe your .bashrc wasn't loaded when you created the tmux session. If so, try to reload it with source ~/.bashrc.


7

you don't see actual terminals all that often anymore, but for instance the Linux text consoles on (CTRL +) ALT + F1 through F6 are considered terminals. xterm is a terminal emulator for systems running the x-window system and a graphical user interface. It provides only a single terminal, typically running a single process (an interactive shell by ...


6

Xterm puts the variable WINDOWID in the environment of its subprocess. Its value is the window ID of the xterm window. There is no POSIX way of querying the environment of a process based on its PID; here's a Linux way of querying the environment of process $pid and extracting the WINDOWID variable: </proc/$pid/environ gawk -v 'RS=\0' -F = ...


6

You can use ps -o ppid= PID to get the parent ID of process PID, which will probably be the shell that launched it. The parent ID of that shell will be the terminal containing it. To test, I spawned a process that would stay around for a while: $ sleep 5m & [1] 31177 Then I looked up the parent of process 31177, and what command it is: $ ps -o ...


6

As noted by yasouser, middle-click is the standard way to paste the selection buffer in linux. This buffer gets written every time anything is selected with no need to initiate a copy command. In gtk based or influenced apps, there is usually a keybinding for this as well. Shift+Insert In most Desktop Environments there is also a copy buffer that is ...


6

Put xterm*metaSendsEscape: true in your ~/.Xresources file.


6

The TERM environment variable indicates the terminal type, not the terminal application. TERM has a specific purpose: it tells applications running in that terminal how to interact with the terminal. Applications interact with terminals by writing escape sequences — sequences of characters that include nonprintable characters and have effects such as moving ...


6

The Liberation font doesn't seem to have this symbol. But using XTerm*faceName: DejaVu Sans Mono (which is also a truetype font) allows ☠ to be displayed. EDIT: Do not use LibreOffice or OpenOffice to determine whether a glyph is supported in a font, as it silently falls back to another font: OpenOffice bug 45128.


5

For hysterical historical reasons. Hardware manufacturers didn't always standardize on common single control sequence for the same key, and neither did software writers when glass terminals were replaced by terminal emulators. You can find out what control sequence a key generates in a particular terminal by typing Ctrl+V then the key (in most shells, or in ...


5

The value of the environment variable TERM is used by the server (in system V, or BSD, derived OSes) to control how input is recognized by the system, and what capabilities exist for output. Some terminal types are similar enough that they can be interchanged while still remaining usefull, while others could make the system unusable until you open a new ...


5

To paste text copied from other windows (like you said firefox) in xterm window click the mouse wheel or center mouse button.


5

There is a control sequence for querying the current title, but it's usually disabled for security reasons. That's because it allows a malicious program or even just a catted text file to insert arbitrary character sequences as if typed on the keyboard, by first setting the title and then asking to have it reported back. Hence the title stack was introduced ...


5

Your terminal is being colored by the new theme, as you can see from the new background and foreground colors. However, to make ls use more colors than the default set of colors, you should create a dir_colors config file and let it be sourced from ~/.bashrc. This file contains color and filetype pairs that are used to differentiate between different file ...


5

Add -t to your ssh. By default when you pass a command to ssh, it doesnt allocate a TTY on the remote host, so the application only has a basic STDOUT pipe to work with. ssh -t foobar 'watch -t -d -n 1 "netstat -veeantpo | grep 43597"'


5

This will depend on the operating system. For Linux, you could do this: #!/bin/ksh if [ "$TERM" == "linux" ]; then echo "I'm in a virtual console" else echo "I'm not in a virtual console" fi This, of course, assumes that you have not changed the TERM environment variable yourself, which is automatically set to linux only when you log into a virtual ...


5

It sounds to me like you want to check whether or not there is a X server to connect to. Something like: if [ -n "$DISPLAY" ]; then : X else : no X fi


5

You can control whether xterm allows title changes with the Xresources option allowTitleOps described in man xterm. If you don't want to change the defaults for your user via the ~/.Xresources you can add Xresources options from the command line using the -xrm option: xterm -xrm "xterm*allowTitleOps: false" -T "my title"


5

The TERM environment variable should be set by the application that is acting as your terminal. This is the whole point of the thing: letting programs running inside them know what terminal is being used and hence what sort of features it supports. Zsh is not a terminal. It is a shell. It might care what your TERM is set to if it wants to do special things, ...


5

Looking at it from the perspective of what's similar between xterm and screen: First: we're takling about emulations of this kind of real hardware device, a terminal (VT100 in this example): (from Wikimedia commons) xterm emulates one terminal showing it as a GUI window on screen screen emulates multiple terminals, but does not actually emulate the ...



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