GNU/Linux >> Linux の 問題 >  >> Linux

Linux で「screen」コマンドを使用する方法

画面コマンド

screen コマンドは、バックグラウンドで端末を起動します。この端末は、切り離してから再接続できます。これは、システムにリモートでログインする場合に特に便利です。画面の開始、コマンドの開始、画面からの切り離し、およびログアウトを行うことができます。その後、後でログインして画面に再接続し、実行中のプログラムを確認できます。

以下は screen コマンドで利用可能なオプションです:

# screen --help
Use: screen [-opts] [cmd [args]]
 or: screen -r [host.tty]

Options:
-4            Use IPv4.
-6            Use IPv6.
-a            Force all capabilities into each window's termcap.
-A -[r|R]     Adapt all windows to the new display width & height.
-c file       Read configuration file instead of '.screenrc'.
-d (-r)       Detach the elsewhere running screen (and reattach here).
-dmS name     Start as daemon: Screen session in detached mode.
-D (-r)       Detach and logout remote (and reattach here).
-D -RR        Do whatever is needed to get a screen session.
-e xy         Change command characters.
-f            Flow control on, -fn = off, -fa = auto.
-h lines      Set the size of the scrollback history buffer.
-i            Interrupt output sooner when flow control is on.
-l            Login mode on (update /var/run/utmp), -ln = off.
-list         or -ls. Do nothing, just list our SockDir.
-L            Turn on output logging.
-m            ignore $STY variable, do create a new screen session.
-O            Choose optimal output rather than exact vt100 emulation.
-p window     Preselect the named window if it exists.
-q            Quiet startup. Exits with non-zero return code if unsuccessful.
-r            Reattach to a detached screen process.
-R            Reattach if possible, otherwise start a new session.
-s shell      Shell to execute rather than $SHELL.
-S sockname   Name this session [pid].sockname instead of [pid].[tty].[host].
-t title      Set title. (window's name).
-T term       Use term as $TERM for windows, rather than "screen".
-U            Tell screen to use UTF-8 encoding.
-v            Print "Screen version 4.00.03 (FAU) 23-Oct-06".
-wipe         Do nothing, just clean up SockDir.
-x            Attach to a not detached screen. (Multi display mode).
-X            Execute [cmd] as a screen command in the specified session.

スクリーン セッションの開始

screen セッションを開始するには、次のコマンドを入力します:

# screen

screen コマンドを実行すると、任意のアプリケーションを正常に実行できます。 screen コマンドを実行すると、ターミナルがバックグラウンドで起動されます。

画面から切り離す

画面から切り離すには、次のキーを順番に押します。 「[切り離された]」というメッセージが表示されます 」 セッションが切り離されている場合。バックグラウンド端末はこれで切り離されます。

Ctrl+a+d
[detached]

-d を使用することもできます 別の端末から画面を切り離したい場合のオプション。ここでは、screen -ls から取得できるスクリーン ID を指定する必要があります。 コマンド。

# screen -d [screen id]

例:

# screen -ls
There are screens on:
        25168.pts-0.node01       (Attached)
1 Socket in /var/run/screen/S-root.
# screen -d 25168.pts-0.node01
[25168.pts-0.node01 detached.]

画面に再接続

画面に再接続するには、次のコマンドを入力します:

# screen -r

実行中の画面を一覧表示

スクリーンをステータス (接続/分離) とともにリストするには、-ls オプションの -list を使用します。

# screen -ls
There are screens on:
        25045.pts-0.node01       (Detached)
        25168.pts-0.node02       (Detached)
2 Sockets in /var/run/screen/S-root.


Linux
  1. Linuxgrepコマンドの使用方法

  2. Linuxでhistoryコマンドを使用する方法

  3. LinuxでSuコマンドを使用する方法

  1. Linuxでsudoコマンドを使用する方法

  2. Linuxでidコマンドを使用する方法

  3. Linux screen コマンドの使用方法

  1. Linuxをコマンドで使用する方法

  2. Linuxでlocateコマンドを使用する方法

  3. Linuxの履歴コマンドの使用方法