0% found this document useful (0 votes)
259 views

Tmux Cheat Sheet

This document is a GitHub gist containing a tmux cheat sheet with shortcuts and commands for using tmux. It provides concise summaries of how to perform common tasks in tmux including starting and attaching sessions, managing windows and panes, copying between panes, and customizing configurations. The cheat sheet also includes discussion comments from other users asking questions and providing suggestions to improve the document.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
259 views

Tmux Cheat Sheet

This document is a GitHub gist containing a tmux cheat sheet with shortcuts and commands for using tmux. It provides concise summaries of how to perform common tasks in tmux including starting and attaching sessions, managing windows and panes, copying between panes, and customizing configurations. The cheat sheet also includes discussion comments from other users asking questions and providing suggestions to improve the document.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

04/02/2016

tmux shortcuts & cheatsheet GitHub

SignupforaGitHubaccount

Instantlysharecode,notes,andsnippets.

Signin

Createagistnow

MohamedAlaa / tmuxcheatsheet.markdown
Lastactive6hoursago

tmuxshortcuts&cheatsheet
tmuxcheatsheet.markdown

tmuxshortcuts&cheatsheet
startnew:
tmux

startnewwithsessionname:
tmuxnewsmyname

attach:
tmuxa#(orat,orattach)

attachtonamed:
tmuxatmyname

listsessions:
tmuxls

killsession:
tmuxkillsessiontmyname

Killallthetmuxsessions:
tmuxls|grep:|cutd.f1|awk'{printsubstr($1,0,length($1)1)}'|xargskill

Intmux,hittheprefix
ctrl+b
(mymodifiedprefixisctrl+a)andthen:

Sessions
:new<CR>newsession
slistsessions
$namesession

Windows(tabs)
https://gist.github.com/MohamedAlaa/2961058#file-tmux-cheatsheet-markdown

1/10

04/02/2016

tmux shortcuts & cheatsheet GitHub

ccreatewindow
wlistwindows
nnextwindow
ppreviouswindow
ffindwindow
,namewindow
&killwindow

Panes(splits)
%verticalsplit
"horizontalsplit
oswappanes
qshowpanenumbers
xkillpane
+breakpaneintowindow(e.g.toselecttextbymousetocopy)
restorepanefromwindow
spacetogglebetweenlayouts
<prefix>q(Showpanenumbers,whenthenumbersshowuptypethekeytogotothatpane)
<prefix>{(Movethecurrentpaneleft)
<prefix>}(Movethecurrentpaneright)
<prefix>ztogglepanezoom

SyncPanes
Youcandothisbyswitchingtotheappropriatewindow,typingyourTmuxprefix(commonlyCtrlBorCtrlA)andthenacolon
tobringupaTmuxcommandline,andtyping:
:setwsynchronizepanes

Youcanoptionallyaddonorofftospecifywhichstateyouwantotherwisetheoptionissimplytoggled.Thisoptionisspecific
toonewindow,soitwontchangethewayyourothersessionsorwindowsoperate.Whenyouredone,toggleitoffagainby
repeatingthecommand.tipsource

ResizingPanes
Youcanalsoresizepanesifyoudontlikethelayoutdefaults.Ipersonallyrarelyneedtodothis,thoughitshandytoknow
how.Hereisthebasicsyntaxtoresizepanes:
PREFIX:resizepaneD(Resizesthecurrentpanedown)
PREFIX:resizepaneU(Resizesthecurrentpaneupward)
PREFIX:resizepaneL(Resizesthecurrentpaneleft)
PREFIX:resizepaneR(Resizesthecurrentpaneright)
PREFIX:resizepaneD20(Resizesthecurrentpanedownby20cells)
PREFIX:resizepaneU20(Resizesthecurrentpaneupwardby20cells)
PREFIX:resizepaneL20(Resizesthecurrentpaneleftby20cells)
PREFIX:resizepaneR20(Resizesthecurrentpanerightby20cells)
PREFIX:resizepanet220(Resizesthepanewiththeidof2downby20cells)
PREFIX:resizepanetL20(Resizesthepanewiththeidof2leftby20cells)

Copymode:
PressingPREFIX[placesusinCopymode.Wecanthenuseourmovementkeystomoveourcursoraroundthescreen.By
default,thearrowkeyswork.wesetourconfigurationfiletouseVimkeysformovingbetweenwindowsandresizingpanes
sowewouldnthavetotakeourhandsoffthehomerow.tmuxhasavimodeforworkingwiththebufferaswell.Toenableit,
addthislineto.tmux.conf:

https://gist.github.com/MohamedAlaa/2961058#file-tmux-cheatsheet-markdown

2/10

04/02/2016

tmux shortcuts & cheatsheet GitHub

setwgmodekeysvi

Withthisoptionset,wecanuseh,j,k,andltomovearoundourbuffer.
TogetoutofCopymode,wejustpresstheENTERkey.Movingaroundonecharacteratatimeisntveryefficient.Sincewe
enabledvimode,wecanalsousesomeothervisibleshortcutstomovearoundthebuffer.
Forexample,wecanuse"w"tojumptothenextwordand"b"tojumpbackoneword.Andwecanuse"f",followedbyany
character,tojumptothatcharacteronthesameline,and"F"tojumpbackwardsontheline.
Functionviemacs
Backtoindentation^Mm
ClearselectionEscapeCg
CopyselectionEnterMw
CursordownjDown
CursorlefthLeft
CursorrightlRight
CursortobottomlineL
CursortomiddlelineMMr
CursortotoplineHMR
CursorupkUp
DeleteentirelinedCu
DeletetoendoflineDCk
Endofline$Ce
Gotoline:g
HalfpagedownCdMDown
HalfpageupCuMUp
NextpageCfPagedown
NextwordwMf
PastebufferpCy
PreviouspageCbPageup
PreviouswordbMb
QuitmodeqEscape
ScrolldownCDownorJCDown
ScrollupCUporKCUp
Searchagainnn
Searchbackward?Cr
Searchforward/Cs
Startofline0Ca
StartselectionSpaceCSpace
TransposecharsCt

Misc
ddetach
tbigclock
?listshortcuts
:prompt

ConfigurationsOptions:
#Mousesupportsettoonifyouwanttousethemouse
*setwgmodemouseoff
*setgmouseselectpaneoff
*setgmouseresizepaneoff
*setgmouseselectwindowoff
#Setthedefaultterminalmodeto256colormode
setgdefaultterminal"screen256color"
#enableactivityalerts
setwgmonitoractivityon
setgvisualactivityon

https://gist.github.com/MohamedAlaa/2961058#file-tmux-cheatsheet-markdown

3/10

04/02/2016

tmux shortcuts & cheatsheet GitHub

#Centerthewindowlist
setgstatusjustifycentre
#Maximizeandrestoreapane
unbindUpbindUpnewwindowdntmp\swappanestmp.1\selectwindowttmp
unbindDown
bindDownlastwindow\swappanestmp.1\killwindowttmp

Resources:
tmux:ProductiveMouseFreeDevelopment
Howtoreorderwindows

Notes:

Changelog:
1411143833002AddedtogglezoomunderPanes(splits)section.
1411143833002AddedSyncPanes
1414276652677AddedKillalltmuxsessions
1438585211173correctedcreateandaddnextandpreviusthanksto@justinjhendrick

RequestanUpdate:
WeNoticedthatourCheatsheetisgrowingandpeoplearecoloberatingtoaddnewtipsandtricks,sopleasetweettome
whatwouldyouliketoaddandlet'smakeitbetter!
Twitter:@MohammedAlaa

ravooricommentedon18Apr2013

UnderthePanessection,shouldn'tthe'o'keycorrespondtoswitchpanesandnotswappanes?

goatfigcommentedon21Apr2013

%isverticalsplit
"ishorizontal
Greatcheatsheet!!!

ehellmancommentedon22Apr2013

Istilldon'tunderstandhowtoresizepanes.ThedefaultprefixisCb,thenwhat?
"PREFIX:resizepaneR(Resizesthecurrentpaneright)",Idon'tgetit.Cananyonehelp?:)

nickdtoddcommentedon24Apr2013

@ehellmanThisconfusedmetoo.YouneedtodoCbthenacolon.Thiswillbringupabarwhereyoucanwriteresizepaneswithwhatever
flagsyouwant.Goodluck!

rawzonecommentedon2Jul2013

https://gist.github.com/MohamedAlaa/2961058#file-tmux-cheatsheet-markdown

4/10

04/02/2016

tmux shortcuts & cheatsheet GitHub


Intmux1.8Cbzdoesazoom/maximizeofactivepane(kindoflikeyourMaximizeandrestoreapanethingy,iguess).

MohamedAlaacommentedon11Aug2013

Owner

@goatfigThanksforthecommentIfixedthethepanehorizontalandverticalshotcuts

MohamedAlaacommentedon11Aug2013

Owner

@ehellmanas@nickdtoddexplainedthe"PREFIX"is
ctrl+b
ordependingonyourtmuxconfigurationsipersonallychangedmyprefixto
be
ctrl+a
muchfaster:)

todgrucommentedon16Aug2013

Reloadthetmuxconfigfilefromshell:

$tmuxsourcefile~/.tmux.conf

Orfromtmuxcommandline:

:sourcefile~/.tmux.conf

Atcoldcommentedon22Nov2013

Awesome!Thanksindeedforthesetips!

anthonybrowncommentedon9Dec2013

Nice!

bernardrcommentedon29Dec2013

Awesome!Thanks!

MohamedAlaacommentedon1Jan2014

Owner

@todgruIpersonallyhaveinmy.tmux.conf

unbindr
bindrsourcefile~/.tmux.confdisplay"Reloaded"

thiswaywheniusethe
PREFIX+r
itloads

joestringercommentedon7Feb2014

Resizingdownseemstorequirethe"D"optionforme(tmux1.6):

PREFIX:resizepaneD20(Resizesthecurrentpanedownby20cells)

kocsenccommentedon11Feb2014

Useiteveryday.AmazingCheatsheet

https://gist.github.com/MohamedAlaa/2961058#file-tmux-cheatsheet-markdown

5/10

04/02/2016

tmux shortcuts & cheatsheet GitHub


jtanmaycommentedon15Mar2014

thanks!helpedalot:)

tdoumascommentedon22Mar2014

Thankyou!Veryuseful

bradleyankromcommentedon2Jun2014

Lookslikethecheatsheetlinkisdead:(http://cheat.errtheblog.com/s/tmux/

MohamedAlaacommentedon4Jun2014

Owner

thanks@bradleyankromIremovedthelinktothecheat:)

i90rrcommentedon21Jun2014

Runningtmux1.8,samebehaviourasdescribedby@joestringer:
"Resizingdownseemstorequirethe"D"optionforme"
Btw,nicelisttohaveathand:)

benoptimuscommentedon8Jul2014

thankyouforsharingthis,veryuseful!!

rushiagrcommentedon12Jul2014

Thanks.Useful.

gavsimcommentedon14Jul2014

Veryuseful,greatlyappreciated.

giangnguyennetcommentedon20Jul2014

It'sstrangeIcan'tresizethepanesintmux.Forexampletoresizeleftapane,Itried:

^b^h

^balt<arrowleft>

^b^<arrowleft>

Thisworks

^b:resizepaneL

butIpreferashortcuttohavingtotypetoomuch.
Anyideas?
ps:Idon'thave~/.tmux.conffile

fkenjicommentedon12Aug2014

@ndgiang84IfyouareonMacOSyoucantrythisout:http://superuser.com/questions/660013/resizingpaneisnotworkingfortmuxonmac

https://gist.github.com/MohamedAlaa/2961058#file-tmux-cheatsheet-markdown

6/10

04/02/2016

tmux shortcuts & cheatsheet GitHub


hienvdcommentedon12Aug2014

Thankforyourtips.
Btw,howcanIchangethedefaultPREFIX(CTRL+B)toanotherkey?

Drive137commentedon13Aug2014

@hlenvdyoucanIdo
setoptiongprefixCa
unbindCb
bindkeyCasendprefix
inthetmux.config
sourcehttp://robots.thoughtbot.com/atmuxcrashcourse

toorehtcommentedon18Aug2014

Thankyouforthisawsomecheatsheet!
Whataboutadding@rawzone'szoomcommandtothePanessection?

ztoggle(zoom)activepanetofullterminalsize

MohamedAlaacommentedon20Sep2014

Owner

UpdatedThefollowing
Addedthetogglezoomcommand
AddedTheSyncPanestrick
Youaskforupdatedbysendingmeatweet@MohammedAlaa

MohamedAlaacommentedon26Oct2014

Owner

UpdatedThefollowing
Addedkillalltmuxsessions
Youaskforupdatedbysendingmeatweet@MohammedAlaa

MrWonderfulcommentedon28Oct2014

Ihadaproblemrunningyourkillallcommandasanalias,butIfoundthisoneworkedwellforme:
aliastmkill='while[$?ne1]dotmuxkillsessiondone'

quizzmastercommentedon5Nov2014

Toresizeapanedown:
PREFIX:resizepaneD20(Resizesthecurrentpanedownby20cells)

shropcommentedon8Dec2014

BestcheatsheetfortmuxIhaveseen.Postedonhttp://shelldevel.net/post/104491784292/mohamedalaatmuxcheatsheetmarkdown

wbinnscommentedon10Jan2015

Thanksforputtingthistogether.:)

https://gist.github.com/MohamedAlaa/2961058#file-tmux-cheatsheet-markdown

7/10

04/02/2016

tmux shortcuts & cheatsheet GitHub

nooitafcommentedon18Jan2015

Showalistofthemessagestmuxdisplayedinthelowerbar:

prefix+~

jacktasiacommentedon19Feb2015

@[email protected]:

Panes(splits)
oswitchtonextpane
Coswappanes

It'seasytoconfusethesebecauseifyouaccidentallykeepholdingcontroldownfromdoingyourprefixthenyou'llbedoingswapinsteadof
next.

