You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

tmux配置12小时制时钟无效:按手册设置仍显示24小时制

Fixing tmux Clock Mode Stuck in 24-Hour Format

Let's troubleshoot this step by step—this is a common gotcha with tmux's clock settings, so we'll get it sorted out.

1. Test the Setting Directly in tmux

First, let's confirm if the setting itself works. In your tmux session:

  • Press your tmux prefix (default is Ctrl+B) followed by : to open the command prompt.
  • Run this command without the -g flag to test for your current window:
    set-window-option clock-mode-style 12
    
  • Open the clock with prefix + t. If it switches to 12-hour format, the setting works—meaning the issue lies with your config file loading or a local window override.

2. Check for Global vs. Window-Specific Overrides

If the direct test worked, verify that your global setting isn't being overridden by a window-specific one:

  • Check the global setting:
    show-window-options -g clock-mode-style
    
    It should return 12 if your config loaded correctly.
  • Check the current window's setting (which might override the global value):
    show-window-options clock-mode-style
    
    If this returns 24 or another value, the window has a local override. Reset it with:
    set-window-option -u clock-mode-style
    
    This removes the window-specific setting and lets it inherit the global configuration.

3. Validate Your Config File and Reload

Double-check for typos in ~/.tmux.conf—small syntax errors can cause settings to fail silently. Your line should be exactly:

set-window-option -g clock-mode-style 12

Then reload the config again to ensure changes take effect:

source-file ~/.tmux.conf

If you suspect a config error, run tmux in debug mode to spot issues:

tmux -vv new-session

This creates a new session and logs debug output to tmux-client-*.log and tmux-server-*.log—look for lines referencing config parsing errors.

4. Fallback: Custom Clock Format for Older tmux Versions

If you're running an older tmux version (pre-1.8, check with tmux -V), the clock-mode-style option might not be supported. Instead, set a custom 12-hour format directly:

set-window-option -g clock-mode-format "%I:%M %p"

Here, %I is the 12-hour hour (01-12), %M is minutes, and %p is the AM/PM indicator.

After making any config changes, reload and test the clock again—this should resolve the issue!

内容的提问来源于stack exchange,提问作者Daniel

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 07:36:44