做网站一个月需要多少钱,响应式网站 cms,端子网站建设,免费linux云服务器本节所讲内容#xff1a;Linux终端介绍Shell提示符Bash Shell基本语法基本命令的使用#xff1a;ls、pwd、cd查看系统和BIOS硬件时间Linux如何获得帮助Linux关机命令#xff1a;shutdow、init等Linux 7个启动级别创建一个方便快捷实验环境快照设置服务器在来电后自动开机Lin… 本节所讲内容Linux终端介绍Shell提示符Bash Shell基本语法基本命令的使用ls、pwd、cd查看系统和BIOS硬件时间Linux如何获得帮助Linux关机命令shutdow、init等Linux 7个启动级别创建一个方便快捷实验环境快照设置服务器在来电后自动开机 Linux终端介绍tty控制台终端 pts虚拟终端tty1-tty6 如是一开始进入的是图形图面tty1 就是图形界面。图形界面切换到字符界面终端 Ctrl(Shift)AltF2-6 FnAltF1pts虚拟终端ctrlshiftT Alt 数字键放大ctrlshift 缩小ctrl -[rootlocalhost ~]# ps -aux | grep pts
Warning: bad syntax, perhaps a bogus -? See /usr/share/doc/procps-3.2.8/FAQ
root 2919 0.0 0.1 108300 1884 pts/0 Ss 10:27 0:00 /bin/bash
root 2948 0.0 0.1 110228 1184 pts/0 R 10:29 0:00 ps -aux
root 2949 0.0 0.0 103240 864 pts/0 S 10:29 0:00 grep pts pts(pseudo-terminalslave) 伪终端 通过ssh相关工具连接上后显示出来终端为pts Shell提示符[rootlocalhost ~]#[用户主机名 当前目录名称 ] 提示符 root为# 普通用户为$ Bash Shell基本语法 总结Linux命令输入规律如何输入命令命令 [选项][参数] [选项的值][参数的值] 空格作为分割Ls-l/root基本命令ls 命令作用查看当前目录下有哪些文件语法ls 目录 如果不加目录查看当前目录参数-l 显示详细信息 系统里面的快捷方式#llls -l-a显示隐藏文件 -d 查看目录(不查看里面的内容)-h 增强可读性[rootlocalhost ~]# ls -l /root
[rootlocalhost ~]# ll -h /etc/passwd
-rw-r--r-- 1 root root 1.6K Aug 25 21:27 /etc/passwdlinux系统中不同的颜色代表了不同的文件类型 蓝色 目录/etc黑色 文件/etc/passwd浅蓝色 链接/etc/grub2.cfg红色 压缩包boot.tar.gz 绿色 可执行文件/etc/init.d/network黑底黄字设备文件/dev/sda pwd作用查看当前目录语法pwd 没有参数 cd作用切换目录语法cd 目录名例#cd 回到用户自己的主目录#cd ~ 回到用户自己的主目录#cd - 回到上一个目录 查看系统和BIOS硬件时间 指的是bios时间 格里尼兹天文台 [rootlocalhost sysconfig]# hwclock
Tue 25 Aug 2015 10:06:06 PM CST -0.204632 seconds Linux如何获得帮助方法1加参数-h 或--help[rootlocalhost ~]# shutdown –-help
[rootlocalhost ~]# fdisk -h
Man
[rootlocalhost ~]# man find help 查看内部命令帮助信息--help 查看外部命令帮助信息 关机命令shutdown、 init 、reboot poweroffshutdown作用关机重启定时关机语法shutdown [选项]有如下选项-r 重新启动计算机-h 关机-h 时间 定时关机-c 取消之前的定时关机 或ctrlc [rootlocalhost ~]# shutdown -h 10
10分钟之后关机
[rootlocalhost ~]# shutdown -h 23:00
指定具体的时间点进行关机
[rootlocalhost ~]# shutdown -h now
立即关机
shutdown -r now 立即重启
shutdown -r 10 #10 分钟以后重启
shutdown -r 2222 # 22:22 以后重启init 命令作用切换系统运行级别语法init 0-6 例init 0命令用于立即将系统运行级别切换为0即关机init 6命令用于将系统运行级别切换为6即重新启动。 Linux 7个启动级别0 系统停机模式系统默认运行级别不能设置为0否则不能正常启动机器关闭。1 单用户模式root权限用于系统维护禁止远程登陆就像Windows下的安全模式登录。2 多用户模式没有NFS网络支持。3 完整的多用户文本模式有NFS登陆后进入控制台命令行模式。4 系统未使用保留一般不用在一些特殊情况下可以用它来做一些事情。例如在笔记本电脑的电池用尽时可以切换到这个模式来做一些设置。5 图形化模式登陆后进入图形GUI模式X Window系统。6 重启模式默认运行级别不能设为6否则不能正常启动。运行init 6机器就会重启。 启动级别配置RHEL7不再使用/etc/inittab文件进行默认的启动级别配置systemd使用比sysvinit的运行级更为自由的target替代。第3运行级用multi-user.target替代。第5运行级用graphical.target替代。runlevel3.target和runlevel5.target分别是指向 multi-user.target和graphical.target的符号链接。 切换运行级别 切换到第3运行级[rootlocalhost ~]# systemctl isolate multi-user.target
或
[rootlocalhost ~]# systemctl isolate runlevel3.target
切换到第5运行级
[rootlocalhost ~]# systemctl isolate graphical.target
或
[rootlocalhost ~]# systemctl isolate runlevel5.target 设置默认的运行界别systemd使用链接来指向默认的运行级别。在创建新的链接前可以通过下面命令删除存在的链接 rm /etc/systemd/system/default.target默认启动级别3[rootlocalhost ~]# ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
或
[rootlocalhost ~]# systemctl -f enable multi-user.target
默认启动级别5
[rootlocalhost ~]# ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
或
[rootlocalhost ~]# systemctl -f enable graphical.target 查看当前的运行级别runlevel[rootlocalhost ~]# runlevel
N 5 创建一个方便快捷实验环境快照配置好静态IP地址关闭iptables防火墙关闭selinux,光盘自动挂载配置好yum仓库 1配置IP地址RHEL7中弱化了setup的功能对于网络管理来说network服务的功能弱化主要通过NetworkManage对网络进行管理RHEL7通过nmtui修改网络配置RHEL7默认安装前提是需要开启NetworkManager.service 才可以使用首先确认NetworkManager服务器正常运行[rootlocalhost ~]# systemctl status NetworkManager
NetworkManager.service - Network ManagerLoaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled)Active: active (running) since Wed 2015-11-25 19:02:52 CST; 3min 10s ago 1、修改配置[rootlocalhost ~]# nmtui-edit eno16777736 2、激活网络配置[rootlocalhost ~]# nmtui 或者[rootlocalhost ~]# systemctl restart network 2关闭防火墙并设置为开机自动关闭[rootlocalhost ~]# systemctl stop firewalld
[rootlocalhost ~]# systemctl disable firewalld3关闭selinux查看selinux服务开启状态[rootlocalhost ~]# getenforce
Disabled
[rootlocalhost ~]# vim /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUXdisabled
# SELINUXTYPE can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPEtargeted临时强制关闭selinux[rootlocalhost ~]
# setenforce 0没基础的同学仅供了解光盘自动挂载[rootlocalhost ~]# vim /etc/fstab
/dev/sr0 /mnt iso9660 defaults 0 0配置好yum仓库[rootlocalhost ~]# cd /etc/yum.repos.d/
[root localhost yum.repos.d]# vim rhel-source.repo
[rhel-yum]
nameRed Hat Enterprise Linux $releasever - $basearch - Source
baseurlfile:///mnt/
enabled1
gpgcheck0 开机按首先按Del F2进入BIOS 选择Integrated Peripharals中的SuperIO Device 将其中的Restore On AC Power Loss选项修改:Power On 若要加电不开机选择Power Off若要加电之前断电状态选择Last State 最后按F10保存退出即可 学习过程中如果问题请留言。更多内容请加学神IT-linux讲师-RM老师QQ2805537762 学神IT-戚老师QQ3341251313 学神IT-旭斌QQ:372469347学神IT教育RHEL7交流群468845589 转载于:https://blog.51cto.com/xuegodlinux/1716975