Home
Packages
Forums
Wiki
GitLab
Security
AUR
Download
コンテンツにスキップ
メインメニュー
メインメニュー
サイドバーに移動
非表示
案内
メインページ
目次
コミュニティに貢献
最近の出来事
おまかせ表示
特別ページ
交流
ヘルプ
貢献
最近の更新
最近の議論
新しいページ
統計
リクエスト
ArchWiki
検索
検索
表示
アカウント作成
ログイン
個人用ツール
アカウント作成
ログイン
GNU Screenのソースを表示
ページ
議論
日本語
閲覧
ソースを閲覧
履歴を表示
ツール
ツール
サイドバーに移動
非表示
操作
閲覧
ソースを閲覧
履歴を表示
全般
リンク元
関連ページの更新状況
ページ情報
表示
サイドバーに移動
非表示
←
GNU Screen
あなたには「このページの編集」を行う権限がありません。理由は以下の通りです:
この操作は、次のグループに属する利用者のみが実行できます:
登録利用者
。
このページのソースの閲覧やコピーができます。
[[Category:ターミナルエミュレータ]] [[en:GNU Screen]] [[ru:GNU Screen]] [[zh-CN:GNU Screen]] {{Related articles start}} {{Related|tmux}} {{Related articles end}} [http://www.gnu.org/s/screen/ GNU Screen] はテキストプログラムとシェルを分離させることができるラッパーです。Screen を使うことで、例えば、X のターミナルでテキストプログラムを起動して、X を終了し、プログラムを使い続けることなどが可能になります。 == インストール == GNU Screen は[[公式リポジトリ]]の {{pkg|screen}} パッケージを使って[[インストール]]できます。 == 使用方法 == コマンドを入力するときは {{ic|ctrl+a}} を押してからキーバインディングを押します。 === よく使われるコマンド === * {{ic|ctrl+a}} {{ic|?}} コマンドとコマンドのデフォルトを表示 (とても重要です) * {{ic|ctrl+a}} {{ic|:}} screen のコマンドプロンプトに入る * {{ic|ctrl+a}} {{ic|"}} ウィンドウリスト * {{ic|ctrl+a}} {{ic|0}} ウィンドウ0を開く * {{ic|ctrl+a}} {{ic|A}} 現在のウィンドウの名前を変更 * {{ic|ctrl+a}} {{ic|a}} 現在のウィンドウに {{ic|ctrl+a}} を送信 * {{ic|ctrl+a}} {{ic|c}} 新しいウィンドウ (とシェル) を作成 * {{ic|ctrl+a}} {{ic|S}} 現在の領域を2つの領域に分割 * {{ic|ctrl+a}} {{ic|tab}} 次の領域に入力フォーカスを移動 * {{ic|ctrl+a}} {{ic|ctrl+a}} 現在の領域と前の領域を切り替え * {{ic|ctrl+a}} {{ic|Esc}} コピーモードに入ります (enter を使ってテキストの範囲を選択) * {{ic|ctrl+a}} {{ic|]}} テキストの貼り付け * {{ic|ctrl+a}} {{ic|Q}} 現在の領域以外の全ての領域を閉じる * {{ic|ctrl+a}} {{ic|X}} 現在の領域を閉じる * {{ic|ctrl+a}} {{ic|d}} 現在のスクリーンセッションからデタッチ、動作し続ける。復帰するには {{ic|screen -r}} を使う === コマンドプロンプトコマンド === * {{ic|ctrl+a}} {{ic|:quit}} 全てのウィンドウと screen セッションを終了 * {{ic|ctrl+a}} {{ic|:source ~/.screenrc}} screenrc 設定ファイルをリロード (/etc/screenrc を使うことも可能) === セッションに名前を付ける === 名前付きセッションを作成するには、次のコマンドで screen を起動します: $ screen -S ''session_name'' To prints a list of ''pid.tty.host'' strings identifying your screen sessions: $ screen -list 名前付きスクリーンセッションにアタッチするには、次のコマンドを実行: $ screen -x ''session_name'' === systemd で自動起動 === 以下のサービスは特定のユーザーで screen を自動的に起動します (例: {{ic|systemctl enable screen@florian}}): {{hc|/etc/systemd/system/screen@.service|<nowiki> [Unit] Description=screen After=network.target [Service] Type=forking User=%i ExecStart=/usr/bin/screen -dmS autoscreen ExecStop=/usr/bin/screen -S autoscreen -X quit [Install] WantedBy=multi-user.target </nowiki>}} == Tips and tricks == === エスケープキーを変更する === エスケープキーは {{ic|~/.screenrc}} の {{ic|escape}} オプションで変更できます。例: {{bc|escape ``}} 上の場合エスケープキーは {{ic|`}} に設定されます。 {{bc|escape ^^^}} これだと {{ic|ctrl+^}} に設定されます。 === ウィンドウ1から起動 === デフォルトでは、一番最初のスクリーンウィンドウは0です。ウィンドウ0を使わずに1から起動して欲しい場合、設定に以下の行を追加してください: {{hc|~/.screenrc| bind c screen 1 bind ^c screen 1 bind 0 select 10 screen 1 }} === 入れ子のスクリーンセッション === It is possible to get stuck in a nested screen session. A common scenario: you start an ssh session from within a screen session. Within the ssh session, you start screen. By default, the outer screen session that was launched first responds to {{ic|ctrl+a}} commands. To send a command to the inner screen session, use {{ic|ctrl+a}} {{ic|a}}, followed by your command. For example: * {{ic|ctrl+a}} {{ic|a}} {{ic|d}} Detaches the inner screen session. * {{ic|ctrl+a}} {{ic|a}} {{ic|K}} Kills the inner screen session. === Use 256 colors === By default, screen uses an 8-color terminal emulator. To enable more colors, you need to be using a terminal that supports them and set the correct [http://aperiodic.net/screen/commands:term term] value. This will use [[wikipedia:Terminfo|terminfo]] to describe how the [[wikipedia:ANSI escape code|ANSI escape codes]] will be interpreted. An entry in the terminfo database structure must exist, {{Pkg|ncurses}} provides many common descriptions stored under {{ic|/usr/share/terminfo/}}. First try the generic value: {{hc|~/.screenrc| term screen-256color }} If that does not work, try setting it based on the used terminal. When using [[xterm]]-based terminal: {{hc|~/.screenrc| term xterm-256color }} When using [[rxvt-unicode]]: {{hc|~/.screenrc| term rxvt-unicode-256color }} {{Note|{{ic|/usr/share/terminfo/r/rxvt-unicode-256color}} is provided by {{Pkg|rxvt-unicode-terminfo}}, which is installed as a dependency of {{Pkg|rxvt-unicode}}. However, if you log into a server via [[SSH]] and run ''screen'' there, this terminfo file might not be available on the server. In this case it is recommended to copy {{ic|/usr/share/terminfo/r/rxvt-unicode-256color}} on the server, it can be saved in {{ic|~/.terminfo}}.}} As a last resort, try setting [http://aperiodic.net/screen/commands:termcapinfo termcapinfo] instead: {{hc|~/.screenrc|<nowiki> attrcolor b ".I" # allow bold colors - necessary for some reason termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm' # tell screen how to set colors. AB = background, AF=foreground defbce on # use current bg color for erased chars </nowiki>}} === Informative statusbar === The default statusbar may be a little lacking. You may find this one more helpful: {{hc|~/.screenrc|<nowiki> hardstatus off hardstatus alwayslastline hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m-%d %{W} %c %{g}]' </nowiki>}} Another possibility, taken from [http://www.fordfrog.com/2012/09/02/71/ frodfrog's blog] is: {{hc|~/.screenrc|<nowiki> hardstatus alwayslastline '%{= G}[ %{G}%H %{g}][%= %{= w}%?%-Lw%?%{= R}%n*%f %t%?%{= R}(%u)%?%{= w}%+Lw%?%= %{= g}][ %{y}Load: %l %{g}][%{B}%Y-%m-%d %{W}%c:%s %{g}]' </nowiki>}} === ウェルカムメッセージをオフにする === {{hc|~/.screenrc| startup_message off }} === Turn your hardstatus line into a dynamic urxvt|xterm|aterm window title === This one is pretty simple; just switch your current {{ic|hardstatus}} line into a {{ic|caption}} line with notification, and edit accordingly: {{hc|~/.screenrc|<nowiki> backtick 1 5 5 true termcapinfo rxvt* 'hs:ts=\E]2;:fs=\007:ds=\E]2;\007' hardstatus string "screen (%n: %t)" caption string "%{= kw}%Y-%m-%d;%c %{= kw}%-Lw%{= kG}%{+b}[%n %t]%{-b}%{= kw}%+Lw%1`" caption always </nowiki>}} This will give you something like {{ic|screen (0 bash)}} in the title of your terminal emulator. The caption supplies the date, current time, and colorizes your screen window collection. ===Use X scrolling mechanism=== The scroll buffer of GNU Screen can be accessed with {{ic|ctrl+a}} {{ic|[}}. However, this is very inconvenient. To use the scroll bar of e.g. xterm or konsole, add the following line: {{hc|~/.screenrc| termcapinfo xterm* ti@:te@ }} === 動作中のプログラムを screen にアタッチ === If you started a program outside screen, but now you would like it to be inside, you can use '''reptyr''' to reparent the process from it's current tty to one inside screen. [[公式リポジトリ]]から {{Pkg|reptyr}} パッケージを[[インストール]]してください。 Get the PID of the process (you can use {{ic|ps ax}} for that). Now just enter the PID as argument to reptyr inside a screen window. {{bc|$ reptyr ''<pid>''}} ===Setting a different bash prompt while in screen=== If you want a different bash prompt when in a screen session, add the following to your .bashrc: {{bc|<nowiki> if [ -z $STY ] then PS1="YOUR REGULAR PROMPT" else PS1="YOUR SCREEN PROMPT" fi </nowiki>}} [http://serverfault.com/questions/257975/how-to-check-if-im-in-screen-session] ===ビジュアルベルを切る=== 以下の設定を使えば、screen はベル音声の代わりに画面の点滅を使うのを止めます。 {{hc|~/.screenrc| vbell off }} == トラブルシューティング == === screen で起動した時に Midnight Commander がフリーズするのを修正 === In some cases (need deeper inspection) [https://bugzilla.redhat.com/show_bug.cgi?id=168076 old gpm bug] gets alive. So, then you try to run mc inside screen, you get a frozen screen window. Try to kill gpm daemon before starting mc and/or disable it in {{ic|/etc/[[rc.conf]]}}. === エディタのテキストが残るのを修正 === nano などのテキストエディタを開いて閉じると、テキストがターミナルに残ってしまうことがあります。これを修正するには、以下を記述してください: {{hc|~/.screenrc| altscreen on }} == 参照 == * [http://www.macosxhints.com/article.php?story=20021114055617124 MacOSX Hints - Automatically using screen in your shell] * [http://wiki.gentoo.org/wiki/Screen Gentoo Wiki - screen のチュートリアル] * [https://bbs.archlinux.org/viewtopic.php?id=50647 Arch Forums - Regarding 256 color issue with urxvt] * [https://bbs.archlinux.org/viewtopic.php?id=55618 Arch Forums - .screenrc configs with screenshots] * [[Ratpoison]] - gnu screen ベースのウィンドウマネージャ * [[en2:Xpra|Xpra]] - An utility to detach/reattach X programs, in a way similar as screen does for command line based programs
このページで使用されているテンプレート:
テンプレート:Bc
(
ソースを閲覧
)
テンプレート:Hc
(
ソースを閲覧
)
テンプレート:Ic
(
ソースを閲覧
)
テンプレート:META Related articles start
(
ソースを閲覧
)
テンプレート:Note
(
ソースを閲覧
)
テンプレート:Pkg
(
ソースを閲覧
)
テンプレート:Related
(
ソースを閲覧
)
テンプレート:Related articles end
(
ソースを閲覧
)
テンプレート:Related articles start
(
ソースを閲覧
)
GNU Screen
に戻る。
検索
検索
GNU Screenのソースを表示
話題を追加