Linux
Linux 常用命令
常用命令
SSH
SSH 常用命令
1 2 3 4 5 6 7 8
| ssh-keygen
ssh-keygen -y -f <private_key_file> > <target_file>
cat <public_key> >> ~/.ssh/authorized_keys
systemctl enable sshd
|
SSH 配置项示例
1 2 3 4 5 6 7 8
| Host 127.0.0.1 HostName %h port 22 User linux IdentityFile ~/.ssh/private_key IdentitiesOnly yes StrictHostKeyChecking no UserKnownHostsFile=NUL
|
ufw 管理防火墙
1 2
| ufw status ufw allow <port>/[tcp,udp] [comment '<content>']
|
Tmux捕获当前pane的所有内容
1
| tmux capture-pane -pS - -e > pane.txt
|
rsync的使用
1 2 3 4
| rsync -av <source> <dest>
rsync -av --ignore-existing <source> <dest>
|
EFI管理引导
1 2
| efibootmgr efibootmgr -b <bootnum> -B
|
Arch Linux + KDE的安装过程
联网
有线
无线
1 2
| rfkill unblock wlan0 iwctl
|
安装
- 关闭蜂鸣器
- 挂载分区
1
| mount <devPath> /boot/efi
|
- 切换根目录
- 安装系统软件
1
| pacstrap /mnt base base-devel linux linux-firmware grub efibootmgr os-prober iw dialog wpa_supplicant networkmanager ntfs-3g vim plasma kde-applications sddm sddm-kcm xorg xorg-server sudo gvfs-smb xorg-xinit intel-ucode xf86-video-intel //如果是 AMD 处理器和显卡,则把 intel-ucode 和 xf86-video-intel 改为 amd-ucode 和 xf86-video-ati、xf86-video-amdgpu。
|
- 保存挂载点
1
| genfstab -L /mnt > /mnt/etc/fstab
|
- 设置时间
1 2
| ln -sf /usr/share/zone/info/Asia/Shanghai /etc/localtime hwclock --systohc
|
- 修改 /etc/locale.gen 文件,把 en_US.UTF-8 和 zh*_*CN.UTF-8 前面的 # 去掉
1 2 3 4
| vim /etc/locale.gen
locale-gen echo LANG=en_US.UTF-8 > /etc/locale.conf
|
- 配置host:
计算机蓝牙地址名1
| echo 你的计算机蓝牙地址名 > /etc/hostname
|
修改 hosts 文件
添加以下内容1 2 3
| 127.0.0.1 localhost ::1 localhost 127.0.0.1 myhostname.localdomain myhostname
|
- 创建本地用户和密码:
1 2 3
| useradd -m -G wheel 你想起的小写全英文用户名 passwd passwd 你想起的小写全英文用户名
|
- 给刚创建的用户添加 sudo 权限
在“root ALL=(ALL) ALL”的下一行添加“你想起的小写全英文用户名 ALL=(ALL) ALL”
11. 安装 grub 引导
1 2
| grub-install --target=x86_64-efi --efi-directory=/boot/efi -bootloader-id=GRUB grub-mkconfig -o /boot/grub/grub.cfg
|