linux無root權限安裝screen, screen常用命令


基本參考:https://blog.csdn.net/qq_27262727/article/details/103753634
screen 安裝包下載:

wget -c https://ftp.gnu.org/gnu/screen/screen-4.8.0.tar.gz

解壓文件

tar -xzvf screen-4.8.0.tar.gz 
#新建/home/ysj/Install目錄
mkdir Install
#進入安裝包目錄
cd screen-4.8.0/
#在安裝包目錄下,新建build目錄
mkdir build && cd build
#編譯源碼,因為沒有管理員權限所以在configure后面添加home下自己新建的install路徑
../configure -prefix=/home/ysj/Install#
#最后make
make && make install
#在.bashrc文件里設置screen執行路徑
vi ~/.bashrc
#添加install路徑
PATH=/home/ysj/install/bin:$PATH
#執行source ~/.bashrc更新PATH
source ~/.bashrc
screen --help

顯示如下,安裝成功

-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.
-ls [match]   or
-list         Do nothing, just list our SockDir [on possible matches].
-L            Turn on output logging.
-Logfile file Set logfile name.
-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.
-Q            Commands will send the response to the stdout of the querying process.
-r [session]  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.08.00 (GNU) 05-Feb-20".
-wipe [match] Do nothing, just clean up SockDir [on possible matches].
-x            Attach to a not detached screen. (Multi display mode).
-X            Execute <cmd> as a screen command in the specified session.

screen常用命令

# 創建一個會話
screen -S test
# 列出當前所有會話
screen -ls
# 進入一個名為test的會話
screen -r test
# 遠程脫離test會話
screen -d test
# 脫離(detach)當前會話,將目前的 screen session (可能含有多個 windows) 丟到后台執行
ctrl + a + d
# 殺死當前會話
kill 進程號

恢復對話時有時會出現

There is no screen to be resumed matching ****

先斷開會話

screen -d ****
# 再重新進入
screen -r ****


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM