\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{bechtold} \pdfinfo{ /Title (tmux-the-terminal-multiplexer.pdf) /Creator (Cheatography) /Author (bechtold) /Subject (tmux the terminal multiplexer Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{0800FF} \definecolor{LightBackground}{HTML}{EFEFFF} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{tmux the terminal multiplexer Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{bechtold} via \textcolor{DarkBackground}{\uline{cheatography.com/7346/cs/1134/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}bechtold \\ \uline{cheatography.com/bechtold} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Published 8th July, 2013.\\ Updated 12th May, 2016.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{x{2.4885 cm} x{2.4885 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{General}} \tn % Row 0 \SetRowColor{LightBackground} Control-a & prefix key (default C-b) \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} : & interactive dialog (promt) \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} d & detach session \tn % Row Count 5 (+ 1) % Row 3 \SetRowColor{white} tmux restore & restore session \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} : source-file \textasciitilde{}/.tmux.conf & reload .tmux.conf \tn % Row Count 8 (+ 2) % Row 5 \SetRowColor{white} t & big clock \tn % Row Count 9 (+ 1) % Row 6 \SetRowColor{LightBackground} ? & list bindings \tn % Row Count 10 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{2.18988 cm} x{2.78712 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Session handling}} \tn % Row 0 \SetRowColor{LightBackground} tmux & start new \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} tmux new -s myname & start new with name \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} tmux a -t & reattach session (or at, or attach) \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} tmux a -t myname & reattach named session \tn % Row Count 6 (+ 1) % Row 4 \SetRowColor{LightBackground} tmux ls & list sessions \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} tmux kill-session -t myname & kill named session \tn % Row Count 9 (+ 2) % Row 6 \SetRowColor{LightBackground} :new & new session \tn % Row Count 10 (+ 1) % Row 7 \SetRowColor{white} s & list sessions \tn % Row Count 11 (+ 1) % Row 8 \SetRowColor{LightBackground} \$ & name session \tn % Row Count 12 (+ 1) % Row 9 \SetRowColor{white} tmux kill-server & kill server and all sessions \tn % Row Count 14 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.64772 cm} x{1.69349 cm} x{1.23579 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{customizing tmux}} \tn % Row 0 \SetRowColor{LightBackground} set-option -g prefix C-a & rebind the Ctrl-b prefix to Ctrl-a & -g for global =\textgreater{} every window \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} bind-key C-a last-window & switch to last active window & To use hit Ctrl-a twice \tn % Row Count 6 (+ 3) % Row 2 \SetRowColor{LightBackground} unbind \% & Remove default split binding & \tn % Row Count 8 (+ 2) % Row 3 \SetRowColor{white} bind | split-window -h & bind vertical splitting to | & \tn % Row Count 10 (+ 2) % Row 4 \SetRowColor{LightBackground} bind – split-window -v & bind horizontal splitting to - & \tn % Row Count 13 (+ 3) % Row 5 \SetRowColor{white} \mymulticolumn{3}{x{5.377cm}}{set -g status-bg black} \tn % Row Count 14 (+ 1) % Row 6 \SetRowColor{LightBackground} \mymulticolumn{3}{x{5.377cm}}{set -g status-fg white} \tn % Row Count 15 (+ 1) % Row 7 \SetRowColor{white} set -g status-left '\#{[}fg=green{]}\#H' & beginning of statusbar hostname in green & \tn % Row Count 18 (+ 3) % Row 8 \SetRowColor{LightBackground} \seqsplit{set-window-option} -g \seqsplit{window-status-current-bg} red & current window shown in red & \tn % Row Count 22 (+ 4) % Row 9 \SetRowColor{white} set -g status-right '\#{[}fg=yellow{]}\#(uptime | cut -d "," -f 2-)' & number of users and load average for computer & \tn % Row Count 27 (+ 5) % Row 10 \SetRowColor{LightBackground} setw -g \seqsplit{monitor-activity} on & highlight window with new activity & \tn % Row Count 30 (+ 3) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.64772 cm} x{1.69349 cm} x{1.23579 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{5.377cm}}{\bf\textcolor{white}{customizing tmux (cont)}} \tn % Row 11 \SetRowColor{LightBackground} set -g \seqsplit{visual-activity} on & show info on new activity & \tn % Row Count 2 (+ 2) % Row 12 \SetRowColor{white} setw -g \seqsplit{automatic-rename} on & set window title to current command & \tn % Row Count 5 (+ 3) \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.79172 cm} x{3.18528 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Basic Window Handling}} \tn % Row 0 \SetRowColor{LightBackground} c & new window \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} , & rename window \tn % Row Count 2 (+ 1) % Row 2 \SetRowColor{LightBackground} n & next window \tn % Row Count 3 (+ 1) % Row 3 \SetRowColor{white} p & previous window \tn % Row Count 4 (+ 1) % Row 4 \SetRowColor{LightBackground} l & previously selected window \tn % Row Count 6 (+ 2) % Row 5 \SetRowColor{white} w & list all windows \tn % Row Count 7 (+ 1) % Row 6 \SetRowColor{LightBackground} {[}0-9{]} & move to window number {[}0-9{]} \tn % Row Count 9 (+ 2) % Row 7 \SetRowColor{white} f {[}window name{]} & find window \tn % Row Count 11 (+ 2) % Row 8 \SetRowColor{LightBackground} : list-windows & list windows \tn % Row Count 12 (+ 1) % Row 9 \SetRowColor{white} \& & kill window \tn % Row Count 13 (+ 1) % Row 10 \SetRowColor{LightBackground} . & move window \tn % Row Count 14 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{X} \SetRowColor{DarkBackground} \mymulticolumn{1}{x{5.377cm}}{\bf\textcolor{white}{Advanced Window Handling}} \tn % Row 0 \SetRowColor{LightBackground} \mymulticolumn{1}{x{5.377cm}}{move-window {[} −d{]} {[} −s src-window{]} {[} −t dst-window{]}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \mymulticolumn{1}{x{5.377cm}}{swap-window {[} -d{]} {[} -s src-window{]} {[} -t dst-window{]}} \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}-} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.14471 cm} x{3.83229 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Pane Window Handling}} \tn % Row 0 \SetRowColor{LightBackground} :joinp -s :2 & move window 2 into a new pane in the current window \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} :joinp -t :1 & move the current pane into a new pane in window 1 \tn % Row Count 4 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.9908 cm} x{2.9862 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Vim like commands}} \tn % Row 0 \SetRowColor{LightBackground} bind s split-window -v & splitting \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} bind v split-window -h & splitting \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} bind h select-pane -L & motion keys \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} bind j select-pane -D & motion keys \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} bind k select-pane -U & motion keys \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} bind l select-pane -R & motion keys \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} setw -g mode-keys vi & vim motion keys while in copy mode \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} bind - resize-pane -D 1 & resize pane down by 1 \tn % Row Count 16 (+ 2) % Row 8 \SetRowColor{LightBackground} bind + resize-pane -U 1 & resize pane up by 1 \tn % Row Count 18 (+ 2) % Row 9 \SetRowColor{white} bind \textless{} resize-pane -L 1 & resize pane to left by 1 \tn % Row Count 20 (+ 2) % Row 10 \SetRowColor{LightBackground} bind \textgreater{} resize-pane -R 1 & resize pane to right by 1 \tn % Row Count 22 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.29402 cm} x{3.68298 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{Basic Pane Handling}} \tn % Row 0 \SetRowColor{LightBackground} v & split vertically \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} : \seqsplit{split-window} & split horizontally \tn % Row Count 3 (+ 2) % Row 2 \SetRowColor{LightBackground} o & go to next pane (down-pane) \tn % Row Count 4 (+ 1) % Row 3 \SetRowColor{white} q & show pane number, press number to go to \tn % Row Count 6 (+ 2) % Row 4 \SetRowColor{LightBackground} \{ & move current pane left \tn % Row Count 7 (+ 1) % Row 5 \SetRowColor{white} \} & move current pane right \tn % Row Count 8 (+ 1) % Row 6 \SetRowColor{LightBackground} x & kill pane \tn % Row Count 9 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{p{0.62655 cm} x{1.6708 cm} p{0.4177 cm} x{1.46195 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{5.377cm}}{\bf\textcolor{white}{Advanced Pane Handling}} \tn % Row 0 \SetRowColor{LightBackground} \textless{}space\textgreater{} & toggle through layouts & & \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} \seqsplit{break-pane} & take a pane and make own window & -d & focus stays \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} \seqsplit{resize-pane} & resize pane down & (20) & by 20 cells \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} & & -U (20) & resize up (by 20 cells) \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} & & -L (20) & resize left (by 20 cells) \tn % Row Count 10 (+ 2) % Row 5 \SetRowColor{white} & & -R (20) & resize right (by 20 cells) \tn % Row Count 12 (+ 2) % Row 6 \SetRowColor{LightBackground} & & -t 2 20 & pane with id 2 down by 20 \tn % Row Count 14 (+ 2) % Row 7 \SetRowColor{white} & & ... & \tn % Row Count 15 (+ 1) \hhline{>{\arrayrulecolor{DarkBackground}}----} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.29402 cm} x{3.68298 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{5.377cm}}{\bf\textcolor{white}{tmux info}} \tn % Row 0 \SetRowColor{LightBackground} ? & list bindings \tn % Row Count 1 (+ 1) % Row 1 \SetRowColor{white} Set pane title & printf '\textbackslash{}033{]}2;\%s\textbackslash{}033\textbackslash{}\textbackslash{}' 'title goes here' \tn % Row Count 3 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}