linux基础
linux基础
第一个命令
# 查询版本号
[root@linuxstudy Desktop]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.0 (Maipo)
密码重置(centos7)
1.reboot system,选择系统的时候点e进入内核编辑模式;
-
linux16 【内核相关参数】的最后一行加上rd.break,以修改参数和密码;
mount -o remount,rw /sysroot
chroot /sysroot
passwd
# 重置密码
touch /.autorelabel
exit
reboot
安装软件包
# 安装
rpm -ivh file.rpm
# 升级
rpm -Uvh file.rpm
# 卸载
rpm -e file.rpm
# 查询描述信息
rpm -qpi file.rpm
# 列出文件信息
rpm -qpl file.rpm
# 查询文件属于哪个RPM的命令格式
rpm -qf file
yum

# 列出所有仓库
yum repolist all
# 列出所有软件
yum list all
# 软件信息
yum info softname
# 安装
yum insstall softname
# 更新
yum update softname
# 重装
yum reinstall softname
# 清除软件
yum remove softname
yum clean all
yum check update
yum grouplist
yum groupinstall
yum groupremove
yum groupinfo
Systemd 系统初始化进程
# 切换到多用户无图形
[root@linuxstudy Desktop]# ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
服务生命周期
systemctl start xxx.service
systemctl stop xxx.service
systemctl status xxx.service
systemctl restart xxx.service
systemctl reload xxx.service
开机启动
systemctl enable xxx.service
systemctl disable xxx.service
systemctl is-enabled xxx.service
# 查询各个级别的服务情况
systemctl list-unit=files --type=service

浙公网安备 33010602011771号