# 查看系统时间
date

#格式化输出系统时间(-可以使用其他符号替换)
date "+%Y-%m-%d %H:%M:%S"

#设置时间
date -s "2001-11-10 20:18:43"

#加日
date -d "+1 day" '+%Y-%m-%d'
#加月
date -d "+ 1 month" '+%Y-%m-%d'
#加年
date -d "+ 1 year" '+%Y-%m-%d'
#指定日期加
date -d "2022-01-06 +1 year" '+%Y-%m-%d'

#同步网络时间cn.pool.ntp.org为中国国家授时中心服务器地址
ntpdate cn.pool.ntp.org

#查看当前网络信息
ifconfig

手动更改ip地址步骤如下:
编辑网卡配置文件——vi /etc/sysconfig/network-scripts/ifcfg-eth0



#重启网络服务
service network restart
#开启网络服务
service network start
#关闭网络服务
service network stop
设置主机名与主机映射:
#查看主机名
hostname

#修改主机名,更改红线处即更改主机名
vi /etc/sysconfig/network

#配置主机映射
vi /etc/hosts

#ping命令测试
ping cy

拓展:
外部win10ping主机ping不通解决方案:

#查看系统运行级别
runlevel

#修改系统运行级别
vi /etc/inittab

将id:后的5改为3,重启linux将不再加载桌面,效果图如下:

防火墙相关命令(CentOS6版本)如下:
#查看防火墙状态
service iptables status
#开启防火墙
service iptables start
#关闭防火墙
service iptables stop
#重启防火墙
service iptables restart
#永久关闭防火墙
chkconfig iptables off
#永久关闭后重启
chkconfig iptables on
一个应用运行的背后往往有很多进程
#查看系统所有进程详细信息
ps -ef

#杀进程
kill 进程编号
#强制杀进程
kill -9 进程编号
#杀死所有同名进程
killall 进程名



命令1|grep命令可以理解为将命令1得到的结果作为参数传递给grep,grep再进行进一步的筛选
#查找文件a中带a的行
grep 查找字符 文件名

#查找进程名带events的进程
ps -ef| grep events

#查看网络端口使用情况
netstat -tunlp


截图中若出现^C符号则均为个人截图脚本所致,请忽略