Rename tab in MobaXterm for session duration - windows

How can we rename tabs in MobaXTerm for the entire session duration? At the moment, I can right-click and rename the tabs, but as soon as I press enter to get command prompt, MobaXTerm resets tab name to its original default. I have tried changing PS1 env variable with no effect. Please help.

I haven't tried this myself but when you create a profile for a new ssh session, there is a tab "Bookmark settings" and within this tab there is a check box named "Lock terminal title." According to the manual:
Lock terminal title
Terminal title will be set to the session name
If you check this option, any attempt by the shell to set tab title will fail.
Uncheck this option if you want to allow the shell to change tab title.

Looks like you need to open every new tab as a New Session (Click on the "Session" button) and then follow what ks2000 suggested (It works for me).

There is limitation in number of sessions created for non-purchased mobaxterm. When you go for edit the session, red coloured message this message will be displayed. Delete unwanted sessions, unlock terminal title, then it will work. Otherwise purchase mobaxterm.

A bit late, but I came across this and wanted to update it.
I found the answer here:
https://stackoverflow.com/questions/29963545/rename-tab-in-mobaxterm-for-session-duration
I wrote a bash function to quickly handle this for me.
set_title() {
PROMPT_COMMAND="echo -ne \"\033]0;$1\a\""
}
set_title "webserver"

If none of the above works, just go to the sessions tab and click on the session you want to rename (just like when you want to rename a file). You should see the following:
After that, enter the preferred name and hit enter. The following window will occur:
Click yes and voilĂ !
THIS IS NOT FOR THE SESSION DURATION BUT PERMANENT

Related

iterm2 issue : create new tab with same path of previous current tab BUT 2 tabs are clones and not indepedent

