Linux常用命令记录
显示ppid ,pgid等信息
ps -o ppid,pgid,pid,nice,user,args
systemd timer编写
查看系统timer
$ systemctl status *timer
1 编写/lib/systemd/system/my_monitor.service
[Unit]
Description=Logs system statistics to the systemd journal
Wants=my_monitor.timer
[Service]
User=sansi
Group=sansi
Type=oneshot
ExecStart=/usr/bin/free
ExecStart=/bin/lsblk
[Install]
WantedBy=multi-user.target
运行my_monitor.service
$ systemctl start my_monitor.service
查看运行状态
systemctl status my_monitor.service
如果中途有修改my_monitor.service的内容,运行systemctl daemon-reload
重新加载配置
2 编写/lib/systemd/system/my_monitor.timer
[Unit]
Description=Logs some system statistics to the systemd journal
Requires=my_monitor.service
[Timer]
Unit=my_monitor.service
OnCalendar=*-*-* *:*:00
[Install]
WantedBy=timers.target
开启
systemctl start my_monitor.service
查看service运行输出:
journalctl -S today -f -u my_monitor.service
使能开机自启动
$ systemctl enable my_monitor.timer
执行完上述命令会创建软链接 /etc/systemd/system/timers.target.wants/my_monitor.timer -> /lib/systemd/system/my_monitor.timer
软件安装
安装deb包
sudo dpkg -i deb文件名
安装过程中报告缺少库文件
根据经验,通常情况下会报依赖关系的错误,我们可以使用以下的命令修复安装。
sudo apt-get install -f
卸载
1、如果要卸载安装的应用我们通过“sudo dpkg -l”查看已经安装的软件,并找到自己的安装的软件名。
2、最后使用sudo dpkg -r 软件名
进行卸载。
linux环境下 unzip 解压文件名中文乱码
unzip -O cp936 文件名
tar.gz追加文件
gunzip file.tar.gz
tar rf file.tar append_file_name
gzip file.tar