查看中断、版本等信息
cat /proc/interrupts
cat /proc/version
查看系统gcc定义的宏
echo |gcc -E -dM -
U盘格式化
使用root用户
fdisk -l
mkfs.vfat /dev/sdb1
消除因在windows上打开导致的脚本中多^M符号问题
使用sed替换最后一个字符
sed -i 's/^M//g' xxx.sh
或
dos2unix xxx.sh (dos2unix将Windows格式文件转换为Unix)
grub中增加内核参数,点亮屏幕:
video=VGA-1:e video=VGA-2:e
linux系统密码复杂度,可以直接指定pam_pwquality模块参数:
即在/etc/pam.d/system-auth中的“password requisite pam_pwquality.so”行尾添加具体参数,
例如:
minlen=16 ucredit=-1 lcredit=-1 ocredit=-1 dcredit=-1
表示最小密码长度16位,数字,大小写字母,特殊字符均至少包含1位。
命令行创建虚拟机
1、qemu-img create -f qcow2 /kvmdata/centos7-1511.img size 10G
2、virt-install --virt-type=kvm --name=centos7-2 --vcpus=2 --memory=2048 --location=/root/iso/CentOS-8.1.1911-x86_64-dvd1.iso --disk path=/kvmdata/centos7-1511.img,size=10,format=qcow2 --network bridge=br0 --graphics none --extra-args='console=ttyS0' --force
查看系统开机启动服务所占时间:
systemd-analyze plot >1.svg
systemd-analyze -h
linux服务实例
[Unit]
Description=Test
DefaultDependencies=no
After=network.target
[Service]
ExecStart=/usr/local/sbin/test.sh
[Install]
WantedBy=multi-user.target graphical.target