I have switched from default terminal on MacOS Mojave to iterm2. I have an issue about the opening of a new tab from the current tab.
Indeed, I would like to be in the same path than the previous current tab.
For this, I did the classical procedure, i.e to go to iterm2 preferences and Profile and choose Reuse previous session's directory for new tab :
Then, the issue is that once tab opened, all the other tabs are affected and change from their old path to the path of the new tab: I don't understand what happens and which option to use to prevent this behavior.
Every tab is the same than the others: if I do a cd ~/foo/, then the other tabs will go into foodirectory.
Result worse: if I edit with vim a file in one tab, if I do a cd ~/foo/ in another tab, then the tab associated to the edited file disappears is clearing this edition and shows the same windows than the tab where I did cd ~/foo/: very strange.
I want to keep all the current path for all others tabs except for the new one which must be the same than the previous one from which I do a CMD+T.
I saw on different forums this issue sometimes occurs.
Update 1
From what I have seen, it seems that I have to find a way to create a new session when I do the shortcut CMD+T to get another tab independent from the current one (from which I do CMD+T).
But unfortunately, I didn't find how to create a new session in iTerm2 (inside the iTerm2 - Preferences - profile, I could execute a script that creates this new session). From the moment, you can see the command (/bin/bash that I launch when I open a new tab:
I tried also to build the binary iTerm2 from the sources but issue remains.
Update 2
I tried to use a little apple script to force a new session to be created from current window:
tell application "iTerm2"
tell current window
create tab with profile "Terminology2"
end tell
end tell
(where Terminology2 is a duplicate of profile Terminology (default profile).
But always the same issue, the 2 tabs are not independent: each command in one of 2 is executed on the another one.
Update 3
I keep on trying a solution: for this I removed the macport package and hidden files and directory ~/.iTerm2/.
So I downloaded the iTerm2 zip archive from iTerm2 official website.
Here's a screen capture of my profile :
Is shortcut key necessary in this profile to open new tabs : the issue seems to come from this option since it may not concern the shortcut for a new tab ? CMD+T is already a shortcut for opening an independent tab, isn't it ?
Update 4
Solution finally found. Coming from classic MacOS terminal, I was used to do a shortcut CMD+Shift+-> or CMD+Shift+<- to change of tab.
But by chance, I tried simply the shortcut CMD+-> or CMD+<- and so was able to switch between 2 tabs independent.
So this was an error of beginner into iTerm2's world since I was used to apply old classical shortcut of default terminal.
If someone else makes the same mistake, they will know that it is just a configuration issue of shortcut.
The OP already answered the question in Update 4, but in case anyone jumps right to the answers, the solution was to update the Key Mappings and create two new entries - CMD+SHIFT+LEFT & CMD+SHIFT+RIGHT - with assigned actions of Previous Tab and Next Tab, respectively.
These entries can be created in Preferences -> ${Your Profile} -> Keys, and then clicking on the + icon near the Presets... button.
Do you see the all-pane input icon in the upper right?
Command-Shift-I to toggle it. (that is a capital i)
Sounds like you have Broadcasting enabled. To check:
Toolbar > Shell > Broadcast Input > Send input to current Session Only

iTerm2 tab names change; what is this bash command?

I use iTerm2 as my terminal on OS X. When I SSH into a machine, I like to name my tabs by going into the session preferences (cmd + i). Whenever I run another bash command after setting this preference, the tab title goes back to the default that it was when I first SSHd in.
Browsing around for an answer, I found this answer by Chad that is working for me:
export PROMPT_COMMAND=''
echo -e "\033];MY_NEW_TITLE\007"
I don't really understand the PROMPT_COMMAND line, though I tried looking it up.
Can someone explain this in simple terms?
Same question for the 2nd line, as I don't even know how to begin researching that.
To keep the original tab:
Go to Iterm's Preferences > Profiles > Terminal
Uncheck "Terminal may set tab/window title"
Now you can name your tab, ssh into a server, exit and still keep the original tab name.
Credit to: https://groups.google.com/forum/#!topic/iterm2-discuss/czV-sv4ykzI
You can read iTerm2 escape code .
I didn't read the related iTerm2 code thoroughly, but it seems like an interface to manipulate iTerm2.
I guess iTerm2 does this magic by parse the output of screen if the contents fit special format(start by "\033]" and so on), iTerm2 will consider that's the information mean to sent to itself.
I used tabset node plugin. It works like a charm, and also color codes each tab, and has multiple options to color code, add a badge and even bring up a color picker to choose.

Terminal set to an illegal value unable to fix

im running a Snow Leopard 10.6.8 and today i tried running Terminal when i got an error which said.
"You are authorised to run this applicationThe Administrator has set your shell to and illegal value."I checked older posts and so far i have tried changing Terminals File Permissions,Changed /private/etc/shells to default and repaired permissions with disk utility. Does anyone know how to fix this.
It sounds like your user shell got set to an illegal value. To fix this:
Open System Preferences, and go to the Users and groups pane
Click the padlock and authenticate as an administrator
Right-click (or Control-click) on your user account in the sidebar, then choose Advanced Options from the shortcut menu that appears.
In the Advanced dialog, change your Login shell to "/bin/bash". DO NOT CHANGE ANYTHING ELSE.
Click OK to save the change, log out & back in, and try using Terminal again.
The default shell for your user will be set in /private/etc/passwd at the end of the line starting with your username. It should be set to /bin/bash

Open sessions, restore graphical tabs (gvim, windows)

I use gvim and work in tabs. For example, I have 3 tabs open when I :mksession. When I later source it, the files will "open" in buffers, as they are visible in the buffers menu, but it doesn't recreate the tabs.
Looking at the example session.vim, it runs badd for every file, but I can't see anything that creates new tabs. I tried putting au BufAdd * tabnew in my vimrc, but it didn't work as expected.
My .vimrc
Example session.vim
sessionoptions="blank,buffers,curdir,folds,help,resize,tabpages,winsize"
Sometimes the exact right combination of Google search terms will get it for you...
:au BufAdd,BufNewFile * nested tab sball
http://vim.wikia.com/wiki/Open_every_buffer_in_its_own_tabpage
edit: This au command causes Netrw to open a new tab for each directory you browse. A workaround is to run :tab sball after opening a session.
[ When you open session ]
And make your session save command that :mks! next time when You can open session with following.
save session:
1) :mks!
Next open session:
2) vim -S Session.vim
It's so uesful. Enjoy your code in vim.
Thanks.

Saving Meta in OS X Terminal

Since Terminal appeared I've saved as ~/mySrvr.term a modified stock .term file
which opens to execute an ssh to a remote server and to modify the appearance.
I have NOT been able to save "use option key as meta" for emacs-ery; there's no slot for it
in the term file and I'm reluctant to wrestle with a keyboard dictionary file.
Am I missing something simple? How do I get option-as-meta to stick between sessions?
Thanks
If you're on Leopard open up preferences in Terminal.app. There is a tab called Settings which is actually settings for different styles of terminal windows. Make a copy of one of Apple's defaults and change it to your liking and make sure to select the option-as-meta radio button there.
I don't even bother opening term files now, under Leopard you can save any group of windows via the Windows menu and it saves all of their settings and and you can open these backup via the same menu. For example, I have a window group that ssh's into a server in two tabs and the third tab starts up an ssh tunnel.
Not sure if this helps, but when I go Shell -> Export Settings and save the file as a .terminal file, there are a few lines that save my option-as-meta preference:
<key>useOptionAsMetaKey</key>
<true/>
These lines are for a .terminal preference file, not for a .term (which is pretty hard to Google for) so they may not be what you're looking for.

Resources