일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
- Installation
- mongodb
- Node.js
- Windows10
- node.js설치
- MYSQL
- Projection
- 맥
- 맥에 파이썬 설치
- query
- util.inspect
- collection.find
- 파이썬3
- console.log
- mongodb nodejs driver
- mongo-native
- mongoDB [Object]
- nodejs mongodb
- [Object]
- pip jupyter
- homebrew
- Jupyter notebook
- node.js 연동
- python3
- MacOS
- Today
- Total
Bon Voyage
Using tmux on macOS Catalina 본문
Introduction
tmux
is a terminal multiplexer.
It enables a number of terminals to be created, accessed, and controlled from a single screen. tmux
may be detached from a screen and continue running in the background, then later reattached.
Using tmux, you can keep the remotely connected session even though you are not in front of your computer, which is convenient when you have to call it a day but there are still more things to be done.
Installation
brew install tmux
Start a session
tmux new -s <session_name>
- Just typing
tmux
will by default start with one window and a single panel inside. - Any number of
tmux
instances may connect to the same session, and any number of windows may be present in the same session. - Once all sessions are killed,
tmux
exits.
Commands in tmux
All commands in tmux are triggered by a prefix key followed by a command key.
- By default, tmux uses
C-b
as prefix key. (press theCtrl
andb
keys at the same time.)- In this emacs notation
C-
means “press and hold theCtrl
key”
- In this emacs notation
- For example,
C-b "
means pressctrl
+b
then type"
Customizing commands
You can create your own configuration file to custom command key binding
By default, tmux loads the system configuration file from /usr/local/etc/tmux.conf
, if present, then looks for a user configuration file at ~/.tmux.conf
. You can check the detail of it in the manual page. Just type man tmux
# make your own configuration file, you can choose where to store the file
vim ~/.tmux.conf
# then write your configuration...
# '.' before 'tmux' means it is hidden file
Example of tmux.conf
file
Below is some of custom configuration! You can add or change bindings for the command
-
Note that all the command keys you bound, it should be coupled with
C-b
(prefix key)# split panes using | and - bind | split-window -h bind - split-window -v unbind '"' unbind % # reload config file (change file location to your the tmux.conf you want to use) bind r source-file ~/.tmux.conf # Enable mouse mode (tmux 2.1 and above) set -g mouse on
Here, command keys I've changed are:
- splitting panes with
|
for vertical split,-
for horizontal split. - reloading the config file by
r
- set mouse mode on (you can change pane size or choose windows with your mouse)
If you want more customization
-
You can even change the prefix key
C-b
as you prefer. -
You can search for more configuration! The link below will help you with this.
Panes
Splitting panes commands
splitting a left and a right pane is **C-b %
* , top and bottom is **C-b "
** by default.
*(Custom keys are C-b |
and C-b -
respectively, if you have set the configuration file.)
Navigating and Closing the pane
- navigation:
C-b <arrow key>
:ctrl
+b
+<arrow key>
- full screen :
C-b z
C-b z
again to shrink it back to its previous size
Windows
Windows in tmux is like creating new virtual desktops.
Windows are presented on the status bar.
- Creating new window:
C-b c
- Switching between windows:
C-b p
(previous window)C-b n
(next window)C-b <window number>
(specific window)
- Rename current window's name:
C-b ,
Closing panes and windows
exit
or just press ctrl
+ d
Session Handling
You can either kill get rid of the session when you're done with it or keep the session in the background for later reuse.
Detaching session
- To detach your current session use
C-b d
, useC-b D
to select which of your sessions you want to detach. - This will detach your session but will leave you’re doing in that session running in the background.
- When you detach, you'll see the message that it's detached
Check running sessions
You can see the check running sessions with
tmux ls
tmux has-session [-t target_session]
Attaching session by session number
To connect to that session you start tmux again but this time tell it which session to attach to:
tmux attach -t <session_number> | <session_name>
- For example,
-t 0
that tells tmux to attach session 0. - "0" is the first part of your
tmux ls
output.
Attaching session by session name
You can give your sessions names or rename them as you prefer.
- Create your next session with a preferred name:
**tmux new -s <session_name>**
- Rename your existing session :
**tmux rename-session -t <session_number> <session_name>**
Then the next time you attach to that session you simply use **tmux attach -t <session_name>
**
Killing sessions
tmux kill-session #kill the most recently created session
tmux kill-session -t <session_number> | <session_name>
or you can kill server, which will kill all the sessions on it.
tmux kill-server
Useful short-cuts
C-a
: go to the beginning of the line- with prefix key,
C-b
$
: Rename the current session.&
: Kill the current window.'
: Prompt for a window index to select.{
or}
: swap panesalt
(option
) + : change pane size?
: see all available commands
Check the full list of command keys on the link below:
References
'설치' 카테고리의 다른 글
macOS에 virtualenv 설치하고 사용하기 (0) | 2019.12.30 |
---|---|
macOS Catalina에 python 3, pip 설치하기 (0) | 2019.12.30 |
Windows에서 Node.js 설치하기 (0) | 2019.07.17 |
MacOS에 Jupyter 설치하기 (0) | 2019.07.13 |
MacOS에 Homebrew로 python3 설치하기 (0) | 2019.07.13 |