Question

when I open Iterm, the top of the window says 1. Shell and then quickly changes to 1.bash. Can anyone tell me what they mean? And is it possible to change the title on the top? Thanks!

Was it helpful?

Solution

iTerm has several options for altering the text within the title bar. Select iTerm -> Preferences from the menu and then select Appearance. You will see three options related to the the title bar under Window & Tab Titles:

  • Show window number (checked by default)
  • Show current job name (checked by default)
  • Show profile name (unchecked by default)

The 1. is the window number. If you open multiple windows using the menu bar, Shell -> New Window or the shortcut Command-N, this number will increment for each window you open. Closing a window won't force a renumber, but the lowest available number will be used when you open a new window.

The current job name is the command the terminal is currently executing. When waiting for input, it displays the shell, bash in your case. If you execute a command, say sleep 10, it will display sleep since that is the command currently executing. Once the command ends, it will display bash again. It takes a second to update so it won't change for commands that execute quickly.

bash is the name of your command shell. bash is the default command shell, but you can change it if you wish (I personally use zsh). As noted above, this is the current job if no other command is executing.

Yes, you can change the title bar. You can use an ASCII escape sequence and the echo command (be sure to type this exactly):

echo "\033];Hello World\007"

will place the text Hello World in the title. Note that when you set title bar contents in this manner, the current job is placed in parenthesis. After executing the echo, my title bar displays:

1. Hello World (zsh)

Most people set the title bar as part of a custom prompt. This allows the title bar to update after each command and display useful information such as the current working directory. For example, see https://apple.stackexchange.com/questions/90725/for-iterm2-how-do-i-make-the-working-directory-appear-in-the-window-title and https://superuser.com/questions/79972/set-the-title-of-the-terminal-window-to-the-current-directory for details on putting the current working directory in the title bar.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top