rakgeniuscommentedon24Feb2015

Ihaveproblemswitchingbetweenlastusedsession.CaLswitchestolastusedwindowratherthanlastusedsessionwhichisthesameasC
al.Isthereawaytoswitchtolastusedsession?

bobeirasacommentedon20Apr2015

I'mlaughingformyselfaboutthemousesupport,likeachildrenwithanewlollipop,Ijustcan'tbelievehowAWESOMEitis.

nladdcommentedon8May2015

Thanks!ExactlywhatIneeded

LukasMaccommentedon16May2015

WhenincopymodeIfind
Shift+j
and
Shift+k
veryusefull:textscrollsup/downwhilemaintainingcursorposition

VladSemcommentedon23May2015

justtypeinterminalmantmux

zaynetrocommentedon16Jul2015

Cananyonetellmehowtoeditcurrentcommandintmux?IusevibindingsandwanttobeabletoeditthecommandIamcurrentlyspecifying.

thuannvncommentedon20Jul2015

tks

justinjhendrickcommentedon29Jul2015

Considertheseedits?https://gist.github.com/justinjhendrick/51dcf569322675ceeacf
Ichanged"newwindow"to"createwindow",sothatit'seasiertoremember.
Iadded"nextwindow"and"previouswindow".

https://gist.github.com/MohamedAlaa/2961058#file-tmux-cheatsheet-markdown

8/10

04/02/2016

tmux shortcuts & cheatsheet GitHub

grahamgcommentedon4Aug2015

ThanksforthisgreatreferencesheetMohamed!

j0hnsmithcommentedon15Sep2015

Greatcheatsheet,somethingismissing...
"wesetourconfigurationfiletouseVimkeysformovingbetweenwindowsandresizingpanessowewouldnthavetotakeourhandsoffthe
homerow"
Canyouaddthat?

fuzzyweaponcommentedon17Sep2015

Onethingyoucoulddotosupportthegrowingcollaborationismakethisarepoinsteadofagist.
This/will/backfireforpeoplewhousegistidepluginsandtoolstoquicklyaccessdocumentation(aka,usegistsasapersonaldocumentation
platform),butyoucouldeasilysetupaCIworkflowbasedonwebhooksthatpublishestothegistwhenaPRismergedintotherepo.
ThenpeoplecandoPRs,submitrequestsviaissues,reportoutdatedinformationviaissues,etc,howeveryouwantedtohandleit.

chenqingcommentedon17Sep2015

sonice

ttpearscommentedon20Oct2015

Thekillallsessionsdidn'tworkforme,thisdoes:
forsessin$(tmuxls|awk'{FS=":"print$1}'|sed's/://g')dotmuxkillsessiont$sessdone

retrautcommentedon22Oct2015

Thxforthat

gusgardcommentedon4Nov2015

InConfigurationsOptions.Tmux2.1dontsupport
setwgmodemouseoff
setgmouseselectpaneoff
setgmouseresizepaneoff
setgmouseselectwindowoff
insteaduse:
*setgmouseon

Enverexcommentedon13Nov2015

CreatinganewpaneisquitepossiblyoneofthemostimportantcontrolsbutIdon'tseethekeycommandstodoithere?

ChiChoucommentedon15Nov2015

@Enverexdidyoumeansplittingcurrentwindowintomultiplepanes?SeePanes(splits)

dragon788commentedon20Nov2015

https://gist.github.com/MohamedAlaa/2961058#file-tmux-cheatsheet-markdown

9/10

04/02/2016

tmux shortcuts & cheatsheet GitHub


@MohamedAlaaThissoundslikeagreatsetofexercisesforshortcutfoo.com'stmuxsetup.NowthatyoucancreateyourownexercisesI
mayhavetoworkoffthislisttoexpandmyknowledge.

AbhimanyuAryancommentedon23Nov2015

Thanks.

dautovricommentedon23Dec2015

Thankyou!

Ryan4021commentedon30Dec2015

Thisisgreat,thanks!

marzkcommented22daysago

+breakpaneintowindow(e.g.toselecttextbymousetocopy)
iserror.

!Breakthecurrentpaneoutofthewindow.

tmux

FrozenBeardcommented9daysago

Ifoundthisoutbymistake,butdoingCTRL+Dduringatmuxsessionkillsit(Veryhelpful!)

tiborsimoncommented3daysago

PREFIX:resizepanetL20(Resizesthepanewiththeidof2leftby20cells)

Didn'tyoumissthepaneidafterthe
t
?

Signupforfree

tojointhisconversationonGitHub.Alreadyhaveanaccount?Signintocomment

https://gist.github.com/MohamedAlaa/2961058#file-tmux-cheatsheet-markdown

10/10

You might also like