12년 전

12년 전

방금 Ubuntu 10.04에 tmux를 설치하고 다음 줄을 사용하여 C-a파일을 생성하여 접두사 키를 다시 매핑하려고 했습니다 .~/.tmux.conf

set-option -g prefix C-a
unbind-key C-b

정기적으로 및 tmux를 시작할 때 -f ~/.tmux.conf접두사는 사실상 동일한 기본값입니다.C-b

오류나 경고가 전혀 없습니다.

conf 로딩에 어떤 문제가 있는지 아시나요?

답변1

~/.tmux.conf 파일은 tmux 서버가 처음 시작될 때 로드됩니다. 따라서 기존 tmux 세션이 있는 경우 새 세션을 시작해도 tmux.tmux.conf 파일이 다시 로드되지 않습니다. tmux 서버를 다시 시작해 보세요. 명령을 사용하여 tmux list-sessions기존 세션이 있는지 확인하세요. 종료합니다(예 tmux attach: 모든 창을 종료하고 종료합니다). 모든 세션이 종료되면 tmux다시 시도하세요. 이번에는 리바인딩이 작동해야 합니다.

답변2

세션을 종료하지 않고 ~/.tmux.conf를 다시 로드하려면 다음을 수행하면 됩니다.

<prefix> :source-file /absolute/path/to/your/.tmux.conf

기본적으로 는 어디에 <prefix>있습니까 ?<C-b>

답변3

tmux 세션 내에서 실행하십시오.

tmux source-file /absolute/path/to/your/.tmux.conf

답변4

12년 전

영웅왼쪽논평.

그것은 나를 위해 작동합니다 ™. 실행 strace -s9999 -f -o tmux.strace tmux -c true하고 의 출력을 게시해 보십시오 grep -C5 'tmux\.conf' tmux.strace. – Gilles 'SO- 악한 짓은 그만둬' 2010년 9월 14일 20:24

절제된 표현의 마스터 클래스

팬파로네이드 없이 그들은 댓글에 한 문장도 빠뜨렸는데,답변하지만,대답. 뿐만 아니라대답이 질문에는 하지만참고 답변질문의 전체 클래스에.

그것을 분해

무슨 strace -s9999 -f -o tmux.strace tmux -c true뜻인가요?

1의 2개 명령과 비슷합니다. 기본 명령은 tmux이지만 이라는 "접두사"/"래퍼"가 제공됩니다 strace. 이는 명령 time df을 실행하는 데 걸리는 시간을 측정하기 위해 실행하는 것과 매우 유사합니다 df.

strace -s9999 -f -o tmux.strace

$ man strace | grep -A1 ^NAME
NAME
       strace - trace system calls and signals

$ man strace | grep -EA10 '^ *DESCRIPTION($| )'
DESCRIPTION
       In the simplest case strace runs the specified command until it  exits.   It
       intercepts  and  records  the system calls which are called by a process and
       the signals which are received by a process.  The name of each system  call,
       its  arguments  and its return value are printed on standard error or to the
       file specified with the -o option.

       strace is a useful diagnostic, instructional, and  debugging  tool.   System
       administrators,  diagnosticians and trouble-shooters will find it invaluable
       for solving problems with programs for  which  the  source  is  not  readily
       available  since  they  do not need to be recompiled in order to trace them.

$ man strace | grep -EA4 '^ *-s($| )'
       -s strsize
       --string-limit=strsize
                   Specify the maximum string size to print (the  default  is  32).
                   Note  that  filenames  are not considered strings and are always
                   printed in full.

$ man strace | grep -EA6 '^ *-f($| )'
       -f
       --follow-forks
                   Trace child processes as they are created  by  currently  traced
                   processes as a result of the fork(2), vfork(2) and clone(2) sys‐
                   tem calls.  Note that -p PID  -f  will  attach  all  threads  of
                   process  PID  if  it  is  multi-threaded,  not  only thread with
                   thread_id = PID.

$ man strace | grep -EA8 '^ *-o($| )'
       -o filename
       --output=filename
                   Write the trace output to  the  file  filename  rather  than  to
                   stderr.   filename.pid  form  is used if -ff option is supplied.
                   If the argument begins with '|' or '!', the rest of the argument
                   is  treated as a command and all output is piped to it.  This is
                   convenient for piping the debugging output to a program  without
                   affecting  the redirections of executed programs.  The latter is
                   not compatible with -ff option currently.

tmux -c true

$ man tmux | grep -EA4 '^ *-c($| [^ ]*$)'
     -c shell-command
                   Execute shell-command using the default shell.  If necessary,
                   the tmux server will be started to retrieve the default-shell
                   option.  This option is for compatibility with sh(1) when tmux
                   is used as a login shell.

$ man true | grep -A1 ^NAME
NAME
       true - do nothing, successfully

왜...

tmux와 함께 사용하시나요 -c?

우리는 의 시작 프로세스에만 관심이 있으므로 tmux대화식으로 사용할 필요는 없습니다. 따라서 일반적인 대화형 셸 대신 명령을 실행하도록 지시합니다.

truetmux 명령으로 사용하시겠습니까 ?

매우 빠르게 종료되고 로그가 짧게 유지되기 때문입니다.

strace와 함께 사용 하시겠습니까 -o tmux.strace?

출력을 저장하는 파일일 뿐입니다. 이름을 짓는 것은 어렵습니다. 기본 이름이나 확장자를 다른 것과 일치시키는 것은 중요하지 않았습니다.

strace와 함께 사용 하시겠습니까 -f?

나는 당신이 매뉴얼 페이지에서 발췌한 내용을 읽었다고 가정할 것입니다.중복하다. 상당히 복잡한 애플리케이션은 하위 프로세스를 생성하게 됩니다. 은 엄청나게 복잡하기 때문에 tmux우리는 그것들도 확실히 추적하고 싶습니다.

strace와 함께 사용 하시겠습니까 -s9999?

출력을 파일에 쓰고 있으므로 터미널 너비에 맞게 줄을 잘릴 필요가 없습니다. 크게 설정하세요. 나중에 문제가 있으면 표시해 보세요.

왜 이렇게이것 중 하나라도?

만약에어느, 이렇게 장문의 답변을 쓴다는 뜻이군요...

  1. 왜냐하면 저는 엔지니어링 팀을 교육하고 그들에게 이 답변을 알려줄 것이기 때문입니다.
  2. 왜냐하면 자일스는...
    • 정말 영웅이다
    • 10년 이상 동안 댓글에 찬성표가 0개 있었습니다.
    • 너무 오랫동안 눈에 띄지 않았고 계속되는 것을 거부합니다.

이 과정이 왜 있는지 모르겠다면같은 질문에 답하기 위해 "conf 로딩에 어떤 문제가 있는지 아시나요?" 그럼 제가 당신에게XY 문제

뿐만 아니라질문자XY 문제에 빠진 사람. 그것극도로~이 실수를 저지르세요~ 이렇게 하라는 대답도 흔합니다. 이 경우 이 질문에 대한 많은 답변은 프로세스가 시작된 후 구성 파일을 로드/다시 로드하는 방법을 독자에게 지시합니다. 이는 프로세스가 파일을 로드해야 하는 대로 로드하지 못한다는 사실을 무시하는 것을 의미합니다.

여기까지 해냈다면 다음과 같은 경우에는 실패를 무시해도 괜찮습니다.

  • 다른 사람의 방해 요인인 자신을 제거할 수 있도록 방해 요인을 지나쳐 나가십시오.
  • 나중에 다시 와서 문제를 올바르게 수정하겠습니다

테이크아웃

많은 문제는 "파일을 로드하는 데 어떤 문제가 있습니까?"로 압축될 수 있습니다. 이 질문은 "파일을 로드하려고 하는 중인가요? 시도할 때 무슨 일이 발생합니까?"라는 형태로 스파이럴 감각을 자극해야 합니다.

strace다음과 같이 질문할 수 있는 모든 문제를 해결할 수/사용해야 합니다[?]

  • 이 프로세스는 무엇을 하려는 걸까요?
  • 무엇인가요그것그것이 [하려고 하는 일]을 시도할 때 경험하는 것인가요?

종종 그렇습니다.과정의 실패가 아니다뭔가를 하려고 하지만사용자의 실수프로세스가 어떤 일을 하기를 기대합니다. 그리고 그 과정에서 사용자에게 알려지지 않은 많은 일들을 경험하게 됩니다.

추상적 인 고상함으로 충분합니다. 예를 생각해 봅시다:

$ tmux kill-server; rm tmux.strace; strace -s9999 -f -o tmux.strace tmux -c true
no server running on /tmp/tmux-1000/default

$ ls -lh tmux*
-rw-r--r-- 1 bruno bruno  21K Jun 11 10:58 tmux-client-18358.log
-rw-r--r-- 1 bruno bruno 324M Jun 11 10:58 tmux-server-18360.log
-rw-r--r-- 1 bruno bruno 342K Jun 11 13:48 tmux.strace

$ grep 'tmux\.conf' tmux.strace
521744 readlink("/etc/tmux.conf", 0x7ffe2c0446d0, 1023) = -1 ENOENT (No such file or directory)
521744 readlink("/home/bruno/.tmux.conf", 0x7ffe2c0446d0, 1023) = -1 ENOENT (No such file or directory)
521744 readlink("/home/bruno/.config/tmux/tmux.conf", 0x7ffe2c0446d0, 1023) = -1 ENOENT (No such file or directory)

$ ls -lA /home/bruno/.config/tmux
-rw-r--r-- 1 bruno bruno 307 Jun 10 20:29 tmux.config

보이나요? 마지막 2개 명령의 출력을 살펴보세요. 문제를 해결하는 방법을 보여 주면 도움이 될 것입니다.

$ mv ~/.config/tmux/tmux.config \
    ~/.config/tmux/tmux.conf

$ tmux kill-server; rm tmux.strace; strace -s9999 -f -o tmux.strace tmux -c true
no server running on /tmp/tmux-1000/default

$ grep -A2 '\.config/tmux/tmux\.conf' tmux.strace
527872 openat(AT_FDCWD, "/home/bruno/.config/tmux/tmux.conf", O_RDONLY) = 8
527872 newfstatat(8, "", {st_mode=S_IFREG|0644, st_size=307, ...}, AT_EMPTY_PATH) = 0
527872 read(8, "set -sg escape-time 0\nset -g mode-keys vi\n\n# remap prefix from 'C-b' to 'C-f'\nset-option -g prefix C-f\nunbind-key C-b\nbind-key C-f send-prefix\n\n# split panes using | and -\nbind | split-window -h\nbind - split-window -v\n# bind \"\33OA\" # scroll natural up\n# bind \"\33OB\" # scroll natural down\nunbind '\"'\nunbind %\n\n", 4096) = 307

참고: 마지막 줄은 내(이전에 이름이 잘못 지정된) 파일의 전체 내용입니다 ~/.config/tmux/tmux.conf.

관련 정보