0
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】screen入門

Posted at

screenの基本トピック

screenの概要とインストール

sshでログインし作業を行う際などにssh接続が切れるなどでjobが止まる場合があります。これはたとえばノートPCからGPUマシンのサーバにログインし、DeepLearningの学習などを行う場合、ネットワーク接続が維持できない場合に何らかの解決が必要になります。

このような場合の解決策の1つがscreenです。screenを用いることで作業している状態をマシン(サーバ)の電源が切れない限りは保持ずることができます。

Ubuntu環境でscreenのインストールを行うにあたっては下記を実行すれば良いです。

$ apt install screen

screenの基本的な使い方

$ screen -S xxx

まずscreenで新しいセッションのxxxを作成する場合は上記のようにscreen -S xxxを実行します。この後に何らかの処理を実行し、「Ctrl+a->d」を押すことでセッションからデタッチすることが可能です。デタッチした後、セッションの確認にあたっては下記のコマンドを実行すれば良いです。

$ screen -ls

・実行結果

[detached from 11111.xxx]

また、デタッチ後に再びアクティブなscreenセッションに再接続するにあたっては下記のようにscreen -rコマンドを実行すれば良いです。

$ screen -r xxx

screenセッションを閉じる場合はexitコマンドか「Ctrl+D」を押せば良いです。

0
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
0
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?