技术文档收录
ASCII
Tcpdump
IPV4保留地址段
深入理解以太网网线原理 - 三帛的世界
Linux
WireGuard 一键安装脚本 | 秋水逸冰
SSH Config 那些你所知道和不知道的事 | Deepzz's Blog
Linux 让终端走代理的几种方法
ubuntu 20.04 server 版设置静态 IP 地址 - 链滴
Linux 挂载 Windows 共享磁盘的方法 - 技术学堂
将 SMB/CIFS 网络硬盘永久的挂载到 Ubuntu 上 - 简书
linux 获取当前脚本的绝对路径 | aimuke
[Linux] Linux 使用 / dev/urandom 生成随机数 - piaohua's blog
Linux 生成随机数的多种方法 | Just Do It
Linux 的 Centos7 版本下忘记 root 或者普通用户密码怎么办?
Git 强制拉取覆盖本地
SSH 安全加固指南 - FreeBuf 网络安全行业门户
Linux 系统安全强化指南 - FreeBuf 网络安全行业门户
Linux 入侵排查 - FreeBuf 网络安全行业门户
sshd_config 配置详解 - 简书
SSH 权限详解 - SegmentFault 思否
CentOS 安装 node.js 环境 - SegmentFault 思否
如何在 CentOS 7 上安装 Node.js 和 npm | myfreax
几款 ping tcping 工具总结
OpenVpn 搭建教程 | Jesse's home
openvpn 一键安装脚本 - 那片云
OpenVPN 解决 每小时断线一次 - 爱开源
OpenVPN 路由设置 – 凤曦的小窝
OpenVPN 设置非全局代理 - 镜子的记录簿
TinyProxy 使用帮助 - 简书
Ubuntu 下使用 TinyProxy 搭建代理 HTTP 服务器_Linux_运维开发网_运维开发技术经验分享
Linux 软件包管理工具 Snap 常用命令 - 简书
linux systemd 参数详解
Systemd 入门教程:命令篇 - 阮一峰的网络日志
记一次 Linux 木马清除过程
rtty:在任何地方通过 Web 访问您的终端
02 . Ansible 高级用法 (运维开发篇)
终于搞懂了服务器为啥产生大量的 TIME_WAIT!
巧妙的 Linux 命令,再来 6 个!
77% 的 Linux 运维都不懂的内核问题,这篇全告诉你了
运维工程师必备:请收好 Linux 网络命令集锦
一份阿里员工的 Java 问题排查工具单
肝了 15000 字性能调优系列专题(JVM、MySQL、Nginx and Tomcat),看不完先收
作业调度算法(FCFS,SJF,优先级调度,时间片轮转,多级反馈队列) | The Blog Of WaiterXiaoYY
看了这篇还不会 Linux 性能分析和优化,你来打我
2019 运维技能风向标
更安全的 rm 命令,保护重要数据
求你了,别再纠结线程池大小了!
Linux sudo 详解 | 失落的乐章
重启大法好!线上常见问题排查手册
sudo 使用 - 笨鸟教程的博客 | BY BenderFly
shell 在手分析服务器日志不愁? - SegmentFault 思否
sudo 与 visudo 的超细用法说明_陈发哥 007 的技术博客_51CTO 博客
ESXI 下无损扩展 Linux 硬盘空间 | Naonao Blog
Linux 学习记录:su 和 sudo | Juntao Tan 的个人博客
使用者身份切换 | Linux 系统教程(笔记)
你会使用 Linux 编辑器 vim 吗?
在 Windows、Linux 和 Mac 上查看 Wi-Fi 密码
linux 隐藏你的 crontab 后门 - 简书
Linux 定时任务详解 - Tr0y's Blog
linux 的 TCP 连接数量最大不能超过 65535 个吗,那服务器是如何应对百万千万的并发的?_一口 Linux 的博客 - CSDN 博客_tcp 连接数多少正常
万字长文 + 28 张图,一次性说清楚 TCP,运维必藏
为什么 p2p 模式的 tunnel 底层通常用 udp 而不是 tcp?
记一次服务器被入侵挖矿 - tlanyan
shell 判断一个变量是否为空方法总结 - 腾讯云开发者社区 - 腾讯云
系统安装包管理工具 | Escape
编译代码时动态地链接库 - 51CTO.COM
甲骨文 Oracle Cloud 添加新端口开放的方法 - WirelessLink 社区
腾讯云 Ubuntu 添加 swap 分区的方法_弓弧名家_玄真君的博客 - CSDN 博客
Oracle 开放全部端口并关闭防火墙 - 清~ 幽殇
谁再说不熟悉 Linux 命令, 就把这个给他扔过去!
即插即用,运维工程师必会正则表达式大全
Shell脚本编写及常见面试题
Samba 文件共享服务器
到底一台服务器上最多能创建多少个 TCP 连接 | plantegg
SSH 密钥登录 - SSH 教程 - 网道
在 Bash 中进行 encodeURIComponent/decodeURIComponent | Harttle Land
使用 Shell 脚本来处理 JSON - Tom CzHen's Blog
Docker
「Docker」 - 保存镜像 - 知乎
终于可以像使用 Docker 一样丝滑地使用 Containerd 了!
私有镜像仓库选型:Harbor VS Quay - 乐金明的博客 | Robin Blog
exec 与 entrypoint 使用脚本 | Mr.Cheng
Dockerfile 中的 CMD 与 ENTRYPOINT
使用 Docker 配置 MySQL 主从数据库 - 墨天轮
Alpine vs Distroless vs Busybox – 云原生实验室 - Kubernetes|Docker|Istio|Envoy|Hugo|Golang | 云原生
再见,Docker!
docker save 与 docker export 的区别 - jingsam
如何优雅的关闭容器
docker 储存之 tmpfs 、bind-mounts、volume | 陌小路的个人博客
Dockerfile 中 VOLUME 与 docker -v 的区别是什么 - 开发技术 - 亿速云
理解 docker 容器的退出码 | Vermouth | 博客 | docker | k8s | python | go | 开发
【Docker 那些事儿】容器监控系统,来自 Docker 的暴击_飞向星的客机的博客 - CSDN 博客
【云原生】Docker 镜像详细讲解_微枫 Micromaple 的博客 - CSDN 博客_registry-mirrors
【云原生】Helm 架构和基础语法详解
CMD 和 Entrypoint 命令使用变量的用法
实时查看容器日志 - 苏洋博客
Traefik 2 使用指南,愉悦的开发体验 - 苏洋博客
为你的 Python 应用选择一个最好的 Docker 映像 | 亚马逊 AWS 官方博客
【云原生】镜像构建实战操作(Dockerfile)
Docker Compose 中的 links 和 depends_on 的区别 - 编程知识 - 白鹭情
Python
Pipenv:新一代Python项目环境与依赖管理工具 - 知乎
Python list 列表实现栈和队列
Python 各种排序 | Lesley's blog
Python 中使用 dateutil 模块解析时间 - SegmentFault 思否
一个小破网站,居然比 Python 官网还牛逼
Python 打包 exe 的王炸 - Nuitka
Django - - 基础 - - Django ORM 常用查询语法及进阶
[Python] 小知識:== 和 is 的差異 - Clay-Technology World
Window
批处理中分割字符串 | 网络进行时
Windows 批处理基础命令学习 - 简书
在Windows上设置WireGuard
Windows LTSC、LTSB、Server 安装 Windows Store 应用商店
windows 重启 rdpclip.exe 的脚本
中间件
Nginx 中的 Rewrite 的重定向配置与实践
RabbitMQ 的监控
RabbitMq 最全的性能调优笔记 - SegmentFault 思否
为什么不建议生产用 Redis 主从模式?
高性能消息中间件——NATS
详解:Nginx 反代实现 Kibana 登录认证功能
分布式系统关注点:仅需这一篇,吃透 “负载均衡” 妥妥的
仅需这一篇,妥妥的吃透” 负载均衡”
基于 nginx 实现上游服务器动态自动上下线——不需 reload
Nginx 学习书单整理
最常见的日志收集架构(ELK Stack)
分布式之 elk 日志架构的演进
CAT 3.0 开源发布,支持多语言客户端及多项性能提升
Kafka 如何做到 1 秒处理 1500 万条消息?
Grafana 与 Kibana
ELK 日志系统之通用应用程序日志接入方案
ELK 简易 Nginx 日志系统搭建: ElasticSearch+Kibana+Filebeat
记一次 Redis 连接池问题引发的 RST
把 Redis 当作队列来用,你好大的胆子……
Redis 最佳实践:业务层面和运维层面优化
Redis 为什么变慢了?常见延迟问题定位与分析
好饭不怕晚,扒一下 Redis 配置文件的底 Ku
rabbitmq 集群搭建以及万级并发下的性能调优
别再问我 Redis 内存满了该怎么办了
Nginx 状态监控及日志分析
uWSGI 的安装及配置详解
uwsgi 异常服务器内存 cpu 爆满优化思路
Uwsgi 内存占用过多 - 简书
Nginx 的 limit 模块
Nginx 内置模块简介
Redis 忽然变慢了如何排查并解决?_redis_码哥字节_InfoQ 写作社区
领导:谁再用 redis 过期监听实现关闭订单,立马滚蛋!
Nginx 限制 IP 访问频率以及白名单配置_问轩博客
Nginx $remote_addr 和 $proxy_add_x_forwarded_for 变量详解
Caddy 部署实践
一文搞定 Nginx 限流
数据库
SqlServer 将数据库中的表复制到另一个数据库_MsSql_脚本之家
SQL Server 数据库同步,订阅、发布、复制、跨服务器
sql server 无法删除本地发布 | 辉克's Blog
SQLite全文检索
SQL 重复记录查询的几种方法 - 简书
SQL SERVER 使用订阅发布同步数据库(转)
Mysql 查看用户连接数配置及每个 IP 的请求情况 - 墨天轮
优化 SQL 的 21 条方案
SQL Server 连接时好时坏的奇怪问题
MS SQL 执行大脚本文件时,提示 “内存不足” 的解决办法 - 阿里云开发者社区
防火墙-iptables
iptables 常用规则:屏蔽 IP 地址、禁用 ping、协议设置、NAT 与转发、负载平衡、自定义链
防火墙 iptables 企业防火墙之 iptables
Linux 防火墙 ufw 简介
在 Ubuntu 中用 UFW 配置防火墙
在 Ubuntu20.04 上怎样使用 UFW 配置防火墙 - 技术库存网
监控类
开箱即用的 Prometheus 告警规则集
prometheus☞搭建 | zyh
docker 部署 Prometheus 监控服务器及容器并发送告警 | chris'wang
PromQL 常用命令 | LRF 成长记
prometheus 中使用 python 手写 webhook 完成告警
持续集成CI/CD
GitHub Actions 的应用场景 | 记录干杯
GithubActions · Mr.li's Blog
工具类
GitHub 中的开源网络广告杀手,十分钟快速提升网络性能
SSH-Auditor:一款 SHH 弱密码探测工具
别再找了,Github 热门开源富文本编辑器,最实用的都在这里了 - srcmini
我最喜欢的 CLI 工具
推荐几款 Redis 可视化工具
内网代理工具与检测方法研究
环境篇:数据同步工具 DataX
全能系统监控工具 dstat
常用 Web 安全扫描工具合集
给你一款利器!轻松生成 Nginx 配置文件
教程类
Centos7 搭建神器 openvpn | 运维随笔
搭建 umami 收集个人网站统计数据 | Reorx’s Forge
openvpn安装教程
基于 gitea+drone 完成小团队的 CI/CD - 德国粗茶淡饭
将颜色应用于交替行或列
VMware Workstation 全系列合集 精简安装注册版 支持 SLIC2.6、MSDM、OSX 更新 16.2.3_虚拟机讨论区_安全区 卡饭论坛 - 互助分享 - 大气谦和!
在 OpenVPN 上启用 AD+Google Authenticator 认证 | 运维烂笔头
Github 进行 fork 后如何与原仓库同步:重新 fork 很省事,但不如反复练习版本合并 · Issue #67 · selfteaching/the-craft-of-selfteaching
卧槽,VPN 又断开了!!- 阿里云开发者社区
Grafana Loki 学习之踩坑记
zerotier 的 planet 服务器(根服务器)的搭建踩坑记。无需 zerotier 官网账号。
阿里云 qcow2 镜像转 vmdk,导入 ESXi - 唐际忠的博客
Caddy 入门 – 又见杜梨树
【Caddy2】最新 Caddy2 配置文件解析 - Billyme 的博客
Web 服务器 Caddy 2 | Haven200
手把手教你打造高效的 Kubernetes 命令行终端
Keras 作者:给软件开发者的 33 条黄金法则
超详细的网络抓包神器 Tcpdump 使用指南
使用 fail2ban 和 FirewallD 黑名单保护你的系统
linux 下 mysql 数据库单向同步配置方法分享 (Mysql)
MySQL 快速删除大量数据(千万级别)的几种实践方案
GitHub 上的优质 Linux 开源项目,真滴牛逼!
WireGuard 教程:使用 Netmaker 来管理 WireGuard 的配置 – 云原生实验室 - Kubernetes|Docker|Istio|Envoy|Hugo|Golang | 云原生
Tailscale 基础教程:Headscale 的部署方法和使用教程 – 云原生实验室 - Kubernetes|Docker|Istio|Envoy|Hugo|Golang | 云原生
Nebula Graph 的 Ansible 实践
改进你的 Ansible 剧本的 4 行代码
Caddy 2 快速简单安装配置教程 – 高玩梁的博客
切换至 Caddy2 | 某不科学的博客
Caddy2 简明教程 - bleem
树莓派安装 OpenWrt 突破校园网限制 | Asttear's Blog
OpenVPN 路由设置 – 凤曦的小窝
个性化编译 LEDE 固件
盘点各种 Windows/Office 激活工具
[VirtualBox] 1、NAT 模式下端口映射
VirtualBox 虚拟机安装 openwrt 供本机使用
NUC 折腾笔记 - 安装 ESXi 7 - 苏洋博客
锐捷、赛尔认证 MentoHUST - Ubuntu 中文
How Do I Use A Client Certificate And Private Key From The IOS Keychain? | OpenVPN
比特记事簿: 笔记: 使用电信 TR069 内网架设 WireGuard 隧道异地组网
利用 GitHub API 获取最新 Releases 的版本号 | 这是只兔子
docsify - 生成文档网站简单使用教程 - SegmentFault 思否
【干货】Chrome 插件 (扩展) 开发全攻略 - 好记的博客
一看就会的 GitHub 骚操作,让你看上去像一位开源大佬
【计算机网络】了解内网、外网、宽带、带宽、流量、网速_墩墩分墩 - CSDN 博客
mac-ssh 配置 | Sail
如何科学管理你的密码
VirtualBox NAT 端口映射实现宿主机与虚拟机相互通信 | Shao Guoliang 的博客
CentOS7 配置网卡为静态 IP,如果你还学不会那真的没有办法了!
laisky-blog: 近期折腾 tailscale 的一些心得
使用 acme.sh 给 Nginx 安装 Let’ s Encrypt 提供的免费 SSL 证书 · Ruby China
acme 申请 Let’s Encrypt 泛域名 SSL 证书
从 nginx 迁移到 caddy
使用 Caddy 替代 Nginx,全站升级 https,配置更加简单 - Diamond-Blog
http.proxy - Caddy 中文文档
动手撸个 Caddy(二)| Caddy 命令行参数最全教程 | 飞雪无情的总结
Caddy | 学习笔记 - ijayer
Caddy 代理 SpringBoot Fatjar 应用上传静态资源
使用 graylog3.0 收集 open××× 日志进行审计_年轻人,少吐槽,多搬砖的技术博客_51CTO 博客
提高国内访问 github 速度的 9 种方法! - SegmentFault 思否
VM16 安装 macOS 全网最详细
2022 目前三种有效加速国内 Github
How to install MariaDB on Alpine Linux | LibreByte
局域网内电脑 - ipad 文件共享的三种方法 | 岚
多机共享键鼠软件横向测评 - 尚弟的小笔记
VLOG | ESXI 如何升级到最新版,无论是 6.5 还是 6.7 版本都可以顺滑升级。 – Vedio Talk - VLOG、科技、生活、乐分享
远程修改 ESXi 6.7 管理 IP 地址 - 腾讯云开发者社区 - 腾讯云
几乎不要钱自制远程 PLC 路由器方案
traefik 简易入门 | 个人服务器运维指南 | 山月行
更完善的 Docker + Traefik 使用方案 - 苏洋博客
MicroSD·TF 卡终极探秘 ·MLC 颗粒之谜 1 三星篇_microSD 存储卡_什么值得买
macOS 绕过公证和应用签名方法 - 走客
MiscSecNotes / 内网端口转发及穿透. md at master · JnuSimba/MiscSecNotes
我有特别的 DNS 配置和使用技巧 | Sukka's Blog
SEO:初学者完整指南
通过 OpenVPN 实现流量审计
OpenVPN-HOWTO
OpenVPN Server · Devops Roadmap
Linux 运维必备的 13 款实用工具, 拿好了~
linux 平台下 Tomcat 的安装与优化
Linux 运维跳槽必备的 40 道面试精华题
Bash 脚本进阶,经典用法及其案例 - alonghub - 博客园
推荐几个非常不错的富文本编辑器 - 走看看
在 JS 文件中加载 JS 文件的方法 - 月光博客
#JavaScript 根据需要动态加载脚本并设置自定义参数
笔记本电脑 BIOS 修改及刷写教程
跨平台加密 DNS 和广告过滤 personalDNSfilter · LinuxTOY
AdGuard Home 安装及使用指北
通过 Amazon S3 协议挂载 OSS
记一次云主机如何挂载对象存储
本文档发布于https://mrdoc.fun
-
+
首页
我最喜欢的 CLI 工具
> 本文由 [简悦 SimpRead](http://ksria.com/simpread/) 转码, 原文地址 [switowski.com](https://switowski.com/blog/favorite-cli-tools) Previously, I wrote about [my favorite Mac apps](https://switowski.com/blog/favorite-mac-tools). But I spend half of my time in the terminal, and I have a handful of CLI tools that makes my life easier. Here are some of them: This is a long list, so here is a table of content with tl;dr summaries: * [fish shell](#fish-shell) - easy to use, beginner-friendly shell * [starship](#starship) - a great prompt that requires no setup * [z](#z) - quickly jump around your filesystem * [fzf](#fzf) - general-purpose fuzzy search * [fd](#fd) - like `find` but better * [ripgrep](#ripgrep) - like `grep` but better * [htop and glances](#htop-and-glances) - system monitoring tools * [virtualenv and virtualfish](#virtualenv-and-virtualfish) - Python virtual environment management * [pyenv, nodenv, and rbenv](#pyenv-nodenv-and-rbenv) - manage different versions of Python, Node, and Ruby * [pipx](#pipx) - install Python packages in isolated environments * [ctop and lazydocker](#ctop-and-lazydocker) - monitoring tools for Docker * [homebrew](#homebrew) - package manager for macOS * [asciinema](#asciinema) - record your terminal sessions (and let viewers copy code from those recordings) * [colordiff and diff-so-fancy](#colordiff-and-diff-so-fancy) - like `diff` but with colors * [tree](#tree-brew-install-tree) - for presenting the content of a folder * [bat](#bat) - like `cat` but better * [httpie](#httpie) - like `curl` but better * [tldr](#tldr) - simplified "man pages" * [exa](#exa) - like `ls` but better * [litecli and pgcli](#litecli-and-pgcli) - like `sqlite3` and `psql` but better * [mas](#mas) - CLI interface for App Store * [ncdu](#ncdu) - disk usage analyzer ### [fish shell](https://fishshell.com/) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-fish.jpg) Shell - the most important tool that you use every time you open the terminal. I’ve used Bash and Z shell in the past, and currently, I’m using fish. It’s a great shell with plenty of features out of the box, like the autosuggestions, syntax highlighting, or switching between folders with ⌥+→ and ⌥+←. On the one hand, this makes it perfect for beginners, because you don’t have to set up anything. On the other hand, because it’s using a different syntax than other shells, you usually can’t just paste scripts from the internet. You either have to change the incompatible commands to [fish scripts](https://fishshell.com/docs/current/index.html#syntax-overview) or start a Bash session to run the bash scripts. I understand the idea behind this change (Bash is not the easiest language to use), but it doesn’t benefit me in any way. I write bash/fish scripts too seldom to memorize the syntax, so I always have to relearn it from scratch. And there are fewer resources for fish scripts than for bash scripts. I usually end up reading the documentation, instead of copy-pasting ready-made scripts from StackOverflow. Do I recommend fish? Yes! Switching shells is easy, so give it a try. Especially if you don’t like to tinker with your shell and want to have something that works great with minimal configuration. #### Fish plugins You can add more features to fish with plugins. The easiest way to install them is to use a plugin manager like [Fisher](https://github.com/jorgebucaran/fisher), [Oh My Fish](https://github.com/oh-my-fish/oh-my-fish), or [fundle](https://github.com/danhper/fundle). Right now, I’m using Fisher with just three plugins: * [franciscolourenco/done](https://github.com/franciscolourenco/done) - sends a notification when a long-running script is done. I don’t have a terminal open all the time. I’m using a [Guake style](http://guake-project.org/) terminal that drops down from the top of the screen when I need it and hides when I don’t. With this plugin, when I run scripts that take longer than a few seconds, I get a macOS notification when they finish. * [evanlucas/fish-kubectl-completions](https://github.com/evanlucas/fish-kubectl-completions) - provides autocompletion for kubectl (Kubernetes command line tool). * [fzf](https://github.com/jethrokuan/fzf) - integrates the fzf tool ([see below](#fzf)) with fish. I had more plugins in the past (rbenv, pyenv, nodenv, fzf, z), but I switched to different tools to avoid slowing down my shell (a mistake that I did in the past with Z shell). If you want to see more resources for fish, check out the [awesome-fish](https://github.com/jorgebucaran/awesome-fish) repository. Compared with Z shell and Bash, fish has fewer plugins, so it’s not the best option if you want to tweak it a lot. For me - that’s a plus. It stops me from enabling too many plugins and then complaining that it’s slow 😉. ### [Starship](https://starship.rs/) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-starship.jpg) If I had to choose one favorite tool from this whole list - it would be Starship. Starship is a prompt that works for any shell. You install it, add one line of config to your `.bashrc`/`.zshrc`/`config.fish`, and it takes care of the rest. It shows: * git status of the current directory and different symbols, depending on if you have new files, pending changes, stashes, etc. * Python version if you are in a Python project folder (the same applies to Go/Node/Rust/Elm and many other programming languages) * How long it took the previous command to execute (if it was longer than a few milliseconds) * Error indicator if the last command failed ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-starship2.jpg) Starship prompt in action And a bazillion other information. But, in a smart way! If you are not in a git repository, it hides the git info. If you are not in a Python project - there is no Python version (because there is no point in displaying it). It never overwhelms you with too much information, and the prompt stays beautiful, useful, and minimalistic. Did I mention that it’s fast? It’s written in Rust, and even with so many features, it’s still faster than all my previous prompts! I’m very picky about my prompt, so I was usually hacking my own version. I was taking functions from existing prompts and gluing it together to make sure I only have things that I need and it stays fast. That’s why I was skeptical about Starship. _“There is no way that an external tool can be faster than my meticulously crafted prompt!_” Well, I was wrong. Give it a try, and I’m sure you are going to love it! Huge kudos to the creators of Starship! ### [z](https://github.com/rupa/z) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-z.gif) “z” lets you quickly jump around your filesystem. It memorizes the folders that you visit, and after a short learning time, you can move between them using `z path_of_the_folder_name`. For example, if I often go to folder `~/work/src/projects`, I can just run `z pro` and immediately jump there. z’s algorithm is based on **frecency** - a combination of **frequency** and **recency** that works very well. If it memorizes a folder that you don’t want to use, you can always remove it manually. It speeds up moving between commonly visited folders on my computer and saves me a lot of keystrokes (and path memorization). ### [fzf](https://github.com/junegunn/fzf) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-fzf.jpg) fzf stands for _“fuzzy finder”_. It’s a general-purpose tool that lets you find files, commands in the history, processes, git commits, and more using a **fuzzy search**. You type some letters, and it tries to match those letters anywhere in the list of results. The more letters you type, the more accurate the results are. You probably know this type of search from your code editor - when you use the command to open a file, and you type just part of the file name instead of the full path - that’s a fuzzy search. I use it through the [fish fzf plugin](https://github.com/jethrokuan/fzf), so I can search through command history or quickly open a file. It’s another small tool that saves me time every day. ### [fd](https://github.com/sharkdp/fd) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-fd.gif) find (left) versus fd (right) Like the `find` command but much simpler to use, faster, and comes with good default settings. You want to find a file called “invoice,” but you are not sure what extension it has? Or maybe it was a directory that was holding all your invoices, not a single file? You can either roll up your sleeves and start writing those regex patterns for the `find` command or just run `fd invoice`. For me, the choice is easy 😉. By default, fd ignores files and directories that are hidden or listed in the `.gitignore`. Most of the time - that’s what you want, but for those rare cases when I need to disable this feature, I have an alias: `fda='fd -IH'`. The output is nicely colorized and, [according to the benchmarks](https://github.com/sharkdp/fd#benchmark) (or the GIF above), it’s even faster than `find`. ### [ripgrep](https://github.com/BurntSushi/ripgrep) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-rg.gif) Poor grep (on the left) was running for ages through all the node_modules before finding something useful In a similar manner to `fd` mentioned above, `ripgrep` is an alternative to the `grep` command - much faster one, with sane defaults and colorized output. It skips files ignored by `.gitignore` and hidden ones, so you will probably need this alias: `rga='rg -uuu'`. It disables all smart filtering and makes `ripgrep` behave as standard grep. ### [htop](https://hisham.hm/htop/) and [glances](https://nicolargo.github.io/glances/) The most common tool to show information about processes running on Linux or Mac is called `top`. It’s the best friend of every system administrator. And, even if you are mostly doing web development like me, it’s useful to see what’s going on with your computer. You know, just to see if it was Docker or Chrome that ate all your RAM this time. ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-htop.jpg) htop is an excellent alternative for top `top` is quite basic, so most people switch to [htop](https://hisham.hm/htop/). `htop` is top on steroids - colorful, with plenty of options, and overall more comfortable to use. ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-glances.jpg) glances gives you a quick overview of your system [glances](https://nicolargo.github.io/glances/) is a complementary tool to `htop`. Apart from listing all the processes with their CPU and memory usage, it also displays additional information about your system. You can see: * network or disks usage * used and total space on your filesystem * data from different sensors (like the battery) * and a list of processes that recently consumed an excessive amount of resources I still use `htop` for faster filtering and killing processes, but I use `glances` to quickly _glance_ at what’s going on with my computer. It comes with API, Web UI, and various export formats, so you can take system monitoring to the next level. I highly recommend it! ### [virtualenv](https://pypi.org/project/virtualenv/) and [virtualfish](https://github.com/justinmayer/virtualfish) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-virtualenv.jpg) Virtualenv is a tool for creating virtual environments in Python (I like it more than the built-in `venv` module). VirtualFish is virtual environment manager for the fish shell (if you are not using fish, check out [virtualenvwrapper](https://pypi.org/project/virtualenvwrapper)). It provides a bunch of additional commands to create, list, or delete virtual environments quickly. ### [pyenv](https://github.com/pyenv/pyenv), [nodenv](https://github.com/nodenv/nodenv), and [rbenv](https://github.com/rbenv/rbenv) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-pyenv.jpg) pyenv makes it easy to switch Python versions Pyenv, nodenv, and rubyenv are tools for managing different versions of Python, Node, and Ruby on my computer. Let’s say you want to have two versions of Python on your computer. Maybe you are working on two different projects, or you still need to support Python 2. Managing different Python versions is hard. You need to make sure that different projects install packages with the correct version. If you are not careful, it’s easy to mess up this fragile setup and overwrite binaries used by other packages. Version manager helps a lot and turns this nightmare into a pretty manageable task. Good version manager can swap the Python version globally or “per folder”. And every version is isolated from others. I’ve recently found a tool called [asdf](https://github.com/asdf-vm/asdf) that can replace pyenv, nodenv, rbenv, and other *envs with one tool to rule them all. It provides version management for pretty much [any programming language](https://asdf-vm.com/#/plugins-all?id=plugin-list), and I will definitely give it a try next time I need to set up a version manager for a programming language. ### [pipx](https://github.com/pipxproject/pipx) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-pipx.jpg) Virtualenv solves many problems with package management in Python, but there is one more use case to cover. If I want to install a Python package globally (because it’s a standalone tool, like `glances` mentioned before), I have a problem. Installing packages outside of a virtual environment is a bad idea and can lead to problems in the future. On the other hand, if I decide to use a virtual environment, then I need to activate that virtual environment each time I want to run my tool. Not the most convenient solution either. It turns out that `pipx` tool can solve this problem. It installs Python packages into separate environments (so there is no risk that their dependencies will clash). But, at the same time, CLI commands provided by those tools are available globally. So I don’t have to activate anything - `pipx` will do this for me! If you want to learn more about Python tools and see how I use them, I've made a video for PyCon 2020 conference called _"Modern Python Developer's Toolkit"_. [![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-pycon.jpg)](https://www.youtube.com/watch?v=WkUBx3g2QfQ) It's a two-hour-long tutorial on how to set up a Python development environment, which tools to use, and finally - how to make a TODO application from scratch (with tests and documentation). You can find [it on YouTube](https://www.youtube.com/watch?v=WkUBx3g2QfQ). ### [ctop](https://github.com/bcicen/ctop) and [lazydocker](https://github.com/jesseduffield/lazydocker) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-ctop.gif) ctop in action (source: https://github.com/bcicen/ctop) Both of those tools are useful when you are working with Docker. `ctop` is a top-like interface for Docker containers. It gives you: * A list of running and stopped containers * Statistics like memory usage, CPU, and an additional detailed window for each container (with open ports and other information) * A quick menu to stop, kill, or show logs of a given container It’s so much nicer than trying to figure out all this information from `docker ps`. ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-lazydocker.gif) lazydocker is my favorite Docker tool (source: https://github.com/jesseduffield/lazydocker) And if you think that `ctop` was cool, wait until you try `lazydocker`! It’s a full-fledged terminal UI for managing Docker with even more features. My favorite tool when it comes to Docker! Apart from the tools that I use almost every day, there are some that I collected over the years and found them particularly useful for specific tasks. There is something to record GIFs from the terminal (that you can pause and copy text from!), list directory structure, connect to databases, etc. ### [Homebrew](https://brew.sh/) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-homebrew.jpg) Homebrew needs no introduction if you are using a Mac. It’s a _de facto_ package manager for macOS. It even has a GUI version called [Cakebrew](https://www.cakebrew.com/). ### [asciinema](https://asciinema.org/) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-asciinema.jpg) `asciinema` is a tool that you can use to record your terminal sessions. But, unlike recording GIFs, it will let your viewers select and copy the code from those recordings! It’s a great help for recording coding tutorials - not many things are as frustrating as typing long commands because the instructor didn’t provide you with code snippets. ### [colordiff](https://www.colordiff.org/) and [diff-so-fancy](https://github.com/so-fancy/diff-so-fancy) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-colordiff.jpg) colordiff brings some colors to your diffs I rarely do diffs (compare differences between two files) in the terminal anymore, but if you need to do one, use `colordiff` instead of the unusable `diff` command. `colordiff` colorizes the output, so it’s much easier to see the changes instead of trying to follow all the “<” and “>” signs. ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-diff-so-fancy.jpg) diff-so-fancy - even better alternative to colordiff For running `git diff` and `git show` commands, there is an even better tool called [diff-so-fancy](https://github.com/so-fancy/diff-so-fancy). It further improves how the diff looks like by: * highlighting changed words (instead of the whole lines) * simplifying the headers for changed files * stripping the + and - symbols (you already have colors for this) * clearly indicating new and deleted empty lines ### tree (`brew install tree`) If you want to present the content of a given directory, `tree` is a go-to tool to do that. It displays all the subdirectories and files in a nice, tree-like structure: ``` $ tree . . ├── recovery.md ├── README.md ├── archive ├── automator │ ├── Open\ Iterm2.workflow │ │ └── Contents │ │ ├── Info.plist │ │ ├── QuickLook │ │ │ └── Thumbnail.png │ │ └── document.wflow │ └── Start\ Screen\ Saver.workflow ├── brew-cask.sh ``` ### [bat](https://github.com/sharkdp/bat) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-bat.jpg) Like `cat` (command most commonly used to display the content of a file in a terminal) but better. Adds syntax highlighting, git gutter marks (when applicable), automatic paging (if the file is large), and in general, makes the output much more enjoyable to read. ### [httpie](https://httpie.org/) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-httpie.gif) httpie in action (source: https://httpie.org/) If you need to send some HTTP requests and you find `curl` unintuitive to use, try `httpie`. It’s an excellent alternative. It’s easier to use with sensible defaults and simple syntax, returns a colorized output, and even supports installing additional plugins (for different types of authentication). ### [tldr](https://tldr.sh/) Simplified man pages. _“man pages”_ contain manuals for Linux software that explain how to use a given command. Try running `man cat` or `man grep` to see an example. They are very detailed and sometimes can be difficult to grasp. So `tldr` is a community effort to extract the essence of each man page into a brief description with some examples. `tldr` works for the most popular software. As I said, it’s a community effort, and there is a slim chance that someone will document an obscure package for you. But when it works, the information it provides usually contains what you are looking for. For example, if you want to create a gzipped archive of a few files, `man tar` will overwhelm you with the possible options. `tldr tar` will instead list some common examples - the second one being exactly the thing that you want to do: ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-tldr.jpg) man pages are great, but sometimes using tldr will be much faster to find a specific information ### [exa](https://the.exa.website/) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-exa.jpg) `exa` can be a replacement for the `ls` command. It’s colorful, displays additional information like the git status, automatically converts file size to human-readable units, and all that while staying equally fast to `ls`. Even though I like it and recommend it, for some reason, I still stick with `ls` instead. Muscle memory, I guess? ### [litecli](https://litecli.com/) and [pgcli](https://www.pgcli.com/) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-litecli.gif) My go-to CLI solutions for SQLite and PostgreSQL. With the auto-completion and syntax highlighting, they are much better to use than the default `sqlite3` and `psql` tools. ### [mas](https://github.com/mas-cli/mas) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-mas.jpg) `mas` is a CLI tool to install software from the App Store. I used it once in my life - when I was setting up my Macbook. And I will use it to set up my next Macbook too. `mas` lets you automate the installation of software in macOS. It saves you from _a lot_ of clicking. And, since you are reading an article about CLI tools, I assume that - just like me - you don’t like clicking. I keep a list of apps installed from the App Store in my “disaster recovery” scripts. If something bad happens, I hopefully should be able to reinstall everything with minimal hassle. ### [ncdu](https://dev.yorhel.nl/ncdu) ![](https://switowski.com/assets/img/posts/img_2020-06-18-cli-ncdu.jpg) Disk usage analyzer for the terminal. Fast and easy to use. My default tool when I need to free some space (_“Ohh, I’m sure that 256GB of disk space will be plenty!”_). That’s all folks ---------------- It was a long list, but hopefully, you discovered something new today. Some of the tools like the `fd`, `ripgrep`, or `httpie` are improved versions of things that you probably already know. Except that the new versions are easier to use, they provide better output, and sometimes are actually faster. So don’t cling to old tools only because everyone else is using them. A common argument for sticking with the _“standard Linux tools”_ that I hear is: _But what if you need to log in to a Linux server and do some work there? You won’t have access to your fancy tools. It’s better to learn how to use tools that come built-in with most Linux distributions._ When was the last time you had to log in to a Linux server? One where you can’t install software, but you had to debug some issues manually? I don’t even remember. Not many people do that anymore. Maybe it’s time to rethink how you do the deployment and move away from manual work into something more scalable? Don’t let your tool-belt get rusty and add some new CLI tools there!
Jonny
2021年9月16日 11:51
257
0 条评论
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
如遇文档失效,可评论告知,便后续更新!
【腾讯云】2核2G云服务器新老同享 99元/年,续费同价
【阿里云】2核2G云服务器新老同享 99元/年,续费同价(不要✓自动续费)
【腾讯云】2核2G云服务器新老同享 99元/年,续费同价
【阿里云】2核2G云服务器新老同享 99元/年,续费同价(不要✓自动续费)
Markdown文件
Word文件
PDF文档
PDF文档(打印)
分享
链接
类型
密码
更新密码
有效期