{"id":1582,"date":"2021-03-23T19:28:42","date_gmt":"2021-03-23T19:28:42","guid":{"rendered":"https:\/\/dft.wiki\/?p=1582"},"modified":"2021-09-10T01:15:06","modified_gmt":"2021-09-10T01:15:06","slug":"tmux-cheat-sheet","status":"publish","type":"post","link":"https:\/\/dft.wiki\/?p=1582","title":{"rendered":"Tmux Cheat Sheet"},"content":{"rendered":"<p>Tmux is a terminal multiplexer that allows multiple terminal sessions to be accessed simultaneously in a single window.<\/p>\n<p>It is possible to put the sessions in background and re-attach them later. In case of the connection drops, the session remains running in background.<\/p>\n<p><strong>Shortcuts<\/strong><\/p>\n<ul>\n<li>ctrl+b <span style=\"color: #ff0000;\"><strong>%<\/strong><\/span>\n<ul>\n<li>divides the window vertically;<\/li>\n<\/ul>\n<\/li>\n<li>ctrl+b <strong><span style=\"color: #ff0000;\">&#8220;<\/span><\/strong>\n<ul>\n<li>devices the window horizontally;<\/li>\n<\/ul>\n<\/li>\n<li>ctrl+b <span style=\"color: #ff0000;\"><strong>left<\/strong><\/span>|<span style=\"color: #ff0000;\"><strong>right<\/strong><\/span>|<span style=\"color: #ff0000;\"><strong>up<\/strong><\/span>|<span style=\"color: #ff0000;\"><strong>down<\/strong><\/span>\n<ul>\n<li>navigates between panes;<\/li>\n<\/ul>\n<\/li>\n<li>ctrl+b <span style=\"color: #ff0000;\"><strong>c<\/strong><\/span>\n<ul>\n<li>creates a new window;<\/li>\n<\/ul>\n<\/li>\n<li>ctrl+b <span style=\"color: #ff0000;\"><strong>0<\/strong><\/span>\n<ul>\n<li>selects window 0;<\/li>\n<\/ul>\n<\/li>\n<li>ctrl+b <strong><span style=\"color: #ff0000;\">,<\/span><\/strong>\n<ul>\n<li>renames the current window;<\/li>\n<\/ul>\n<\/li>\n<li>ctrl+b <span style=\"color: #ff0000;\"><strong>d<\/strong><\/span>\n<ul>\n<li>detaches the session (leave the session running in background);<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>Sections<\/strong><\/p>\n<ul>\n<li>tmux <span style=\"color: #ff0000;\"><strong>ls<\/strong><\/span>\n<ul>\n<li>list active sessions;<\/li>\n<\/ul>\n<\/li>\n<li>tmux <span style=\"color: #ff0000;\"><strong>attach -t<\/strong><\/span> 0\n<ul>\n<li>attaches to session 0;<\/li>\n<\/ul>\n<\/li>\n<li>tmus <span style=\"color: #ff0000;\"><strong>rename-session -t<\/strong><\/span> 0 new_name\n<ul>\n<li>renames session 0 to new_name;<\/li>\n<\/ul>\n<\/li>\n<li>tmux <span style=\"color: #ff0000;\"><strong>new -s<\/strong><\/span> session_name\n<ul>\n<li>creates a new session giving a name to it;<\/li>\n<\/ul>\n<\/li>\n<li>tmux <span style=\"color: #ff0000;\"><strong>kill-session -t<\/strong><\/span> 0\n<ul>\n<li>closes the session 0<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>Resizing panels<\/strong><\/p>\n<ul>\n<li>ctrl+b <strong><span style=\"color: #ff0000;\">:<\/span><\/strong>\n<ul>\n<li>:resize-pane<strong><span style=\"color: #ff0000;\"> -U<\/span><\/strong> 5<\/li>\n<li>:resize-pane<strong><span style=\"color: #ff0000;\"> -D<\/span><\/strong> 10<\/li>\n<li>:resize-pane<span style=\"color: #ff0000;\"><strong> -L<\/strong><\/span> 15<\/li>\n<li>:resize-pane<span style=\"color: #ff0000;\"><strong> -L<\/strong><\/span> 20<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>To <strong>enable the mouse<\/strong> to select and resize panels create the file <strong>~\/.tmux.conf<\/strong> and add <strong>set -g mouse on<\/strong>.<\/p>\n<hr \/>\n<p>The full link of the commands is available at [<a href=\"https:\/\/tmuxcheatsheet.com\/\">Link<\/a>].<\/p>\n<p>An alternative tool for Tmux is called <strong>Screen<\/strong>:<\/p>\n<pre>sudo apt install screen\r\nscreen<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Tmux is a terminal multiplexer that allows multiple terminal sessions to be accessed simultaneously in [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,6],"tags":[],"class_list":["post-1582","post","type-post","status-publish","format-standard","hentry","category-linux","category-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/1582","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1582"}],"version-history":[{"count":9,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/1582\/revisions"}],"predecessor-version":[{"id":2402,"href":"https:\/\/dft.wiki\/index.php?rest_route=\/wp\/v2\/posts\/1582\/revisions\/2402"}],"wp:attachment":[{"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1582"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dft.wiki\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}