![]() The obvious benefit being, you can pick and restore sessions using this name. Noticed the '-s backup-job' addition to the session creation syntax? The -s flag allows us to name the session while creating it. We have 3 sessions running, the first, is shown as 0, because it is an unnamed session. Let's see what tmux has going on in the background. And disconnect from them using the ctrl+b, ctrl+d shortcuts. To get a list of running sessions (because, we can have multiple such sessions running at any given time), use tmux ls. Lastly, we disconnected from that session by hitting the shortcut ctrl+b, ctrl+d Unclear? Firstly, running tmux launched us into a new session. ![]() Note, Ctrl+B, is the prefix here ctrl+b, ctrl+dĠ: 1 windows (created Sun Jun 9 11:11:23 2022) First, 'disconnect' out of the current session, by running the following command. Ordinarily, if you end your SSH session, or lose connectivity, your process would likely end. What you now have, is your node app, running on the remote server, with the process and logs visible to you. While still in the tmux session, run this (or whatever app you may want to run!) npm run dev For example, you may need to run your node app for short time, before deploying into production. The terminal you see, can be used to run any command, as usual. What this does, is launch a new tmux session, (unnamed, by default). ![]() ![]() When tmux is started it creates a new session with a single window and displays it on screen. tmux may be detached from a screen and continue running in the background, then later reattached. You spawn new sessions, switch between them, disconnect and reconnect to your remote - and it's all still there! Installation sudo apt updateĪfter installation, tmux is immediately available for use. tmux is a terminal multiplexer: it enables a number of terminals to be created, accessed, and controlled from a single screen. It makes Tmux waiting for a command to run. ctrl + b All commands below start with this key combination. tmux -S /tmp/sharedsession attach Command mode. Tmux (Terminal MUltipleXer) is the goto utility when you need to run multiple commands, sessions on a remote server. tmux -S /tmp/sharedsession chmod 777 /tmp/sharedsession Anyone can now join your session Attach to a shared session. 2 min read Photo by Lukas / Unsplash Why?. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |