tmux configuration #1
This commit is contained in:
parent
a8e36b4237
commit
a1741931c8
BIN
content/images/tmux.png
Normal file
BIN
content/images/tmux.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 69 KiB |
BIN
content/images/tmux_fullsize.png
Normal file
BIN
content/images/tmux_fullsize.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 187 KiB |
189
content/my-tmux-conf.md
Normal file
189
content/my-tmux-conf.md
Normal file
@ -0,0 +1,189 @@
|
||||
Title: My tmux configuration
|
||||
Date: 2016-02-02
|
||||
Category: Configuration example
|
||||
|
||||
[tmux](https://tmux.github.io/) is a terminal mutiplexer. It lets you have multiples shells running in a single terminal emulator window and it keeps those shells running in the background should you need to close your terminal emulator.
|
||||
|
||||
I've played around with the configuration quite a bit to find settings that suit my needs. Here's what it ended up looking like :
|
||||
|
||||
[![tmux](images/tmux.png)](images/tmux_fullsize.png)
|
||||
|
||||
This screenshot was done on Mac OS X, using the Terminal app and this [Solarized theme](https://github.com/tomislav/osx-terminal.app-colors-solarized).
|
||||
|
||||
I figured I'd share my tmux configuration here !
|
||||
|
||||
## Installing tmux
|
||||
|
||||
tmux is available on Debian. I suggest using the [jessie backports](https://packages.debian.org/jessie-backports/tmux) version :
|
||||
|
||||
`apt -t jessie-backports install tmux`
|
||||
|
||||
tmux is also available on Mac OS X using [brew](http://brew.sh/) :
|
||||
|
||||
`brew install tmux`
|
||||
|
||||
## tmux.conf
|
||||
|
||||
I used screen before tmux, so I configured the prefix key on C-a instead of C-b. tmux has the advantage of being *much* simpler to configure than screen.
|
||||
|
||||
If you want to use this configuration, simply copy the following in ~/.tmux.conf. This file is read by default when tmux starts.
|
||||
|
||||
If you simply want to try it out, copy it in a file somewhere else and have tmux load with the -f parameter (`tmux -f ~/tmux-test.conf`).
|
||||
|
||||
```
|
||||
# use utf8
|
||||
set -g utf8
|
||||
set-option -g status-utf8 on
|
||||
set-window-option -g utf8 on
|
||||
|
||||
# do not wait on esc key
|
||||
set-option -g escape-time 0
|
||||
|
||||
# completely disable automatic rename
|
||||
set-window-option -g automatic-rename off
|
||||
|
||||
# basic settings
|
||||
set -g default-terminal "screen-256color"
|
||||
set -g aggressive-resize off
|
||||
set-window-option -g xterm-keys on
|
||||
#set-window-option -g mode-mouse off
|
||||
|
||||
# command history
|
||||
set -g history-limit 10000
|
||||
|
||||
# messages
|
||||
set -g message-bg default
|
||||
set -g message-fg red
|
||||
|
||||
# no visual activity
|
||||
set -g visual-activity off
|
||||
set -g visual-bell off
|
||||
|
||||
# status bar
|
||||
set-option -g status-justify centre
|
||||
set-option -g status-bg default
|
||||
set-option -g status-fg blue
|
||||
set-option -g status-interval 5
|
||||
set-option -g status-left-length 30
|
||||
set-option -g status-left '#[fg=red][ #[fg=white]#H #[fg=red]]#[default]'
|
||||
set-option -g status-right '#[fg=red][ #[fg=white]%R %d/%m #[fg=red]]#[default]'
|
||||
|
||||
# modes
|
||||
set-option -g mode-bg default
|
||||
set-option -g mode-fg blue
|
||||
|
||||
# inactive window format
|
||||
set-window-option -g window-status-format '#I:#W#F'
|
||||
set-window-option -g monitor-activity on
|
||||
#set-window-option -g monitor-content on # not available in tmux 2.0
|
||||
|
||||
# activity in a window
|
||||
set-window-option -g window-status-activity-attr dim
|
||||
set-window-option -g window-status-activity-bg default
|
||||
set-window-option -g window-status-activity-fg yellow
|
||||
|
||||
# content in a window # not available in tmux 2.0
|
||||
#set-window-option -g window-status-content-attr dim
|
||||
#set-window-option -g window-status-content-bg default
|
||||
#set-window-option -g window-status-content-fg red
|
||||
|
||||
# active window format
|
||||
set-window-option -g window-status-current-fg white
|
||||
set-window-option -g window-status-current-bg default
|
||||
set-window-option -g window-status-current-format '#[fg=red](#[default]#I:#W#F#[fg=red])#[default]'
|
||||
|
||||
# reload tmux configuration
|
||||
unbind r
|
||||
bind r source-file ~/.tmux.conf \; display "Configuration reloaded!"
|
||||
|
||||
# Screen-like keybinds
|
||||
unbind C-b
|
||||
set -g prefix ^A
|
||||
set -g prefix2 ^Q
|
||||
bind a send-prefix
|
||||
bind q send-prefix
|
||||
|
||||
unbind c
|
||||
bind c new-window
|
||||
unbind ^C
|
||||
bind ^C new-window
|
||||
|
||||
unbind n
|
||||
bind n next-window
|
||||
unbind ^N
|
||||
bind ^N next-window
|
||||
|
||||
unbind A
|
||||
bind A command-prompt "rename-window %%"
|
||||
|
||||
unbind p
|
||||
bind p previous-window
|
||||
unbind ^P
|
||||
bind ^P previous-window
|
||||
|
||||
unbind a
|
||||
bind a last-window
|
||||
unbind ^A
|
||||
bind ^A last-window
|
||||
|
||||
unbind [
|
||||
bind Escape copy-mode
|
||||
|
||||
unbind w
|
||||
bind w list-windows
|
||||
|
||||
unbind k
|
||||
bind k confirm-before "kill-window"
|
||||
|
||||
unbind l
|
||||
bind l refresh-client
|
||||
|
||||
unbind '"'
|
||||
bind '"' choose-window
|
||||
```
|
||||
|
||||
## Aliases
|
||||
|
||||
I also use two functions with tmux (in ~/.bash_aliases).
|
||||
|
||||
The first one creates a new "mytmux" tmux session if one doesn't exist yet, opens 10 shells and selects the first one.
|
||||
|
||||
```
|
||||
mytmux() {
|
||||
tmux has-session -t mytmux
|
||||
if [ $? != 0 ]; then
|
||||
tmux new-session -s mytmux -n $(hostname) -d
|
||||
tmux new-window -t mytmux:1 -n $(hostname)
|
||||
tmux new-window -t mytmux:2 -n $(hostname)
|
||||
tmux new-window -t mytmux:3 -n $(hostname)
|
||||
tmux new-window -t mytmux:4 -n $(hostname)
|
||||
tmux new-window -t mytmux:5 -n $(hostname)
|
||||
tmux new-window -t mytmux:6 -n $(hostname)
|
||||
tmux new-window -t mytmux:7 -n $(hostname)
|
||||
tmux new-window -t mytmux:8 -n $(hostname)
|
||||
tmux new-window -t mytmux:9 -n $(hostname)
|
||||
tmux select-window -t mytmux:0
|
||||
fi
|
||||
tmux attach -t mytmux
|
||||
}
|
||||
```
|
||||
|
||||
The second one changes the tmux window name whenever I ssh to a remote host, and switches the window name back to the name of my computer when I logout from the host.
|
||||
|
||||
```
|
||||
if [ -n "$TMUX" ]; then
|
||||
ssh() {
|
||||
if [ $# -le 2 ]; then
|
||||
tmux rename-window "${@: -1}"
|
||||
command ssh "$@"
|
||||
tmux rename-window "$(hostname)"
|
||||
else
|
||||
command ssh "$@"
|
||||
fi
|
||||
}
|
||||
fi
|
||||
```
|
||||
|
||||
## Conclusion
|
||||
|
||||
That's all ! As always, please do leave a comment if you've found something useful in this article !
|
@ -89,6 +89,8 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
|
||||
<dl>
|
||||
<dt>Tue 02 February 2016</dt>
|
||||
<dd><a href="https://captainark.net/my-tmux-configuration.html">My tmux configuration</a></dd>
|
||||
<dt>Sun 31 January 2016</dt>
|
||||
<dd><a href="https://captainark.net/debian-updates-with-ansible.html">Debian updates with Ansible</a></dd>
|
||||
<dt>Sun 31 January 2016</dt>
|
||||
|
@ -88,6 +88,18 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
|
||||
<div class="post-preview">
|
||||
<a href="https://captainark.net/my-tmux-configuration.html" rel="bookmark" title="Permalink to My tmux configuration">
|
||||
<h2 class="post-title">
|
||||
My tmux configuration
|
||||
</h2>
|
||||
</a>
|
||||
<p><a href="https://tmux.github.io/">tmux</a> is a terminal mutiplexer. It lets you have multiples shells running in a single terminal ...
|
||||
<p class="post-meta">Posted by
|
||||
<a href="https://captainark.net/author/antoine-joubert.html">Antoine Joubert</a>
|
||||
on Tue 02 February 2016
|
||||
</p>
|
||||
<p>There are <a href="https://captainark.net/my-tmux-configuration.html#disqus_thread">comments</a>.</p> </div>
|
||||
<div class="post-preview">
|
||||
<a href="https://captainark.net/debian-updates-with-ansible.html" rel="bookmark" title="Permalink to Debian updates with Ansible">
|
||||
<h2 class="post-title">
|
||||
|
@ -91,7 +91,7 @@
|
||||
<div class="post-preview">
|
||||
<a href="https://captainark.net/author/antoine-joubert.html" rel="bookmark">
|
||||
<h2 class="post-title">
|
||||
Antoine Joubert (4)
|
||||
Antoine Joubert (5)
|
||||
</h2>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -90,6 +90,7 @@
|
||||
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
|
||||
<ul>
|
||||
<li><a href="https://captainark.net/category/ansible-playbook.html">Ansible Playbook</a></li>
|
||||
<li><a href="https://captainark.net/category/configuration-example.html">Configuration example</a></li>
|
||||
<li><a href="https://captainark.net/category/script.html">Script</a></li>
|
||||
<li><a href="https://captainark.net/category/tutorial.html">Tutorial</a></li>
|
||||
</ul>
|
||||
|
211
output/category/configuration-example.html
Normal file
211
output/category/configuration-example.html
Normal file
@ -0,0 +1,211 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
|
||||
<title>Sysadmining. All day. Every day. - Articles in the Configuration example category</title>
|
||||
|
||||
<link href="https://captainark.net/rss.xml" type="application/atom+xml" rel="alternate" title="Sysadmining. All day. Every day. Full Atom Feed" />
|
||||
|
||||
<!-- Bootstrap Core CSS -->
|
||||
<link href="https://captainark.net/theme/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
<!-- Custom CSS -->
|
||||
<link href="https://captainark.net/theme/css/clean-blog.min.css" rel="stylesheet">
|
||||
|
||||
<!-- Code highlight color scheme -->
|
||||
<link href="https://captainark.net/theme/css/code_blocks/github.css" rel="stylesheet">
|
||||
|
||||
|
||||
<!-- Custom Fonts -->
|
||||
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
|
||||
<link href='https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
|
||||
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
|
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
||||
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
<meta property="og:locale" content="">
|
||||
<meta property="og:site_name" content="Sysadmining. All day. Every day.">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- Navigation -->
|
||||
<nav class="navbar navbar-default navbar-custom navbar-fixed-top">
|
||||
<div class="container-fluid">
|
||||
<!-- Brand and toggle get grouped for better mobile display -->
|
||||
<div class="navbar-header page-scroll">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="https://captainark.net/">Sysadmining. All day. Every day.</a>
|
||||
</div>
|
||||
|
||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="/">Homepage</a></li>
|
||||
<li><a href="/rss.xml">RSS</a></li>
|
||||
<li><a href="/categories.html">Categories</a></li>
|
||||
|
||||
<li><a href="https://captainark.net/pages/about.html">About</a></li>
|
||||
<li><a href="https://captainark.net/pages/resume.html">Resume</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- /.navbar-collapse -->
|
||||
</div>
|
||||
<!-- /.container -->
|
||||
</nav>
|
||||
|
||||
<!-- Page Header -->
|
||||
<header class="intro-header" style="background-image: url('/bg.png')">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
|
||||
<div class="post-heading">
|
||||
<h1>Articles in the Configuration example category</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Main Content -->
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
|
||||
<div class="post-preview">
|
||||
<a href="https://captainark.net/my-tmux-configuration.html" rel="bookmark" title="Permalink to My tmux configuration">
|
||||
<h2 class="post-title">
|
||||
My tmux configuration
|
||||
</h2>
|
||||
</a>
|
||||
<p><a href="https://tmux.github.io/">tmux</a> is a terminal mutiplexer. It lets you have multiples shells running in a single terminal ...
|
||||
<p class="post-meta">Posted by
|
||||
<a href="https://captainark.net/author/antoine-joubert.html">Antoine Joubert</a>
|
||||
on Tue 02 February 2016
|
||||
</p>
|
||||
<p>There are <a href="https://captainark.net/my-tmux-configuration.html#disqus_thread">comments</a>.</p> </div>
|
||||
|
||||
<hr>
|
||||
<!-- Pager -->
|
||||
<ul class="pager">
|
||||
<li class="next">
|
||||
</li>
|
||||
</ul>
|
||||
Page 1 / 1
|
||||
<hr>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<!-- Footer -->
|
||||
<footer>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
|
||||
<ul class="list-inline text-center">
|
||||
<li>
|
||||
<a href="mailto:contact@captainark.net">
|
||||
<span class="fa-stack fa-lg">
|
||||
<i class="fa fa-circle fa-stack-2x"></i>
|
||||
<i class="fa fa-envelope fa-stack-1x fa-inverse"></i>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://twitter.com/captainark">
|
||||
<span class="fa-stack fa-lg">
|
||||
<i class="fa fa-circle fa-stack-2x"></i>
|
||||
<i class="fa fa-twitter fa-stack-1x fa-inverse"></i>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://github.com/captainark">
|
||||
<span class="fa-stack fa-lg">
|
||||
<i class="fa fa-circle fa-stack-2x"></i>
|
||||
<i class="fa fa-github fa-stack-1x fa-inverse"></i>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.last.fm/user/captainark">
|
||||
<span class="fa-stack fa-lg">
|
||||
<i class="fa fa-circle fa-stack-2x"></i>
|
||||
<i class="fa fa-lastfm fa-stack-1x fa-inverse"></i>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://steamcommunity.com/id/captainark">
|
||||
<span class="fa-stack fa-lg">
|
||||
<i class="fa fa-circle fa-stack-2x"></i>
|
||||
<i class="fa fa-steam fa-stack-1x fa-inverse"></i>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.twitch.tv/captainark">
|
||||
<span class="fa-stack fa-lg">
|
||||
<i class="fa fa-circle fa-stack-2x"></i>
|
||||
<i class="fa fa-twitch fa-stack-1x fa-inverse"></i>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="copyright text-muted">
|
||||
Blog powered by <a href="http://getpelican.com">Pelican</a>,
|
||||
which takes great advantage of <a href="http://python.org">Python</a>.
|
||||
</p> </div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="https://captainark.net/theme/js/jquery.js"></script>
|
||||
|
||||
<!-- Bootstrap Core JavaScript -->
|
||||
<script src="https://captainark.net/theme/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Custom Theme JavaScript -->
|
||||
<script src="https://captainark.net/theme/js/clean-blog.min.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-53658366-1']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var disqus_shortname = 'captainark';
|
||||
(function () {
|
||||
var s = document.createElement('script'); s.async = true;
|
||||
s.type = 'text/javascript';
|
||||
s.src = '//' + disqus_shortname + '.disqus.com/count.js';
|
||||
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
||||
}());
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
BIN
output/images/tmux.png
Normal file
BIN
output/images/tmux.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 69 KiB |
BIN
output/images/tmux_fullsize.png
Normal file
BIN
output/images/tmux_fullsize.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 187 KiB |
@ -91,6 +91,18 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
|
||||
<div class="post-preview">
|
||||
<a href="https://captainark.net/my-tmux-configuration.html" rel="bookmark" title="Permalink to My tmux configuration">
|
||||
<h2 class="post-title">
|
||||
My tmux configuration
|
||||
</h2>
|
||||
</a>
|
||||
<p><a href="https://tmux.github.io/">tmux</a> is a terminal mutiplexer. It lets you have multiples shells running in a single terminal ...
|
||||
<p class="post-meta">Posted by
|
||||
<a href="https://captainark.net/author/antoine-joubert.html">Antoine Joubert</a>
|
||||
on Tue 02 February 2016
|
||||
</p>
|
||||
<p>There are <a href="https://captainark.net/my-tmux-configuration.html#disqus_thread">comments</a>.</p> </div>
|
||||
<div class="post-preview">
|
||||
<a href="https://captainark.net/debian-updates-with-ansible.html" rel="bookmark" title="Permalink to Debian updates with Ansible">
|
||||
<h2 class="post-title">
|
||||
|
399
output/my-tmux-configuration.html
Normal file
399
output/my-tmux-configuration.html
Normal file
@ -0,0 +1,399 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
|
||||
<title>My tmux configuration</title>
|
||||
|
||||
<link href="https://captainark.net/rss.xml" type="application/atom+xml" rel="alternate" title="Sysadmining. All day. Every day. Full Atom Feed" />
|
||||
|
||||
<!-- Bootstrap Core CSS -->
|
||||
<link href="https://captainark.net/theme/css/bootstrap.min.css" rel="stylesheet">
|
||||
|
||||
<!-- Custom CSS -->
|
||||
<link href="https://captainark.net/theme/css/clean-blog.min.css" rel="stylesheet">
|
||||
|
||||
<!-- Code highlight color scheme -->
|
||||
<link href="https://captainark.net/theme/css/code_blocks/github.css" rel="stylesheet">
|
||||
|
||||
|
||||
<!-- Custom Fonts -->
|
||||
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet" type="text/css">
|
||||
<link href='https://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
|
||||
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
|
||||
|
||||
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
||||
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
||||
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<meta property="og:locale" content="">
|
||||
<meta property="og:site_name" content="Sysadmining. All day. Every day.">
|
||||
|
||||
<meta property="og:type" content="article">
|
||||
<meta property="article:author" content="">
|
||||
<meta property="og:url" content="https://captainark.net/my-tmux-configuration.html">
|
||||
<meta property="og:title" content="My tmux configuration">
|
||||
<meta property="og:description" content="">
|
||||
<meta property="og:image" content="https://captainark.net/">
|
||||
<meta property="article:published_time" content="2016-02-02 00:00:00+01:00">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<!-- Navigation -->
|
||||
<nav class="navbar navbar-default navbar-custom navbar-fixed-top">
|
||||
<div class="container-fluid">
|
||||
<!-- Brand and toggle get grouped for better mobile display -->
|
||||
<div class="navbar-header page-scroll">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="https://captainark.net/">Sysadmining. All day. Every day.</a>
|
||||
</div>
|
||||
|
||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="/">Homepage</a></li>
|
||||
<li><a href="/rss.xml">RSS</a></li>
|
||||
<li><a href="/categories.html">Categories</a></li>
|
||||
|
||||
<li><a href="https://captainark.net/pages/about.html">About</a></li>
|
||||
<li><a href="https://captainark.net/pages/resume.html">Resume</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- /.navbar-collapse -->
|
||||
</div>
|
||||
<!-- /.container -->
|
||||
</nav>
|
||||
|
||||
<!-- Page Header -->
|
||||
<header class="intro-header" style="background-image: url('/bg.png')">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
|
||||
<div class="post-heading">
|
||||
<h1>My tmux configuration</h1>
|
||||
<span class="meta">Posted by
|
||||
<a href="https://captainark.net/author/antoine-joubert.html">Antoine Joubert</a>
|
||||
on Tue 02 February 2016
|
||||
</span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- Main Content -->
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
|
||||
<!-- Post Content -->
|
||||
<article>
|
||||
<p><a href="https://tmux.github.io/">tmux</a> is a terminal mutiplexer. It lets you have multiples shells running in a single terminal emulator window and it keeps those shells running in the background should you need to close your terminal emulator.</p>
|
||||
<p>I've played around with the configuration quite a bit to find settings that suit my needs. Here's what it ended up looking like :</p>
|
||||
<p><a href="images/tmux_fullsize.png"><img alt="tmux" src="images/tmux.png" /></a></p>
|
||||
<p>This screenshot was done on Mac OS X, using the Terminal app and this <a href="https://github.com/tomislav/osx-terminal.app-colors-solarized">Solarized theme</a>.</p>
|
||||
<p>I figured I'd share my tmux configuration here !</p>
|
||||
<h2>Installing tmux</h2>
|
||||
<p>tmux is available on Debian. I suggest using the <a href="https://packages.debian.org/jessie-backports/tmux">jessie backports</a> version :</p>
|
||||
<p><code>apt -t jessie-backports install tmux</code></p>
|
||||
<p>tmux is also available on Mac OS X using <a href="http://brew.sh/">brew</a> :</p>
|
||||
<p><code>brew install tmux</code></p>
|
||||
<h2>tmux.conf</h2>
|
||||
<p>I used screen before tmux, so I configured the prefix key on C-a instead of C-b. tmux has the advantage of being <em>much</em> simpler to configure than screen.</p>
|
||||
<p>If you want to use this configuration, simply copy the following in ~/.tmux.conf. This file is read by default when tmux starts.</p>
|
||||
<p>If you simply want to try it out, copy it in a file somewhere else and have tmux load with the -f parameter (<code>tmux -f ~/tmux-test.conf</code>).</p>
|
||||
<div class="highlight"><pre># use utf8
|
||||
set -g utf8
|
||||
set-option -g status-utf8 on
|
||||
set-window-option -g utf8 on
|
||||
|
||||
# do not wait on esc key
|
||||
set-option -g escape-time 0
|
||||
|
||||
# completely disable automatic rename
|
||||
set-window-option -g automatic-rename off
|
||||
|
||||
# basic settings
|
||||
set -g default-terminal "screen-256color"
|
||||
set -g aggressive-resize off
|
||||
set-window-option -g xterm-keys on
|
||||
#set-window-option -g mode-mouse off
|
||||
|
||||
# command history
|
||||
set -g history-limit 10000
|
||||
|
||||
# messages
|
||||
set -g message-bg default
|
||||
set -g message-fg red
|
||||
|
||||
# no visual activity
|
||||
set -g visual-activity off
|
||||
set -g visual-bell off
|
||||
|
||||
# status bar
|
||||
set-option -g status-justify centre
|
||||
set-option -g status-bg default
|
||||
set-option -g status-fg blue
|
||||
set-option -g status-interval 5
|
||||
set-option -g status-left-length 30
|
||||
set-option -g status-left '#[fg=red][ #[fg=white]#H #[fg=red]]#[default]'
|
||||
set-option -g status-right '#[fg=red][ #[fg=white]%R %d/%m #[fg=red]]#[default]'
|
||||
|
||||
# modes
|
||||
set-option -g mode-bg default
|
||||
set-option -g mode-fg blue
|
||||
|
||||
# inactive window format
|
||||
set-window-option -g window-status-format '#I:#W#F'
|
||||
set-window-option -g monitor-activity on
|
||||
#set-window-option -g monitor-content on # not available in tmux 2.0
|
||||
|
||||
# activity in a window
|
||||
set-window-option -g window-status-activity-attr dim
|
||||
set-window-option -g window-status-activity-bg default
|
||||
set-window-option -g window-status-activity-fg yellow
|
||||
|
||||
# content in a window # not available in tmux 2.0
|
||||
#set-window-option -g window-status-content-attr dim
|
||||
#set-window-option -g window-status-content-bg default
|
||||
#set-window-option -g window-status-content-fg red
|
||||
|
||||
# active window format
|
||||
set-window-option -g window-status-current-fg white
|
||||
set-window-option -g window-status-current-bg default
|
||||
set-window-option -g window-status-current-format '#[fg=red](#[default]#I:#W#F#[fg=red])#[default]'
|
||||
|
||||
# reload tmux configuration
|
||||
unbind r
|
||||
bind r source-file ~/.tmux.conf \; display "Configuration reloaded!"
|
||||
|
||||
# Screen-like keybinds
|
||||
unbind C-b
|
||||
set -g prefix ^A
|
||||
set -g prefix2 ^Q
|
||||
bind a send-prefix
|
||||
bind q send-prefix
|
||||
|
||||
unbind c
|
||||
bind c new-window
|
||||
unbind ^C
|
||||
bind ^C new-window
|
||||
|
||||
unbind n
|
||||
bind n next-window
|
||||
unbind ^N
|
||||
bind ^N next-window
|
||||
|
||||
unbind A
|
||||
bind A command-prompt "rename-window %%"
|
||||
|
||||
unbind p
|
||||
bind p previous-window
|
||||
unbind ^P
|
||||
bind ^P previous-window
|
||||
|
||||
unbind a
|
||||
bind a last-window
|
||||
unbind ^A
|
||||
bind ^A last-window
|
||||
|
||||
unbind [
|
||||
bind Escape copy-mode
|
||||
|
||||
unbind w
|
||||
bind w list-windows
|
||||
|
||||
unbind k
|
||||
bind k confirm-before "kill-window"
|
||||
|
||||
unbind l
|
||||
bind l refresh-client
|
||||
|
||||
unbind '"'
|
||||
bind '"' choose-window
|
||||
</pre></div>
|
||||
|
||||
|
||||
<h2>Aliases</h2>
|
||||
<p>I also use two functions with tmux (in ~/.bash_aliases).</p>
|
||||
<p>The first one creates a new "mytmux" tmux session if one doesn't exist yet, opens 10 shells and selects the first one.</p>
|
||||
<div class="highlight"><pre>mytmux() {
|
||||
tmux has-session -t mytmux
|
||||
if [ $? != 0 ]; then
|
||||
tmux new-session -s mytmux -n $(hostname) -d
|
||||
tmux new-window -t mytmux:1 -n $(hostname)
|
||||
tmux new-window -t mytmux:2 -n $(hostname)
|
||||
tmux new-window -t mytmux:3 -n $(hostname)
|
||||
tmux new-window -t mytmux:4 -n $(hostname)
|
||||
tmux new-window -t mytmux:5 -n $(hostname)
|
||||
tmux new-window -t mytmux:6 -n $(hostname)
|
||||
tmux new-window -t mytmux:7 -n $(hostname)
|
||||
tmux new-window -t mytmux:8 -n $(hostname)
|
||||
tmux new-window -t mytmux:9 -n $(hostname)
|
||||
tmux select-window -t mytmux:0
|
||||
fi
|
||||
tmux attach -t mytmux
|
||||
}
|
||||
</pre></div>
|
||||
|
||||
|
||||
<p>The second one changes the tmux window name whenever I ssh to a remote host, and switches the window name back to the name of my computer when I logout from the host.</p>
|
||||
<div class="highlight"><pre><span class="k">if</span> <span class="p">[</span> <span class="o">-</span><span class="n">n</span> <span class="s">"$TMUX"</span> <span class="p">];</span> <span class="n">then</span>
|
||||
<span class="nf">ssh</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="k">if</span> <span class="p">[</span> <span class="err">$#</span> <span class="o">-</span><span class="n">le</span> <span class="mi">2</span> <span class="p">];</span> <span class="n">then</span>
|
||||
<span class="n">tmux</span> <span class="n">rename</span><span class="o">-</span><span class="n">window</span> <span class="s">"${@: -1}"</span>
|
||||
<span class="n">command</span> <span class="n">ssh</span> <span class="s">"$@"</span>
|
||||
<span class="n">tmux</span> <span class="n">rename</span><span class="o">-</span><span class="n">window</span> <span class="s">"$(hostname)"</span>
|
||||
<span class="k">else</span>
|
||||
<span class="n">command</span> <span class="n">ssh</span> <span class="s">"$@"</span>
|
||||
<span class="n">fi</span>
|
||||
<span class="p">}</span>
|
||||
<span class="n">fi</span>
|
||||
</pre></div>
|
||||
|
||||
|
||||
<h2>Conclusion</h2>
|
||||
<p>That's all ! As always, please do leave a comment if you've found something useful in this article !</p>
|
||||
</article>
|
||||
|
||||
|
||||
<hr>
|
||||
<div class="sharing">
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<div class="comments">
|
||||
<h2>Comments !</h2>
|
||||
<div id="disqus_thread"></div>
|
||||
<script type="text/javascript">
|
||||
var disqus_shortname = 'captainark';
|
||||
var disqus_identifier = 'my-tmux-configuration.html';
|
||||
var disqus_url = 'https://captainark.net/my-tmux-configuration.html';
|
||||
(function() {
|
||||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
||||
dsq.src = '//captainark.disqus.com/embed.js';
|
||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
||||
})();
|
||||
</script>
|
||||
<noscript>Please enable JavaScript to view the comments.</noscript>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<!-- Footer -->
|
||||
<footer>
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
|
||||
<ul class="list-inline text-center">
|
||||
<li>
|
||||
<a href="mailto:contact@captainark.net">
|
||||
<span class="fa-stack fa-lg">
|
||||
<i class="fa fa-circle fa-stack-2x"></i>
|
||||
<i class="fa fa-envelope fa-stack-1x fa-inverse"></i>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://twitter.com/captainark">
|
||||
<span class="fa-stack fa-lg">
|
||||
<i class="fa fa-circle fa-stack-2x"></i>
|
||||
<i class="fa fa-twitter fa-stack-1x fa-inverse"></i>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://github.com/captainark">
|
||||
<span class="fa-stack fa-lg">
|
||||
<i class="fa fa-circle fa-stack-2x"></i>
|
||||
<i class="fa fa-github fa-stack-1x fa-inverse"></i>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.last.fm/user/captainark">
|
||||
<span class="fa-stack fa-lg">
|
||||
<i class="fa fa-circle fa-stack-2x"></i>
|
||||
<i class="fa fa-lastfm fa-stack-1x fa-inverse"></i>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://steamcommunity.com/id/captainark">
|
||||
<span class="fa-stack fa-lg">
|
||||
<i class="fa fa-circle fa-stack-2x"></i>
|
||||
<i class="fa fa-steam fa-stack-1x fa-inverse"></i>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.twitch.tv/captainark">
|
||||
<span class="fa-stack fa-lg">
|
||||
<i class="fa fa-circle fa-stack-2x"></i>
|
||||
<i class="fa fa-twitch fa-stack-1x fa-inverse"></i>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="copyright text-muted">
|
||||
Blog powered by <a href="http://getpelican.com">Pelican</a>,
|
||||
which takes great advantage of <a href="http://python.org">Python</a>.
|
||||
</p> </div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- jQuery -->
|
||||
<script src="https://captainark.net/theme/js/jquery.js"></script>
|
||||
|
||||
<!-- Bootstrap Core JavaScript -->
|
||||
<script src="https://captainark.net/theme/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Custom Theme JavaScript -->
|
||||
<script src="https://captainark.net/theme/js/clean-blog.min.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', 'UA-53658366-1']);
|
||||
_gaq.push(['_trackPageview']);
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
var disqus_shortname = 'captainark';
|
||||
(function () {
|
||||
var s = document.createElement('script'); s.async = true;
|
||||
s.type = 'text/javascript';
|
||||
s.src = '//' + disqus_shortname + '.disqus.com/count.js';
|
||||
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
||||
}());
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
167
output/rss.xml
167
output/rss.xml
@ -1,5 +1,170 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom"><title>Sysadmining. All day. Every day.</title><link href="https://captainark.net/" rel="alternate"></link><link href="https://captainark.net/rss.xml" rel="self"></link><id>https://captainark.net/</id><updated>2016-01-31T00:00:00+01:00</updated><entry><title>Debian updates with Ansible</title><link href="https://captainark.net/debian-updates-with-ansible.html" rel="alternate"></link><updated>2016-01-31T00:00:00+01:00</updated><author><name>Antoine Joubert</name></author><id>tag:captainark.net,2016-01-31:debian-updates-with-ansible.html</id><summary type="html"><p>I've recently bought a <a href="http://www8.hp.com/us/en/products/proliant-servers/product-detail.html?oid=5379860">HP Proliant Microserver Gen8</a> to play around with LXC and try new stuff.</p>
|
||||
<feed xmlns="http://www.w3.org/2005/Atom"><title>Sysadmining. All day. Every day.</title><link href="https://captainark.net/" rel="alternate"></link><link href="https://captainark.net/rss.xml" rel="self"></link><id>https://captainark.net/</id><updated>2016-02-02T00:00:00+01:00</updated><entry><title>My tmux configuration</title><link href="https://captainark.net/my-tmux-configuration.html" rel="alternate"></link><updated>2016-02-02T00:00:00+01:00</updated><author><name>Antoine Joubert</name></author><id>tag:captainark.net,2016-02-02:my-tmux-configuration.html</id><summary type="html"><p><a href="https://tmux.github.io/">tmux</a> is a terminal mutiplexer. It lets you have multiples shells running in a single terminal emulator window and it keeps those shells running in the background should you need to close your terminal emulator.</p>
|
||||
<p>I've played around with the configuration quite a bit to find settings that suit my needs. Here's what it ended up looking like :</p>
|
||||
<p><a href="images/tmux_fullsize.png"><img alt="tmux" src="images/tmux.png" /></a></p>
|
||||
<p>This screenshot was done on Mac OS X, using the Terminal app and this <a href="https://github.com/tomislav/osx-terminal.app-colors-solarized">Solarized theme</a>.</p>
|
||||
<p>I figured I'd share my tmux configuration here !</p>
|
||||
<h2>Installing tmux</h2>
|
||||
<p>tmux is available on Debian. I suggest using the <a href="https://packages.debian.org/jessie-backports/tmux">jessie backports</a> version :</p>
|
||||
<p><code>apt -t jessie-backports install tmux</code></p>
|
||||
<p>tmux is also available on Mac OS X using <a href="http://brew.sh/">brew</a> :</p>
|
||||
<p><code>brew install tmux</code></p>
|
||||
<h2>tmux.conf</h2>
|
||||
<p>I used screen before tmux, so I configured the prefix key on C-a instead of C-b. tmux has the advantage of being <em>much</em> simpler to configure than screen.</p>
|
||||
<p>If you want to use this configuration, simply copy the following in ~/.tmux.conf. This file is read by default when tmux starts.</p>
|
||||
<p>If you simply want to try it out, copy it in a file somewhere else and have tmux load with the -f parameter (<code>tmux -f ~/tmux-test.conf</code>).</p>
|
||||
<div class="highlight"><pre># use utf8
|
||||
set -g utf8
|
||||
set-option -g status-utf8 on
|
||||
set-window-option -g utf8 on
|
||||
|
||||
# do not wait on esc key
|
||||
set-option -g escape-time 0
|
||||
|
||||
# completely disable automatic rename
|
||||
set-window-option -g automatic-rename off
|
||||
|
||||
# basic settings
|
||||
set -g default-terminal &quot;screen-256color&quot;
|
||||
set -g aggressive-resize off
|
||||
set-window-option -g xterm-keys on
|
||||
#set-window-option -g mode-mouse off
|
||||
|
||||
# command history
|
||||
set -g history-limit 10000
|
||||
|
||||
# messages
|
||||
set -g message-bg default
|
||||
set -g message-fg red
|
||||
|
||||
# no visual activity
|
||||
set -g visual-activity off
|
||||
set -g visual-bell off
|
||||
|
||||
# status bar
|
||||
set-option -g status-justify centre
|
||||
set-option -g status-bg default
|
||||
set-option -g status-fg blue
|
||||
set-option -g status-interval 5
|
||||
set-option -g status-left-length 30
|
||||
set-option -g status-left &#39;#[fg=red][ #[fg=white]#H #[fg=red]]#[default]&#39;
|
||||
set-option -g status-right &#39;#[fg=red][ #[fg=white]%R %d/%m #[fg=red]]#[default]&#39;
|
||||
|
||||
# modes
|
||||
set-option -g mode-bg default
|
||||
set-option -g mode-fg blue
|
||||
|
||||
# inactive window format
|
||||
set-window-option -g window-status-format &#39;#I:#W#F&#39;
|
||||
set-window-option -g monitor-activity on
|
||||
#set-window-option -g monitor-content on # not available in tmux 2.0
|
||||
|
||||
# activity in a window
|
||||
set-window-option -g window-status-activity-attr dim
|
||||
set-window-option -g window-status-activity-bg default
|
||||
set-window-option -g window-status-activity-fg yellow
|
||||
|
||||
# content in a window # not available in tmux 2.0
|
||||
#set-window-option -g window-status-content-attr dim
|
||||
#set-window-option -g window-status-content-bg default
|
||||
#set-window-option -g window-status-content-fg red
|
||||
|
||||
# active window format
|
||||
set-window-option -g window-status-current-fg white
|
||||
set-window-option -g window-status-current-bg default
|
||||
set-window-option -g window-status-current-format &#39;#[fg=red](#[default]#I:#W#F#[fg=red])#[default]&#39;
|
||||
|
||||
# reload tmux configuration
|
||||
unbind r
|
||||
bind r source-file ~/.tmux.conf \; display &quot;Configuration reloaded!&quot;
|
||||
|
||||
# Screen-like keybinds
|
||||
unbind C-b
|
||||
set -g prefix ^A
|
||||
set -g prefix2 ^Q
|
||||
bind a send-prefix
|
||||
bind q send-prefix
|
||||
|
||||
unbind c
|
||||
bind c new-window
|
||||
unbind ^C
|
||||
bind ^C new-window
|
||||
|
||||
unbind n
|
||||
bind n next-window
|
||||
unbind ^N
|
||||
bind ^N next-window
|
||||
|
||||
unbind A
|
||||
bind A command-prompt &quot;rename-window %%&quot;
|
||||
|
||||
unbind p
|
||||
bind p previous-window
|
||||
unbind ^P
|
||||
bind ^P previous-window
|
||||
|
||||
unbind a
|
||||
bind a last-window
|
||||
unbind ^A
|
||||
bind ^A last-window
|
||||
|
||||
unbind [
|
||||
bind Escape copy-mode
|
||||
|
||||
unbind w
|
||||
bind w list-windows
|
||||
|
||||
unbind k
|
||||
bind k confirm-before &quot;kill-window&quot;
|
||||
|
||||
unbind l
|
||||
bind l refresh-client
|
||||
|
||||
unbind &#39;&quot;&#39;
|
||||
bind &#39;&quot;&#39; choose-window
|
||||
</pre></div>
|
||||
|
||||
|
||||
<h2>Aliases</h2>
|
||||
<p>I also use two functions with tmux (in ~/.bash_aliases).</p>
|
||||
<p>The first one creates a new "mytmux" tmux session if one doesn't exist yet, opens 10 shells and selects the first one.</p>
|
||||
<div class="highlight"><pre>mytmux() {
|
||||
tmux has-session -t mytmux
|
||||
if [ $? != 0 ]; then
|
||||
tmux new-session -s mytmux -n $(hostname) -d
|
||||
tmux new-window -t mytmux:1 -n $(hostname)
|
||||
tmux new-window -t mytmux:2 -n $(hostname)
|
||||
tmux new-window -t mytmux:3 -n $(hostname)
|
||||
tmux new-window -t mytmux:4 -n $(hostname)
|
||||
tmux new-window -t mytmux:5 -n $(hostname)
|
||||
tmux new-window -t mytmux:6 -n $(hostname)
|
||||
tmux new-window -t mytmux:7 -n $(hostname)
|
||||
tmux new-window -t mytmux:8 -n $(hostname)
|
||||
tmux new-window -t mytmux:9 -n $(hostname)
|
||||
tmux select-window -t mytmux:0
|
||||
fi
|
||||
tmux attach -t mytmux
|
||||
}
|
||||
</pre></div>
|
||||
|
||||
|
||||
<p>The second one changes the tmux window name whenever I ssh to a remote host, and switches the window name back to the name of my computer when I logout from the host.</p>
|
||||
<div class="highlight"><pre><span class="k">if</span> <span class="p">[</span> <span class="o">-</span><span class="n">n</span> <span class="s">&quot;$TMUX&quot;</span> <span class="p">];</span> <span class="n">then</span>
|
||||
<span class="nf">ssh</span><span class="p">()</span> <span class="p">{</span>
|
||||
<span class="k">if</span> <span class="p">[</span> <span class="err">$#</span> <span class="o">-</span><span class="n">le</span> <span class="mi">2</span> <span class="p">];</span> <span class="n">then</span>
|
||||
<span class="n">tmux</span> <span class="n">rename</span><span class="o">-</span><span class="n">window</span> <span class="s">&quot;${@: -1}&quot;</span>
|
||||
<span class="n">command</span> <span class="n">ssh</span> <span class="s">&quot;$@&quot;</span>
|
||||
<span class="n">tmux</span> <span class="n">rename</span><span class="o">-</span><span class="n">window</span> <span class="s">&quot;$(hostname)&quot;</span>
|
||||
<span class="k">else</span>
|
||||
<span class="n">command</span> <span class="n">ssh</span> <span class="s">&quot;$@&quot;</span>
|
||||
<span class="n">fi</span>
|
||||
<span class="p">}</span>
|
||||
<span class="n">fi</span>
|
||||
</pre></div>
|
||||
|
||||
|
||||
<h2>Conclusion</h2>
|
||||
<p>That's all ! As always, please do leave a comment if you've found something useful in this article !</p></summary></entry><entry><title>Debian updates with Ansible</title><link href="https://captainark.net/debian-updates-with-ansible.html" rel="alternate"></link><updated>2016-01-31T00:00:00+01:00</updated><author><name>Antoine Joubert</name></author><id>tag:captainark.net,2016-01-31:debian-updates-with-ansible.html</id><summary type="html"><p>I've recently bought a <a href="http://www8.hp.com/us/en/products/proliant-servers/product-detail.html?oid=5379860">HP Proliant Microserver Gen8</a> to play around with LXC and try new stuff.</p>
|
||||
<p>From the 4 Debian machines I had to keep up-to-date, I now have 7, so it became quite time-consumming to manually SSH to each of them whenever an update became available.</p>
|
||||
<p>I ended up looking at <a href="http://www.ansible.com/">Ansible</a> to speed up the process and, within an hour, I had a working playbook that updates the debian packages, pip packages and git repos installed on all of my servers with a single command.</p>
|
||||
<p>I figured I'd share the playbook I use to update the Debian packages !</p>
|
||||
|
@ -37,6 +37,7 @@ EXTRA_PATH_METADATA = {
|
||||
}
|
||||
STATIC_PATHS = [
|
||||
'.well-known',
|
||||
'images',
|
||||
'static/robots.txt',
|
||||
'static/favicon.ico',
|
||||
'static/bg.png',
|
||||
|
BIN
pelicanconf.pyc
BIN
pelicanconf.pyc
Binary file not shown.
Loading…
Reference in New Issue
Block a user