Set Bash’s TMOUT variable to a positive number of seconds to make an interactive Bash shell exit when no complete line is entered after its primary prompt. For example, TMOUT=900 sets a 15-minute prompt timeout. This applies to the Bash shell, not automatically to every Linux shell, running command, SSH connection, or terminal session.
What TMOUT does—and what it does not
In an interactive Bash shell, TMOUT is the number of seconds Bash waits for input after displaying the primary prompt. If the user does not enter a complete line before the interval expires, Bash exits. See the GNU Bash manual’s interactive shell behavior.
This timeout is about an idle prompt: it does not mean Bash will terminate a command that is already running after the same interval. It is also not a universal Linux setting. Other shells may behave differently, and TMOUT alone does not set an SSH transport timeout or guarantee logout from a terminal multiplexer or graphical session.
Set TMOUT for one user’s Bash login shells
For a per-user setting, add an assignment to the login startup file used by that user’s interactive Bash shell. For example, to use 900 seconds:
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitches#1 Best Overall
TMOUT=900
The value is in seconds, so 900 seconds is 15 minutes. Choose an interval that fits local policy and users’ workflows; there is no universally correct timeout.
For an interactive login shell, Bash reads /etc/profile, then the first readable file it finds from this list: ~/.bash_profile, ~/.bash_login, and ~/.profile. Add the assignment to the applicable file, rather than assuming every distribution or shell invocation reads the same file. The Bash startup files documentation describes this login-shell sequence.
- Identify the shell and startup mode. Confirm the user is running Bash and that the shell in question is an interactive login shell.
- Edit the applicable profile. Put
TMOUT=900in the first readable user login profile Bash uses, or use another startup mechanism appropriate to the site’s setup. - Start a matching shell or load the setting. The value takes effect in a shell where it has been set; opening a new matching login shell is the straightforward way to apply the profile change.
Account for non-login shells and system-wide policy
Non-login interactive Bash shells can follow a different startup path, so a value placed only in a login profile may not cover every shell a user opens. For a system-wide policy, first determine which shell users run and which startup files the target system actually uses. The Bash manual establishes the login-shell order above; it is not a universal distribution-specific recipe for enforcing a policy across all shells.
Administrators sometimes mark TMOUT readonly to discourage changes in a shell. That measure should not be treated as a complete security boundary: this setting alone does not guarantee coverage of other shells or all session types. Verify the startup configuration and test the intended behavior on the systems where the policy will apply.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteCheck the effects on read and select
A positive TMOUT also has effects beyond waiting at the prompt. Bash uses it as the default timeout for the read builtin, and select ends if terminal input does not arrive within that interval. Broadly applying a short value can therefore affect scripts, menus, or other interactive workflows. The Bash variables documentation covers these uses.
If you manage SSH inactivity separately, configure and assess the appropriate SSH or server-side session policy as well. Those mechanisms are distinct from Bash’s prompt timeout.
Quick Recap
Best Value
Rank #4
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

