常用Linux命令

--关机,重启命令

1.shutdown

shutdown -h now 立即关机
shutdown -h 10 10分钟后关机
shutdown -h 11:11 到点关机,-h改为-r就是重启了。
 
2.halt
halt 直接关机
 
3.reboot
reboot 重启
 
4.init
init 0 关机
init 1 重启
 
5.poweroff
poweroff 关机
 
2.软件管理,压缩,解压,补丁
1.apt-get
apt-get install packagename 安装软件
apt-get remove packagename 卸载软件
apt-get upgrade 更新全部安装的软件包
 
2.dpkg
dpkg -l 查看所有安装的软件包
 
3.tar
tar zcvf python.tar.gz python/ 把当前目录下的python文件夹打包成gzip文件
tar zxvf python.tar.gz 解压
 
4.diff
diff file1 file2 比较两个文件
diff -uN file1 file2 >file.patch 比较两个文件,生成补丁文件
diff -ruN dir1 dir2 >dir.patch 比较两个目录,生成补丁文件
 
5.patch
patch -p0 <file.patch 用生成的补丁文件给file1打补丁
patch -RE -p0 <file.patch 取消补丁,恢复file1文件
对应目录来说,需要先cd dir1,然后:
patch -p1 <../dir.patch
patch -R -p1 <../dir.patch 恢复补丁
 
原文地址:https://www.cnblogs.com/nucdy/p/5235998.html