7

it sounds like a stupid question, but I hope it isnt.

I want to create a simple xterm with a fixed title. I tried:

xterm -title whatever (that is what xterm --help suggests)

xterm -T whatever (according to man pages, this is the same as --title)

but well, my xterm always comes up showing username@hostname:~ in the title. I guess that this title comes from some environment variable; but I would prefer if I do not have to make a permanent change to my .bashrc or .profile just to be able to create one xterm with a fixed title?!

This is xubuntu 14.04

  • The default prompts (PS1) set the title. So any title that's set when xterm starts is then overridden when bash starts. – muru Apr 30 '15 at 7:16
  • OK, I thought along those lines. And there is no way to prevent that? – GhostCat Apr 30 '15 at 7:18
  • I don't know about XTerm, but GNOME Terminal has an option to keep the title from being overriden. What are you trying to achieve, exactly? What's the actual problem? – muru Apr 30 '15 at 7:20
  • My "problem is this": I have to start a command line tool that should sit in the background (doing port-forwarding for me). When I do that in my ordinary terminal ... sooner or later, I might close that terminal; forgetting about the jobs running in the background. So, instead of starting them in a terminal session that looks like any other terminal session; I want to open an xterm with a title like "port-forwarding session!" ... and run the jobs in there. Just a more visible indication to avoid "unwanted" exits. – GhostCat Apr 30 '15 at 8:02
18

Use

xterm -xrm 'XTerm.vt100.allowTitleOps: false' -T whatever
  • thanks so much for this. saved me a bunch of time!! – thang Jun 8 at 19:27
1

To answer the "question" from the comment

I have to start a command line tool that should sit in the background (doing port-forwarding for me)


Instead of relying on an open xterm, you can run the program with nohup in the background, e.g.

nohup /path/to/port-forwarding-tool 2>&1 &

nohup will answer with

nohup: ignoring input and appending output to 'nohup.out'

This will keep the programm running, even if you close the xterm. If you're not interested in the program's output, redirect it to /dev/null

nohup /path/to/port-forwarding-tool >/dev/null 2>&1 &

Another option would be to start the tool as part of your desktop session, although this might depend on the desktop used, e.g. .xsession or autostart folder. Search for "startup" or "desktop autostart". With current systems, systemd user services might be an option too.

How do I start applications automatically on login?

Autostarting .desktop application at startup not working

  • Thanks, but that is really not what I was looking for. The whole point was to have a xterm sitting somewhere to remind me that some background thing was still running. xterm gone, that process gone. Using nohup gives me the exact opposite of that ;-) – GhostCat Mar 4 at 10:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.