关机重启
关机
[root@gaofeng ~]# shutdown -h 10 #10分钟之后关机 以分钟为级别
[root@gaofeng ~]# shutdown -h now #立刻关机
[root@gaofeng ~]# shutdown -h 0 #立刻关机
[root@gaofeng ~]# shutdown -h 10:00 #定时关机
[root@gaofeng ~]# init 0 #立刻关机 通过切换运行级别进行关机
[root@gaofeng ~]# poweroff #立刻关机
[root@gaofeng ~]# halt #只关闭系统,需要手动关闭电源
[root@gaofeng ~]# halt -p #完全关闭主机
重启
[root@gaofeng ~]# shutdown -r now #立刻重启
[root@gaofeng ~]# shutdown -r 0 #立刻重启
[root@gaofeng ~]# shutdown -r 10 #10分钟之后进行重启
[root@gaofeng ~]# shutdown -r 10:05 #指定时间进行重启
[root@gaofeng ~]# init 6 #立刻重启,根据运行级别
[root@gaofeng ~]# reboot #立刻重启
[root@gaofeng ~]# exit #退出当前登录的用户 既能退出登录式也能退出非登录式 主要用于脚本退出
注销命令 退出当前登录的用户
Ctrl键 + d #注销 快捷键帮你执行了一个logout命令
显示系统IP地址的命令
[root@gaofeng ~]# ip address ====ip a #显示所有网卡的IP地址
[root@gaofeng ~]# ip a s eth0 #现实指定的网卡ip
[root@gaofeng ~] ifconfig #系统中没有这个命令 -bash: ifconfig: command not found
[root@sh-qls ~]# ping www.baidu.com #测试网络的情况 PING www.a.shifen.com (180.101.49.12) 56(84) bytes of data. 64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=1 ttl=128 time=13.7 ms 64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=2 ttl=128 time=21.0 ms 64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=3 ttl=128 time=10.5 ms 64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=4 ttl=128 time=10.6 ms 64 bytes from 180.101.49.12 (180.101.49.12): icmp_seq=5 ttl=128 time=10.1 ms ^C --- www.a.shifen.com ping statistics --5 packets transmitted, 5 received, 0% packet loss, time 4007ms rtt min/avg/max/mdev = 10.171/13.235/21.044/4.108 ms
[root@gaofeng ~]# yum install -y net-tools #安装ifconfig命令的软件包
[root@gaofeng ~]# ifconfig #显示所有网卡的命令
[root@gaofeng ~]# ifconfig ens33 #获取指定某块网卡的指令
[root@gaofeng ~]# hostname #显示主机名的命令 sh-qls
[root@gaofeng ~]# hostname -i #显示IP地址 ipv6 和 ipv4地址 fe80::6bf3:9ee8:ce2d:a23d%ens33 10.0.0.200
[root@gaofeng ~]# hostname -I #只显示IPv4地址
#只显示IPv4地址
[root@gaofeng ~]# hostname -I
10.0.0.100
#如何获取到公网地址
[root@gaofeng ~]# curl ifconfig.me
139.226.13.64
[root@gaofeng ~]# curl cip.cc
IP : 139.226.13.64
地址 : 中国 上海
运营商 : 联通
数据二 : 上海市 | 联通
数据三 : 中国上海上海 | 联通
URL : http://www.cip.cc/139.226.13.64
基础不牢!地动山摇
文件管理概述
创建 复制 移动 删除 查看 编辑 压缩
windows
C:\Users\DELL\Documents\linux 笔记\第一个月\第二周笔记
linux
所有的文件 或者目录的起点或者顶点都是一 根 (/)开始的
linux目录结构倒挂的树形结构
linux中重要的相关文件或者目录
[root@sh-qls ~]# ls -1 /
/ #所有Linux系统的顶点目录
/boot #存放是系统启动相关文件 内核 引导程序 引导目录
/dev #设备目录文件
/dev/cdrom == #系统光盘镜像
/dev/sr0
/dev/null #黑洞设备 类似于垃圾回收站 只进不出 只接受数据
/dev/random #生成随机数的设备
RANDOM 随机数的变量
/dev/zero #能够源源不断产生字符设备
/dev/pts #虚拟登录的终端目录
/dev/stderr #错误输出设备
/dev/stdin #标准输入
/dev/stdout #标准输出
/etc #非常重要,所有服务的配置目录 系统主要配置目录
/etc/sysconfig/network-scripts/ifcfg-eth0 #网卡配置文件
/etc/hostname #系统主机名配置文件
/etc/resolv.conf #系统DNS配置文件
/etc/hosts #IP地址和主机名的映射关系文件 本地域名解析配置文件
/home #普通用户的家目录都在这个目录下面 /home/user
/media #挂载目录 挂载一些可移动设备 CD 相机 了解
/mnt #提供临时挂载的目录
/opt #早期第三方厂商软件的安装目录
/proc #反映系统当前进程的实时状态
/root #超级管理员root的家目录
/run #存放程序运行后所产生的pid文件
/srv #物理设备产生的一些文件 了解
/sys #硬件设备的驱动程序信息 了解
/tmp #系统临时目录 类似于公共场所 系统会定时删除这个目录下长时间没有访问的文件
/usr #系统主要程序目录 相当于C盘的windows
/usr/local #系统默认软件安装目录 C:\Program
/usr/bin #系统中普通用户所能使用的命令
/usr/sbin #管理员所使用的命令
/usr/lib #库文件 32位
/ust/lib64 #库文件 64位
/var #存放系统可变的信息目录
/var/log #存放是系统日志目录
/var/log/messages #系统日志
/var/log/socure #系统用户登录日志
/var/run #进程产生的pid文件
/var/tmp #进程产生的临时文件
软链接文件
/bin === /usr/bin
/sbin === /usr/sbin
文件名称及所在的位置,我们称之为路径 /etc/hosts 路径就是系统对文件进行定位的一种方式
不同的路径下,文件名是可以相同的
相同路径下,不能有相同名称的文件
linux中,一切皆文件
#每个目录下面都有一个.和.. 他们是干什么
. #一个点代表的是当前的目录
.. #两个点代表的是当前目录的上一级目录
#什么是绝对路径,什么又是相对路径
只要是从/开始的路径或者以~为开始路径,就是绝对路径
不是以根为开始的路径或者~开始的路径就是相对路径
[root@gaofeng ~]# ll /etc/hosts #绝对路径
[root@gaofeng /etc]# ll hosts #相对路径