<commit_before>---
layout: post
title:  "My tmux cheatsheet"
tags: commandline
---

If you often work on a remote server, then probably you should give [tmux](https://tmux.github.io) a try.

Here is what I often do when I open my MacBook Pro for work:
1. Open ```iTerm2``` and ```ssh``` to the remote server that I am working on;
2. ```tmux attach``` to the session where I leave off yesterday;
3. I can continue my work instantly.

Below are my most frequently used  commands. List them here for a quick reference.

operation | command
:--- | :---
**session** ||
create | tmux new -s test
show | C-b s
| tmux ls
detach | C-b d
| tmux detach
attach | tmux a -t test
kill | tmux kill-session -t test
rename | C-b $
| tmux rename-session -t test test2
**window** ||
create | C-b c
rename | C-b ,
next | C-b n
previous | C-b p
go to | C-b <number>
list | C-b w
**pane** ||
create horizontally | C-b "
create vertically | C-b %
show number | C-b q
togger panes | C-b o
swap panes | C-b {
| C-b }
move | C-b h
| C-b j
| C-b l
| C-b k
kill | C-b x
break to window | C-b !
**complete list** | C-b ?
<commit_msg>add command to close a window<commit_after>---
layout: post
title:  "My tmux cheatsheet"
tags: commandline
---

If you often work on a remote server, then probably you should give [tmux](https://tmux.github.io) a try.

Here is what I often do when I open my MacBook Pro for work:
1. Open ```iTerm2``` and ```ssh``` to the remote server that I am working on;
2. ```tmux attach``` to the session where I leave off yesterday;
3. I can continue my work instantly.

Below are my most frequently used  commands. List them here for a quick reference.

operation | command
:--- | :---
**session** ||
create | tmux new -s test
show | C-b s
| tmux ls
detach | C-b d
| tmux detach
attach | tmux a -t test
kill | tmux kill-session -t test
rename | C-b $
| tmux rename-session -t test test2
**window** ||
create | C-b c
rename | C-b ,
next | C-b n
previous | C-b p
go to | C-b <number>
list | C-b w
close | C-b &
**pane** ||
create horizontally | C-b "
create vertically | C-b %
show number | C-b q
togger panes | C-b o
swap panes | C-b {
| C-b }
move | C-b h
| C-b j
| C-b l
| C-b k
kill | C-b x
break to window | C-b !
**complete list** | C-b ?

{'fraction_non_alphanumeric': 0.1353887399463807, 'fraction_numerical': 0.004468275245755138, 'mean_word_length': 2.948853615520282, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2870512', 'n_tokens_mistral': 831, 'n_tokens_neox': 818, 'n_words': 361}