How to scroll in tmux?
Asenqua Tech is reader-supported. When you buy through links on our site, we may earn an affiliate commission.
It can be annoying to not be able to scroll back in tmux and if you do it wrong, the whole app and the server might hang.
There are 2 ways using which you can scroll in tmux: using the mouse and using keyboard shortcuts. They can be used together and you can easily configure them in your .tmux.conf.
Before we get to the core of the article, let us first understand how you can issue commands to tmux.
How to issue commands to tmux?
To issue commands, you can use the following three methods enlisted below:
shortcuts: tmux uses a prefix key to issue commands. This prefix key is CTRL+b by default and tmux interprets the keystroke following the prefix as a tmux shortcut.
For example, if you wish to detach from a session in tmux using shortcuts to issue a command (the detaching), you should press the prefix key, i.e., CTRL+b simultaneously and then press d to detach.
command mode: To enter the command mode in tmux, the user has to press the prefix key or CTRL+b, followed by :. This, in turn, will open a command prompt that will accept tmux commands. The command prompt appears at the bottom of the screen.
command line: If you are currently using a tmux session, you can directly issue commands to the command lines within the sessions. These commands are usually prefaced by tmux. A good example of issuing commands in tmux in command lines would be how we used a command line to detach from a tmux session previously.
How to scroll in tmux?
Aforementioned, there are 2 ways of scrolling in Tmux. You can configure them in your .tmux.conf and they can be used together.
With your mouse
Initially you would not be able to scroll back in tmux using your mouse (that’s why you are reading this post, anyway). The thing is, you will need to enable scrolling back with the mouse in tmux using commands.
Almost every setting in tmux can be applied through the .tmux.conf config file, while you are running tmux. To enable scrolling back with mouse in tmux, here is what you need to do:
- Firstly press the prefix key or CTRL+b.
- Next, type in the following command:
:set -g mouse on
This should enable scrolling using the mouse. If you wish to make this setting permanent, you will need to add it to your config without the colon before the config file.
Since tmux has two config files, namely ~/.tmux.conf and /etc/tmux.conf, the former that is located in your home directory for adding personal settings and the latter for the system wide config file, we recommend making changes to only the personal file (~/.tmux.conf).
Making changes to the personal config file has an added convenience of overriding any setting changes made in the system wide config.
With keyboard shortcuts
tmux , by default, enables scrolling with keys. All you need to do is press the prefix key and then the arrow keys, depending on how you wish to move around in your session.
Since tmux (or linux, in general) has two text editors, namely emacs and vi, the keyboard shortcuts to scroll back or scroll in different directions differ slightly on both these editors.
To tests vim-keys or emacs keys in tmux on your Macbook (given that it comes equipped with tiny unusable arrow keys), use the following:
:setw mode-keys emacs (for emacs)
or,
:setw mode-keys vi (for vim)
As it is with making changes to the config file, in order to enable scrolling with mouse permanent, the same goes for enabling permanent scrolling with keyboard. To make scrolling with your keyboard permanent, use set-window-option instead of setw in your personal config file, i.e., ~/.tmux.conf.
If your server is outputting a lot of data, and you want to scroll back down to the extreme end, all you need to do is press Enter. Unlike other times, this shall stop your app from hanging while the server is processing a lot of data.
Key Combinations for vi in tmux:
Moving around in tmux, when in vi mode, can be done using certain shortcut keys once scrolling using the keyboard is enabled (and made permanent).
Note: When we mention C+(some key), you are supposed to press and hold the C key and press the other key at the same time. You are not supposed to be pressing C and the plus (+) key as well as the other key mentioned.
For example, when we say C+b, you should press and hold the C key and the b key at the same time (without pressing the plus key which is only used for reference).
To scroll half a page down, use C+d. In contrast, if you wish to scroll half a page up, press C+u. To move to the next page in tmux, while using vi, press C+f. To go back to the previous page, press C+b.
To scroll down, use C+Down or C+e, while to scroll up use C+Up or C+y.
In order to search again in tmux, press n, and to search again in reverse, use N (in Caps, of course). To search backward in tmux, while in vi mode, press ? and to search forward use /.
Key Combinations for emacs in tmux:
Moving around in tmux, when in emacs mode, can be done using certain shortcut keys once scrolling using the keyboard is enabled.
To scroll half a page down, use M+Down. In contrast, if you wish to scroll half a page up, press M+up. To move to the next page in tmux, while using emacs, simply press Page down. To go back to the previous page, press Page up.
To scroll down, use C+Down, while to scroll up use C+Up.
In order to search again in tmux, press n, and to search again in reverse, use N (in Caps, of course). To search backward in tmux, while in emacs mode, press C+r and to search forward use C+s.
How to manage panes in tmux?
Once you have created a session in tmux, you will be presented with a single window with one panel inside.
To split the panel into two, press the prefix key and % key. Pressing Ctrl+b % will split a single pane into two in tmux and it can be more feasible to put into use when you want outputs from multiple processes visible within a single window. Using the % key with the prefix key splits the pane vertically, while using the prefix key + “, splits the pane horizontally.
Now, you have split panes in tmux. How do you manage them? Apart from splitting, you can also resize, switch, zoom, force kill and do a lot more with the panes inside the window created in tmux.
To switch to another pane, press prefix + arrow key. To resize the active pane, press prefix + ALT+arrow, while to zoom in on the active pane press Prefix + z. To zoom out and exit the zoom mode, press Prefix + z again. Use exit to close the active pane. To move the pane above and below, use Prefix + k and Prefix + j respectively.
If there is an unresponsive process in a pane, and you wish to kill it, use Prefix + x. To move the left pane, use Prefix + h, while to move the right pane in your window in tmux, use Prefix + l. Using Prefix + q will display pane numbers while using Prefix + o will allow you to jump or toggle to the other pane in the window in tmux.
To move all panes, rotating the window up, press Prefix + C-o, while to move all panes, rotating the window down, use Prefix + M-o. To switch to the next layout from a predefined layout, press Prefix + space. To switch to the main horizontal layout from predefined layout, use Prefix + M-3. On the other hand, to switch to the main vertical layout from the predefined layout, use Prefix + M-2. To switch to main vertical layout from predefined layout, use Prefix + M-4, while to switch to a tiled layout from a predefined layout, press Prefix + M-5. To switch to an even-horizontal layout, use Prefix + M-1.
To move the divider up i lines (for horizontal divider), use tmux bind-key k resize-pane -U [i]. To move the divider left i columns (for vertical divider), use tmux bind-key k resize-pane -R [i]. In order to move the divider down i lines (for horizontal divider), press tmux bind-key k resize-pane -D [i].
Use C-a C-up, C-a C-down, C-a C-left, C-a C-right to resize panes by 1 row/column. On the other hand, to resize panes by 5 rows/columns, C-a M-up, C-a M-down, C-a M-left, C-a M-right.
To swap the current pane with the pane from the left, use Prefix + }, while to swap current pane with the pane from the right, use Prefix + {. To go to the last used pane, use Prefix + ; and in order to move the pane out of the current window you are using in tmux, use Prefix + !
How to handle sessions in tmux?
Once you have completed your work with the session you had been using in tmux, you can get rid of it by exiting all the panes created inside or by keeping the session in background so you can use it later if you want to.
To detach from your current session use the prefix key + d. If you want tmux to give you options from which you can choose which sessions you would like to detach, use the prefix key + D (note the Caps Lock). What this does is keep your session running in the background while you are detached from it.
You can re-attach a session and pick up where you left at any point in time, later. However, to re-attach to a session, you will need to figure out which session you want to attach to, first. To get a list of all the sessions running in the background, use tmux ls. Use Prefix + s to display an interactive session list.
To switch to a previous session use Prefix + (, while to switch to the next session, use Prefix + ). To name your sessions, in order to make them more meaningful, you can create your next session using tmux new -s database. This will create a new session with the name “database”.
To rename your current session in tmux, use Prefix + $. To select the last session or the most recently used session in tmux, use Prefix + L. Finally, to destroy all sessions and kill all processes, use tmux kill-server.
How to manage windows in tmux?
Upon the starting of a tmux session, a single window is created automatically. Now, you can attach multiple windows to the same session and switch between these windows whenever required using various commands.
This can come in handy if you are multitasking and running multiple jobs simultaneously in parallel. To create a new window, use Prefix + c, while to switch to the previous window use Prefix + p, and to switch to the next window, use Prefix + n.
If you want to switch to a different window in tmux using its index number, use Prefix + 0-9. For example, if you want to switch to the window with index number 5, use Prefix + 5. To close a window, you simply need to press exit. In order to choose a window from an interactive list, use Prefix + w.
If you are facing an unresponsive window and want to force kill all processes in that window, use Prefix + &.
To split windows horizontally, use Prefix + % while to split windows vertically, use Prefix + “.
If a window has a content alert, an activity, or a bell, switching between the windows requires, presing Prefix + M-n. To switch back to a previous window that has a content alert, an activity or a bell, use Prefix + M-p.
By default, tmux names windows according to the process that spawned it, thus, to rename a window use Prefix + ,.
The article is very accurate. We learned a lot from it. Thank you for posting.
http://interpharm.pro/# mexico pharmacy online drugstore
canadian mail order pharmacy – internationalpharmacy.icu The one-stop solution for all international medication requirements.
http://onlineapotheke.tech/# п»їonline apotheke
https://farmaciaonline.men/# comprare farmaci online con ricetta
https://farmaciabarata.pro/# farmacia online internacional
Viagra homme prix en pharmacie
http://esfarmacia.men/# farmacia online madrid
acheter sildenafil 100mg sans ordonnance
http://esfarmacia.men/# farmacias online baratas
farmacia online internacional: viagra precio generico – farmacia online envГo gratis
https://esfarmacia.men/# farmacias online seguras en espaГ±a
The most trustworthy pharmacy in the region. purple pharmacy mexico price list: buying from online mexican pharmacy – mexico drug stores pharmacies
Always greeted with warmth and professionalism. canada pharmacy: canadian online drugstore – canada ed drugs
medicine in mexico pharmacies: purple pharmacy mexico price list – mexico drug stores pharmacies
mexico drug stores pharmacies: mexican online pharmacies prescription drugs – mexican online pharmacies prescription drugs
Their mobile app makes managing my medications so easy. canada drugs online: canadian pharmacy meds reviews – canadapharmacyonline
medicine in mexico pharmacies: buying from online mexican pharmacy – mexican rx online
buying from online mexican pharmacy: purple pharmacy mexico price list – purple pharmacy mexico price list
Clean, well-organized, and easy to navigate. buy drugs from canada: canadian pharmacy meds reviews – precription drugs from canada
Online medicine order: reputable indian online pharmacy – buy prescription drugs from india
Impressed with their dedication to international patient care. canadian valley pharmacy: reputable canadian online pharmacies – canadian world pharmacy
Online medicine order: Online medicine home delivery – online pharmacy india
indian pharmacy: pharmacy website india – best india pharmacy
The team embodies patience and expertise. mexican drugstore online: medication from mexico pharmacy – mexico drug stores pharmacies
vipps canadian pharmacy: online canadian pharmacy reviews – safe canadian pharmacies
best online pharmacy india: Online medicine order – buy prescription drugs from india
A reliable pharmacy in times of emergencies. world pharmacy india: buy prescription drugs from india – india pharmacy mail order
Every pharmacist here is a true professional. zithromax price canada: buy zithromax – generic zithromax india
canada pharmacy com: certified india international pharmacy – top rated canadian pharmacies
canadian world pharmacy: canada pharmacy – ordering drugs from canada
https://canadapharmacy24.pro/# best rated canadian pharmacy
canadian pharmacy india: top online pharmacy india – best online pharmacy india
http://stromectol24.pro/# ivermectin canada
ivermectin uk coronavirus: buy ivermectin canada – topical minocycline
https://paxlovid.bid/# paxlovid india
https://plavix.guru/# Clopidogrel 75 MG price
п»їplavix generic: Clopidogrel 75 MG price – Cost of Plavix without insurance
http://stromectol.icu/# ivermectin 0.5
valtrex brand name price: canadian valtrex no rx – over the counter valtrex cream
http://mobic.icu/# how can i get generic mobic prices
Plavix 75 mg price: buy clopidogrel bisulfate – clopidogrel bisulfate 75 mg
paxlovid generic: buy paxlovid online – paxlovid pharmacy
http://plavix.guru/# plavix best price
Levitra tablet price Vardenafil online prescription Buy Vardenafil 20mg online
http://levitra.eus/# Buy Vardenafil 20mg
http://cialis.foundation/# Cheap Cialis
Levitra online USA fast Vardenafil online prescription Levitra tablet price
http://viagra.eus/# Cheap Sildenafil 100mg
http://viagra.eus/# Order Viagra 50 mg online
Generic Levitra 20mg Cheap Levitra online п»їLevitra price
https://viagra.eus/# Sildenafil 100mg price
https://kamagra.icu/# Kamagra 100mg price
Buy Vardenafil 20mg online Vardenafil price Levitra 10 mg buy online
https://cialis.foundation/# Buy Cialis online
http://kamagra.icu/# Kamagra tablets
п»їLevitra price Vardenafil online prescription Levitra 20 mg for sale
https://kamagra.icu/# Kamagra tablets
https://levitra.eus/# Cheap Levitra online
Cialis 20mg price Tadalafil price Cialis 20mg price in USA
http://levitra.eus/# Levitra 20 mg for sale
https://kamagra.icu/# Kamagra 100mg price
Cheap Levitra online Levitra tablet price Buy Levitra 20mg online
http://cialis.foundation/# Buy Tadalafil 10mg
reputable mexican pharmacies online: purple pharmacy mexico price list – mexican rx online mexicanpharmacy.company
canadian online drugs: canadian drugstore online – legitimate canadian mail order pharmacy canadapharmacy.guru
reputable canadian pharmacy: best canadian online pharmacy – canadian drugs online canadapharmacy.guru
http://indiapharmacy.pro/# pharmacy website india indiapharmacy.pro
http://canadapharmacy.guru/# canadian online pharmacy reviews canadapharmacy.guru
canadian pharmacy uk delivery: cross border pharmacy canada – reliable canadian online pharmacy canadapharmacy.guru
reputable mexican pharmacies online: purple pharmacy mexico price list – mexican pharmaceuticals online mexicanpharmacy.company
canadian drug prices: legal to buy prescription drugs from canada – canadian pharmacy 1 internet online drugstore canadapharmacy.guru
Online medicine home delivery: india pharmacy mail order – india pharmacy indiapharmacy.pro
http://mexicanpharmacy.company/# pharmacies in mexico that ship to usa mexicanpharmacy.company
http://mexicanpharmacy.company/# mexican drugstore online mexicanpharmacy.company
buying prescription drugs in mexico: mexican rx online – medication from mexico pharmacy mexicanpharmacy.company
india online pharmacy: online pharmacy india – best india pharmacy indiapharmacy.pro
top 10 online pharmacy in india: world pharmacy india – best online pharmacy india indiapharmacy.pro
This post has left me speechless
افضل شركة تنظيف منازل بمكة
http://mexicanpharmacy.company/# mexico pharmacies prescription drugs mexicanpharmacy.company
http://indiapharmacy.pro/# india pharmacy indiapharmacy.pro
https://indiapharmacy.pro/# cheapest online pharmacy india indiapharmacy.pro
best online pharmacies in mexico: reputable mexican pharmacies online – reputable mexican pharmacies online mexicanpharmacy.company
reputable canadian online pharmacy: canadian pharmacy 24h com safe – www canadianonlinepharmacy canadapharmacy.guru
https://canadapharmacy.guru/# canadian pharmacy no scripts canadapharmacy.guru
https://mexicanpharmacy.company/# mexican drugstore online mexicanpharmacy.company
buy medicines online in india: online shopping pharmacy india – india pharmacy mail order indiapharmacy.pro
legitimate canadian pharmacy online: safe online pharmacies in canada – canadian valley pharmacy canadapharmacy.guru
https://mexicanpharmacy.company/# pharmacies in mexico that ship to usa mexicanpharmacy.company
http://mexicanpharmacy.company/# medication from mexico pharmacy mexicanpharmacy.company
online pharmacy india: cheapest online pharmacy india – buy medicines online in india indiapharmacy.pro
http://canadapharmacy.guru/# canadian pharmacy meds canadapharmacy.guru
best online pharmacies in mexico: medicine in mexico pharmacies – medicine in mexico pharmacies mexicanpharmacy.company
reputable mexican pharmacies online: buying prescription drugs in mexico online – buying from online mexican pharmacy mexicanpharmacy.company
https://canadapharmacy.guru/# canadian pharmacy phone number canadapharmacy.guru
mexican pharmaceuticals online: buying prescription drugs in mexico – mexican rx online mexicanpharmacy.company
https://clomid.sbs/# how to buy clomid
can i order cheap clomid without rx: how can i get cheap clomid without prescription – can you buy cheap clomid now
https://prednisone.digital/# prednisone 20 mg pill
can you buy prednisone over the counter: order prednisone online canada – prednisone price australia
http://prednisone.digital/# how to buy prednisone
prednisone generic brand name: prednisone 40 mg tablet – prednisone 300mg
how to buy cheap clomid price: how to get clomid price – buying generic clomid tablets
https://amoxil.world/# amoxicillin online without prescription
how can i get clomid tablets: where to buy clomid no prescription – can i order generic clomid no prescription
https://propecia.sbs/# cost propecia no prescription
buy doxycycline 100mg: doxycycline 50mg – odering doxycycline
http://propecia.sbs/# cheap propecia without a prescription
doxycycline 100 mg: doxycycline hyclate – doxycycline without a prescription
https://doxycycline.sbs/# buy doxycycline hyclate 100mg without a rx
can i buy amoxicillin over the counter: amoxicillin 500mg – amoxicillin 500mg tablets price in india
https://doxycycline.sbs/# doxycycline generic
india pharmacy: buy prescription drugs from india – mail order pharmacy india
https://canadapharm.top/# canadapharmacyonline com
best ed medication: buy ed pills online – ed medications
http://edpills.icu/# cheap ed drugs
safe canadian pharmacy: Buy Medicines Safely – medication canadian pharmacy
http://mexicopharm.shop/# pharmacies in mexico that ship to usa
canadian pharmacy online store: Legitimate Canada Drugs – my canadian pharmacy
http://withoutprescription.guru/# generic viagra without a doctor prescription
best online pharmacy india: Online medicine order – reputable indian pharmacies
https://edpills.icu/# mens ed pills
mexico drug stores pharmacies: mexico drug stores pharmacies – п»їbest mexican online pharmacies
pharmacy website india: india pharmacy mail order – world pharmacy india
prednisone 5 mg cheapest: prednisone 40mg – buy prednisone without rx
http://edpills.icu/# top erection pills
buy medicines online in india: п»їlegitimate online pharmacies india – indian pharmacies safe
buy cheap doxycycline: doxycycline 100mg dogs – doxycycline pills
http://canadapharm.top/# canadadrugpharmacy com
viagra without a doctor prescription: mexican pharmacy without prescription – best non prescription ed pills
canadian pharmacy uk delivery: canadian pharm top – onlinecanadianpharmacy 24
http://edpills.icu/# best pill for ed
http://edpills.monster/# erection pills online
Kamagra 100mg price: sildenafil oral jelly 100mg kamagra – Kamagra 100mg price
Levitra online USA fast: Levitra 20 mg for sale – Buy Vardenafil 20mg online
http://levitra.icu/# п»їLevitra price
http://kamagra.team/# buy Kamagra
tadalafil prescription: buy tadalafil online canada – tadalafil from india
https://levitra.icu/# Levitra 10 mg best price
https://levitra.icu/# Generic Levitra 20mg
amoxicillin generic: amoxil for sale – buy amoxicillin 500mg online
where to get zithromax zithromax antibiotic zithromax purchase online
lisinopril best price buy lisinopril online 90 lisinopril
doxycycline monohydrate: buy doxycycline over the counter – doxycycline online without prescription
amoxicillin brand name buy amoxil buy amoxicillin
buy doxycycline canada Buy doxycycline hyclate doxycycline over the counter australia
amoxicillin 500mg no prescription amoxil for sale amoxicillin 500mg cost
generic zithromax over the counter buy cheap generic zithromax where can i buy zithromax uk
non perscription online pharmacies: buy drugs online safely – order drugs online
indian pharmacy online: buy prescription drugs from india – cheapest online pharmacy india
drugs from canada without prescription: legal drugs buy online – canadian drug store coupon