Simply set xterm title?

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


Use

xterm -xrm 'XTerm.vt100.allowTitleOps: false' -T whatever

I know this thread was active a few years ago, but here is what I did recently. First, realize that the default configuration for XTerm is a little bit different now than it was in 1993 and just using the -T command line option won't work without changing a few configuration items for your X session files, .xinitrc and .Xresources. (You can check if these files exist by typing ls -a in your home (~) directory.)

  1. The .xinitrc text file in your home directory must have the first line

    xrdb -merge .Xresources

    (or whatever your resources file is named (it could be .Xdefaults)). This will activate the resources when X starts. If there is no .xinitrc file, you will need to create one. Make sure the last line in the file executes your window manager exec mwm, exec twm, etc.

  2. The .Xresources text file in your home directory must have the line

    xterm*allowTitleOps: false

    xterm*Title: yourtitle (if you want a custom default title for all xterm windows)

    Again, if the .Xresources file doesn't exist, just create one.

  3. Last of all, use the xrdb -merge .Xresources command to make the changes take effect immediately. You should now be able to use the -T and -n options for any new xterm windows.


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