Windows
Linux
Terminal & Shell Scripting
Terminal
Windows title equivalent in Linux
Changes the title text shown in the terminal emulator's title bar.
Windows
→
title
Linux equivalents
echo -ne "\033]0;My Title\007"
echo -ne "\033]0;My Title\007"
echo -ne "\033]0;My Title\007"
Overview
What this command does
Changes the title text shown in the terminal emulator's title bar.
Migration tip: Terminal title escape codes work in most emulators (GNOME Terminal, Konsole, xterm). Add the command to your PS1 prompt definition in
~/.bashrc to update it automatically.Practical tasks
Common use cases
Set the terminal window title
Changes the title text shown in the terminal emulator's title bar.
echo -ne "\033]0;Title\007"
Set title in most terminals
printf "\033]0;%s\007" "title"
printf version (more portable)
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
echo -ne "\033]0;My Terminal\007"
echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"
Walkthrough
Examples with explanations
# Windows: title My Application
echo -ne "\033]0;My Terminal\007"
# Dynamic title showing current dir:
echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"
# Auto-update in ~/.bashrc:
PROMPT_COMMAND='echo -ne "\033]0;${PWD}\007"'
Reference
Common options and variations
| Command or option | Use |
|---|---|
echo -ne "\033]0;Title\007" | Set title in most terminals |
printf "\033]0;%s\007" "title" | printf version (more portable) |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
This command is the same on Debian/Ubuntu, Fedora and Arch Linux when the relevant tool is installed.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | echo -ne "\033]0;My Title\007" |
Same command on this distribution. |
| Fedora | same command | echo -ne "\033]0;My Title\007" |
Same command on this distribution. |
| Arch | same command | echo -ne "\033]0;My Title\007" |
Same command on this distribution. |
Keep learning