Linux常用命令

查看所有用户

cat /etc/passwd |cut -f 1 -d :

Linux 创建Swap交换分区

 mkdir -p /var/_swap_
 cd /var/_swap_
 #Here, 1M * 2000 ~= 2GB of swap memory
 dd if=/dev/zero of=swapfile bs=1M count=2000
 mkswap swapfile
 swapon swapfile
 echo "/var/_swap_/swapfile none swap sw 0 0" >> /etc/fstab
 free -m

查看系统版本信息

lsb_release -a

Ubuntu任务栏放在底部

gsettings set com.canonical.Unity.Launcher launcher-position Bottom

查找软件的配置文件路径

cat /var/lib/dpkg/info/<package>.conffiles

格式化分区

mkfs -t ext4 -c /dev/sda3

系统备份

tar cvpzfP backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backup.tgz --exclude=/mnt --exclude=/sys /

家目录改为英文

export LANG=en_US
xdg-user-dirs-gtk-update

Ubuntu开启Root登录

第一步:设置好root密码,sudo passwd root
第二步:gedit /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
修改配置文件在最后加上:greeter-show-manual-login=true
第三步:重新启动
第四步:修改gedit /root/.profile,避免 错误提示为:Error found when loading /root/.profile stdin: is not a tty 的提示
在/root/.profile中添加 tty -s && mesg n

  • Ubuntu语言设置汉语无法移动
    1.gedit /etc/default/locale
    2.LANG="zh_CN.UTF-8"
    LANGUAGE="zh_CN:zh"

配置无线网络

wpa_passphrase SSID PASSWD > /etc/wifi.conf

wpa_supplicant -D nl80211 -i wlp2s0-c /etc/wifi.conf -B

对应有线网卡的配置,新增无线网卡配置
vim /etc/network/interfaces

极速创建大文件

10G文件创建:dd if=/dev/zero of=bigfile bs=1024k count=1 seek=10000

  • GPG 加解密
  • 加密:gpg -c file,完成后会生成加密文件file.gpg
  • 解密:gpg -o file -d file.gpg

静态IP

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto enp0s25
iface enp0s25 inet static
address 192.168.1.88
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameserver 192.168.1.1

禁用自动更新

(1)

systemctl stop apt-daily.service
systemctl stop apt-daily.timer
systemctl stop apt-daily-upgrade.service
systemctl stop apt-daily-upgrade.timer
systemctl disable apt-daily.service
systemctl disable apt-daily.timer
systemctl disable apt-daily-upgrade.service
systemctl disable apt-daily-upgrade.timer

(2)修改自动更新程序的配置文件也可以,同时更新 /etc/apt/apt.conf.d/10periodic /etc/apt/apt.conf.d/20auto-upgrades,将其值改为0

原文地址:https://www.cnblogs.com/steinven/p/9271503.html