根据文件名查找
find 路径 -name 文件名
压缩解压
tar -cvf 压缩后.tar *.jpg
tar -xzvf 压缩包.tar
授予文件全权限
chmod +777 文件名
修改文件夹拥有者
chown -R user folder
强制删除文件
rm -rf 文件名
防火墙
sudo ufw status #查看防火墙状态
sudo ufw allow 80 #开放特定端口
sudo ufw allow from 47.99.123.240 #允许特定IP地址连接服务器的所有端口
sudo ufw delete allow from 47.99.123.240 #删除上面那条规则
ubuntu重启apache
sudo /etc/init.d/apache2 restart
vim
:wq 保存退出
i 插入
shift+^ 快速行首
shift+$ 快速行尾
:%s/sub/subs/g 将所有的sub替换为subs
gnuplot
set term jpeg #将图片输出到文件
set output 'a.jpeg'
plot 'Graphene_12.DOS.Tetrahedron' w l
bc
typeset dd=$(echo "$d+0.3752"|bc) #小数运算
awk
awk -F" " 'BEGIN{ele=0} /m\+mul/{ele+=$6 ;print ele} END {print ele}' Graphene_BP_distance.out #打印有m+mul的一列数字和
eval $(awk '{ printf("x=%s",$1); }') #给外部变量x赋值
更新源
#备份配置文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
#打开文件
sudo vim /etc/apt/sources.list
#重开终端,查看版本代号
#Ubuntu 12.04 (LTS)代号为precise
#Ubuntu 14.04 (LTS)代号为trusty
#Ubuntu 15.04 代号为vivid
#Ubuntu 15.10 代号为wily
#Ubuntu 16.04 (LTS)代号为xenial
#Ubuntu 18.04 代号为bionic
lsb_release -c
#更新文件如下
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
#更新文件列表
sudo apt-get update