Tmux comes from Terminal Multiplexer. It’s used to handle multiple terminal sessions in a single window. Sounds cool if you know how you feel when 10 or 12 terminals lying in your desktop.
To start tmux session type… well tmux in your terminal. If you want to create new session with a name type
tmux new -s mysession

Naming the sessions is crucial sometimes because it gives you a idea what that session was intended to do for you. For creating a new session. See below.
Sessions
Ctrl + b and then :new -s sessionname. Ctrl + b gives us the ability to command to tmux. If we didn’t press that combination we will just end up write in terminal session.
Sessions are like containers. We fill them with our panes. So consider them as buckets for terminals. Apparently only one per window is allowed. Once you create a new session you immediately switch in to that,Detaching the previous one. It doesn’t mean its closed, but hidden underneath the new session. To view sessions in the tmux…
Ctrl + b s

Ctrl + b slist sessionsCtrl + b $name sessions
Windows
Windows are like individual terminal windows. When created it takes the whole terminal emulators space and presents us with a new playground. Windows can be used to isolate processes and also It comes handy when you want to copy something. Because with panes it will copy what’s other panes as well. Try it, you will see.

Ctrl + b ccreates windowCtrl + b wlist windowCtrl + b nnext windowCtrl + b ffind window, Well well well… πCtrl + b ,name windowCtrl + b &kill a windowCtrl + b :swap-windows -s <source window number> -t <destination window number>swaps windows source to destination.-
Ctrl + b :swap-windows -t -1moves window to left by one position -
Ctrl + b :swap-windows -t 1moves the window to given position.
Panes
True power comes with panes.
-
Ctrl + b "Split pane horizontally -
Ctrl + b %Split pane vertically -
Ctrl + b {Move the current pane left -
Ctrl + b }Move the current pane right

That’s it? No. We still have to move around the panes. And sessions.
To switch between panes use Ctrl + b Arrow keys. And go the last used pane Ctrl + b ;. And also you can switch the layout of your terminal sessions with Ctrl + b Spacebar.
Ctrl + b oswap panes. It didn’t swap panes in my experience but switched focus.Ctrl + b qshow pane numbersCtrl + b xkill paneCtrl + b !make the pane to a window. To copy text etc.Ctrl + b :join-pane -t <optional session> :<pane index>restore window as a pane. It’s mess but you can customize it with a key. As for default configuration I don’t see it has a key assigned.Ctrl + b + β or Ctrl + b :resize-pane -U <optional size>Resize pane upwardCtrl + b + β or Ctrl + b :resize-pane -D <optional size>Resize pane downwardCtrl + b + β or Ctrl + b :resize-pane -R <optional size>Resize pane rightCtrl + b + β or Ctrl + b :resize-pane -L <optional size>Resize pane leftCtrl + b xcloses the pane
Selecting text
A problem I had by using tmux is scrolling. Turns out we have to use Vim commands fo that. (Oh boy! ) . To enable Vim commands Ctrl + b :setw -g mode-keys vi then…
Ctrl + b [Enter copy modeCtrl + b PgUpEnter copy mode and go one page upqto quit from copy modeggoto the top lineGgoto the bottom lineArrow upScroll upArrow downScroll downhmove cursor leftjmove cursor downkmove cursor uplmove cursor rightwmove cursor forward one word at a timebmove cursor back one word at a time/search forward?search backwardnnext keyword occurrenceNprevious keyword occurrenceSpacebarStart selectionEscCopy selectionCtrl + b ]Paste contents to buffer_0
Buffers
Ctrl + b :show-buffershow contents of buffer_0Ctrl + b :capture-panecopy entire visible contents to the bufferCtrl + b :list-buffersShow all buffersCtrl + b :choose-bufferShow all buffers and paste selectedCtrl + b :save-buffer buf.txtsaves the buffer to fileCtrl + b :delete-buffer -b 1delete buffer_1