Tag Info

Hot answers tagged

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

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 ...


7

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: ...


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

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 ...


6

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 ...


6

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 ...


6

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.


5

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 ...


5

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 = ...


5

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 ...


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

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 ...


4

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 ...


4

You do it with X resources. I have a file, .Xresources, that contains these xterm-related resources: XTerm*VT100.cutNewLine: false XTerm*VT100.cutToBeginningOfLine: false XTerm*VT100.charClass: 33:48,35:48,37:48,42:48,45-47:48,64:48,95:48,126:48 In my .xinitrc file, I have some line that merge in those resources: if [ -f $userresources ]; then ...


3

The key event is generated by the X server (as configured by xmodmap), and is sent to your X application. Your window manager could intercept this before it is sent to xterm. XTerm, in turn, translates the event to some bytes and sends the bytes to the pseudo-tty allocated by your shell, bash. Please note that not all events are translated directly to ...


3

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 ...


3

You're misunderstanding. Your console or terminal or PuTTY instance on the LOCAL side is the actual "terminal emulator", even though nowadays we just shorten then to "terminals". The usage stems from back when people actually used monitor-and-keyboard terminals to sign on to a mainframe server rather than using multiple consoles and graphical user ...


3

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 :)


3

(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 ...


3

Xfce Terminal Emulator, Konsole, and Gnome Terminal are good terminal emulators, and all are going to have tabs and keyboard shortcuts. The decision is mainly going to come down to which toolkit you like and which dependencies you can live with. Xfce Terminal is a personal favorite of mine. It's simpler then the other two, but it's mainly missing profiles, ...


3

The easiest way would be to use a compose key. Ubuntu has a community page that describes this feature very well, but I'm not sure about its accuracy when not using Ubuntu. The page says that Shift+RightAlt is the default key but it was not for me on Debian (although I do not use the normal US English layout). Personally I set my compose key to the Menu ...


3

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 ...


3

When you press a key in xterm, it sends a character sequence that is determined by the translations in its X resources. Typically Ctrl+/ sends the single character ^_ (i.e. character number 31, like Ctrl+_). The shell interprets this control character as the undo command. When you press the key in a Linux console, it sends a character sequence that is ...


3

Caleb is right in his comment. xterm is fairly old and you should consider switching to urxvt -- at least the 256 and utf-8 enabled version, refer to your package manager to install the right one. I have an identical set up to yours -- awesome WM, vim, urxvt, tmux/screen -- and they all work well with 256 colours and utf-8. I have set TERM to ...


3

Yes, since you specifically requested xTerm to print() with all the attributes: XTerm*printAttributes: 2 i.e. the output file contains the whole sequence of bytes sent to xTerm and then you are using less (plain, with no switch) to read the file so you get the text version of what appeared on the terminal (stuff with all kind of attributes). The file in ...


3

The resources are stored in the X server - this is to prevent need for distributing the configuration files across several computers. .Xresources was never meant to be read by the applications, it is loaded into the X server with xrdb (although the situation is slightly more unclear when it comes to the older .Xdefaults, AFAICT). See wikipedia article for ...


3

I don't think there's a terminfo capability for that. In practice, testing the value of TERM should be good enough. That's what I do in my .bashrc and .zshrc, and I don't recall it being a problem. case $TERM in (|color(|?))(([Ekx]|dt|(ai|n)x)term|rxvt|screen*)*) PS1=$'\e\]0;$GENERATED_WINDOW_TITLE\a'"$PS1" esac


3

xterm uses the $SESSION_MANAGER environment variable to find out how to contact the X session manager. In your case it seems to be unable to authenticate to it. Possibly, that script is started in the current session but as a different user. Anyway, you don't have to report to a session manager so you can as well unset that variable to make the error ...


2

If you setup a ComposeKey then you can enter the Euro with the sequence compose-E-=, and get lots of other special characters in a similar way. https://help.ubuntu.com/community/GtkComposeTable has some relevant information (not all of it specific to Gtk or Ubuntu; compose key works even if you have no gtk or Gnome) See also How do I put a hat on ...



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