1.系统安装与首次登录
本章同步视频:https://edu.51cto.com/sd/e4874
1.1 Linux文化
1.2 Linux安装
1.2.1 VMWare安装
https://edu.51cto.com/sd/e4874
1.2.2 RHEL7安装
https://edu.51cto.com/sd/e4874
1.3 首次登录
1.3.1 图形界面登录
[root@localhost ~]# tty #查看当前终端
1.3.2 文本界面登录
1.3.3 运行级别
# 2 - 多用户,但是没有NFS 进入无网络服务的多用户模式
# 4 - 没有用到 ,一般不用,在一些特殊情况下可以用它来做一些事情。
[root@localhost ~]# init N #N为需要切换的级别。
[root@localhost ~]# cat /etc/inittab
multi-user.target: analogous to runlevel 3
graphical.target: analogous to runlevel 5
[root@localhost ~]# systemctl get-default
[root@localhost ~]# systemctl set-default multi-user.target
#默认启动到文本界面
[root@localhost ~]# systemctl set-default graphical.target
#默认启动到图形界面
1.4 命令下达
1.4.1 命令格式
[root@localhost ~]# command [-options] parameter1 parameter2 ...
1.4.2 date - print or set the system date and time
date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
[root@localhost ~]# date +%Y/%m/%d
[root@localhost ~]# date +%H:%M
1.4.3 cal - display a calendar
cal [options] [[[day] month] year]
[root@localhost ~]# cal 2 2020
[root@localhost ~]# cal 25 2 2020
1.4.4 locale - get locale-specific information
LC_IDENTIFICATION="en_US.UTF-8"
[root@localhost ~]# echo $LANG
[root@localhost ~]# cat /etc/locale.conf
[root@localhost ~]# localectl status
[root@localhost ~]# localectl list-locales
[root@localhost ~]# localectl set-locale.utf8
[root@localhost ~]# localectl set-locale.utf8
1.4.5 排错
bash: Date: command not found...
[root@localhost ~]# cal 13 2020
cal: illegal month value: use 1-12
[root@localhost ~]# cal -l 2020
cal [options] [[[day] month] year]
-1, --one show only current month (default)
-3, --three show previous, current and next month
-s, --sunday Sunday as first day of week
-m, --monday Monday as first day of week
-j, --julian output Julian dates
-y, --year show whole current year
-V, --version display version information and exit
-h, --help display this help text and exit
1.4.6 热键
[root@localhost ~]# ca[tab][tab]
[root@localhost ~]#date --[tab][tab]
1.5 帮助系统
1.5.1 man - an interface to the on-line reference manuals
1.5.2 info - read Info documents
1.5.3 help
[root@localhost ~]# date --help
1.6 关机
1.6.1 sync - flush file system buffers
1.6.2 shutdown - Halt, power-off or reboot the machine
shutdown [OPTIONS...] [TIME] [WALL...]
[root@localhost ~]# shutdown -h now
[root@localhost ~]# shutdown -h 10 'I will shutdown after 10 mins'
[root@localhost ~]# shutdown -h 20:25
[root@localhost ~]# shutdown -r now
[root@localhost ~]# shutdown -k now 'This system will reboot'
[root@localhost ~]# shutdown -c
1.6.3 halt, poweroff, reboot - Halt, power-off or reboot the machine
1.6.4 systemctl
[root@localhost ~]# systemctl poweroff
[root@localhost ~]# systemctl halt
[root@localhost ~]# systemctl reboot
1.6.5 init
[root@localhost ~]# init 0 #关机
[root@localhost ~]# init 6 #重启
1.6.6 注意事项
[calflyok@localhost sbit]$ shutdown -h
1.7 总结
l 养成良好的操作习惯,尽量不要使用 root 直接登入系统;
l 预设情况下,Linux提供tty1~tty6的终端机界面;
l 在终端机环境中,可依据提示字符为$或#判断为一般账号或root账号;
l date可显示日期、cal可显示日历、bc可以做为计算器软件;
l [tab]按键可做为(1)命令补齐 (2)档名补齐 (3)参数选项补齐;
l 系统需正确的关机,可使用shutdown, poweroff等指令关机。