Tips in Linux

Menu:

Clear apt cache

1
sudo rm -v /var/cache/apt/archives/*.deb

镜像源公钥安装

1
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys # + 公钥名

获取CPU总核心数

1
2
3
echo $(grep -c ^processor /proc/cpuinfo 2>/dev/null)
# use
make -j $(grep -c ^processor /proc/cpuinfo 2>/dev/null)

Linux Console 默认信息

1
2
3
/etc/issue
/etc/update-motd.d/*
/run/motd.dynamic

shell script check permission

1
2
3
4
if [ $(id -u) -ne 0 ]; then
printf "Script must be run as root\n"
exit 1
fi

Startup customize

/etc/rc.local

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
guzal@GuzalAida:~/workspace$ cat /etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

/opt/GuzalAida/bin/displayinfo4lcd
exit 0
------ 文章已经结束,谢谢你的阅读 ------
------ article has ended,thank you for reading ------