Linux 技巧
Linux 技巧
For RedHat Enterprise Linux
系统
Locale
# show system locale
locale
# show system support locale
locale -a
# using utf-8 as system locale
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
# support Asia fonts
sudo yum groupinstall Fonts
Network
# check the listening ports and applications on Linux
sudo lsof -i -P -n | grep LISTEN
sudo netstat -tulpn | grep LISTEN
sudo nmap -sTU -O IP-address-Here
工具
Docker
# restart docker services
sudo systemctl stop docker
sudo systemctl daemon-reload
sudo systemctl start docker
# start docker, need to wait few minutes
sudo systemctl restart docker
docker-compose start
# stop docker
docker-compose stop
# stop and clear changes
docker-compose down
docker system prune -f
# start with images
docker-compose up -d
# Re-Install
## cd <compose configure path>
docker-compose down
docker system prune -f
# docker rm -fv $(docker ps -qa)
docker rmi $(docker images -q)
docker-compose pull
docker-compose up -d
# Login docker with root
docker exec -u 0 -it <container id> bash
# Enable docker ssh
docker exec <container id> /usr/sbin/sshd
tmux
有用的链接
什么是tmux
tmux 是一个多通道终端。 最大的好处是:
- 可以避免终端中断带来的session中断
当运行tmux时,实际上会运行一个tmux service,保持session的运行。
tmux的提出的概念是 tmux / sessions * / windows + / panes + tmux可以管理多个sessions。 一个session有多个windows。 一个windows有多个panes。 每个pane是一个终端。
安装
yum -y install tmux
tmux prefix
prefix 是一个重要的概念。它是一个tmux的快捷键,默认是[ctrl + b]。 比如,退出tmux的命令是
tmux -detach
等价于 [ctrl + b, d]
配置文件
~/.tmux.conf
tmux 命令
- Help
# list command
tmux list-command
# list shortcut keys
tmux list-keys
- Sessions
command |
shortcut key |
meaning |
---|---|---|
tmux new-session -s [session name] |
create an session |
|
tmux attach-session -t [session name] |
attach to an (or the only) session |
|
tmux detach-session |
prefix + d |
detach with the current session |
tmux list-sessions |
list all sessions |
|
tmux kill-session -t [session name] |
kill a session |
- Windows
command |
shortcut key |
meaning |
---|---|---|
tmux list-windows |
list all windows |
|
tmux kill-window -t [window name] |
prefix + & |
kill a window |
- Panes
command |
shortcut key |
meaning |
---|---|---|
tmux split-window |
prefix + % |
new a horizontal pane |
tmux split-window -v |
prefix + " |
new a vertical pane |
tmux rotate-window |
prefix + C-o |
rotate panes |
tmux select-pane -U |
prefix + Up |
select the up pane |
tmux select-pane -D |
prefix + Down |
select the down pane |
tmux select-pane -L |
prefix + Left |
select the left pane |
tmux select-pane -R |
prefix + Right |
select the right pane |
tmux resize-pane -U |
prefix + C-Up |
resize the up side |
tmux resize-pane -D |
prefix + C-Down |
resize the down side |
tmux resize-pane -L |
prefix + C-Left |
resize the left side |
tmux resize-pane -R |
prefix + C-Right |
resize the right side |
tmux list-panes |
list all panes |
|
tmux kill-pane -t [pane name] |
prefix + x |
kill a pane |
- Save sessions Installation with Tmux Plugin Manager (recommended) Add plugin to the list of TPM plugins in ~/.tmux.conf:
set -g @plugin 'tmux-plugins/tmux-resurrect'
Hit prefix + I to fetch the plugin and source it. You should now be able to use the plugin.
Key bindings prefix + Ctrl-s - save prefix + Ctrl-r - restore
- 深入node之Transform
- 巧用shell脚本统计磁盘使用情况(r4笔记第12天)
- 使用fasttext实现文本处理及文本预测
- 关于导入导出sequence(r4笔记第11天)
- Spring+SpringMVC+MyBatis整合进阶篇(四)RESTful实战(前端代码修改)
- Nodejs cluster模块深入探究
- org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression
- 巧用分析函数循序渐进解决实际问题 (r4笔记第10天)
- 支持多用户web终端实现及安全保障(nodejs)
- 你看到的最直白清晰的CNN讲解
- oracle中的数组(第一篇)(r4笔记第9天)
- org.springframework.expression.spel.SpelEvaluationException: EL1004E: Method call: Method service()
- GITCHAT系列2:个性化推荐
- org.springframework.expression.spel.SpelEvaluationException: EL1011E: Method call: Attempted to call
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- 关于 Executor 和 ExecutorService
- 【队伍训练】Codeforces Round #660 (Div. 2)
- 【队伍训练2】 AtCoder Beginner Contest 165
- C# 的sql server like 的参数
- sql server 字符串替换函数REPLACE
- sql server 更新两个表的某个字段
- HTML 引用Css样式的四种方式
- Java也可以像python般range出连续集合
- c# dev控件 gridcontrol 数据跟随鼠标滚轮滚动也可以编辑
- Apollo(阿波罗)配置中心Java客户端使用指南使用指南
- DevExpress.LookUpEdit控件实现自动搜索定位功能 兼使用方法(looUpEdit可编辑)
- dev GridControl直接打印 纵向合并单元格
- Dooring可视化之从零实现动态表单设计器
- 我不是最后一个知道MDC的吧?
- 实战编写 wireshark 插件解析私有协议