Linux 教程

Linux 是什么、为什么后端必须会,以及一台新机器上手先做哪几件事。

Beginner
Key PointsLinux 是服务器上的默认操作系统;后端要会的是:看进程、看日志、看磁盘、改配置、管权限。

Linux 是什么

Strictly, Linux is only the kernel. What you install is a distribution — kernel plus GNU tools, a package manager and an init system: Ubuntu, Debian, Rocky, Alpine. Commands are largely the same; the differences are packaging and defaults.

为什么后端必须会

TaskWhat you need
Service is slowtop, iostat, ss, strace
Disk fulldf, du, lsof
Can't connectss -lntp, curl -v, tcpdump
Deploy a servicesystemctl, journalctl, 权限, 环境变量
Read logstail -f, grep, awk, less

新机器上手五件事

Bash
uname -a                 # 内核与架构
cat /etc/os-release      # 发行版与版本
df -h                    # 磁盘剩余
free -h                  # 内存
systemctl status ssh     # SSH 是否在跑

学习路线

  1. 安装与登录 —— 本地装、云主机、WSL
  2. 目录与文件 —— 结构、权限、增删改查
  3. 用户与磁盘 —— 账号、组、挂载
  4. 编辑器与包管理 —— vim、yum/apt
  5. Shell 脚本 —— 变量、判断、循环、函数、重定向
Do not memorise commands. Remember the problem, then read man or --help. Only twenty-odd commands really matter.

Friends & Partners