tmux is a program which runs in a terminal and allows multiple other terminal programs to be run inside it. Each program inside tmux gets its own terminal managed by tmux, which can be accessed from the single terminal where tmux is runningscreen komutu yerine tmux kullanlabilir. Açıklaması şöyle.
tmux (and before it, I used screen) is the defacto standard for terminal multiplexing, and keeping things running after you logout.
Kullanım
Açıklaması şöyle.
1. Uzaktaki bir bilgisayara SSH ile bağlanırız.
2. Uzaktaki bir bilgisayarda tmux ile uygulamayı çalıştırırız.
3. SSH bağlantısı kopsa bile tmux çalışmaya devam eder. Uzaktaki makineye tekrar bağlanıp tmux'a tekrar oturum açabiliriz.
One of the biggest benefits of using tmux is that you can detach or pause sessions. This means that if you SSH into a remote machine, start a tmux session and then interrupt your connection, you won’t get the dreaded frozen console. Your session will still end and you’ll need to reconnect, but once reattached to the session all your work will be right where you left it.
Örnek
Şöyle yaparız
# start a new session tmux new-session -s my_session # Now press CTRL + b then d. This will detach from the session manually. # You can see your paused session by executing tmux ls # If you want to reattach to it you can run tmux a -t my_session
ls seçeneği
Şöyle yaparız
> tmux ls
0: 1 windows (created Sat Jul 10 13:47:36 2021) (attached)
has-session seçeneği
Açıklaması şöyle
Örnekhas-session [-t target-session](alias: has)Report an error and exit with 1 if the specified session does not exist. If it does exist, exit with 0.
Şöyle yaparız
if tmux has-session 2>/dev/null; then
echo session exists
else
echo no sessions
fi
Hiç yorum yok:
Yorum Gönder