2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Linux PCで自分専用のtmuxを作る方法

2
Posted at

はじめに

Linux PCで、自分専用のtmux環境を作る方法を紹介する。tmux の -L オプションを使用すると、別ソケットを利用した独立した tmux 環境を作成できる。

共有ユーザで SSH ログインしている環境でも、他ユーザの tmux セッションと分離できるため便利である。

動作確認環境

  • Ubuntu 22.04 x86_64

方法

新規セッションの作成

最初に、以下のコマンドで新規セッションを作成する。

tmux -L <socket_name> new -s <session_name>
  • -L
    • 任意のソケット名(自分の名前など)を指定する
  • new -s
    • 任意のセッション名(ソケット名と同じでも良い)で新規セッションを作成する

既存のセッションにアタッチ

作成済みのセッションが存在する場合は、以下のコマンドで既存のセッションにアタッチできる。

tmux -L <socket_name> attach -t <session_name>
  • -L
    • アタッチするソケット名を指定する
  • attach -t
    • アタッチするセッション名を指定する

または

tmux -L <socket_name> a -t <session_name>
  • -L
    • アタッチするソケット名を指定する
  • a -t
    • アタッチするセッション名を指定する

作成したソケットのセッションを見るには以下のコマンドを入力する。

tmux -L <socket_name> ls

なお、tmux kill-server はデフォルトソケットのみを対象とするため、別ソケットの tmux セッションには影響しない。

まとめ

Linux PCで自分専用のtmux環境を作る方法を紹介した。tmux の -L オプションを利用することで、通常の tmux とは独立した tmux 環境を利用できる。

共有ユーザ環境で tmux セッションを分離したい場合に便利である。

参考

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?