1、描述计算机的组成及其功能。

计算机由cpu,内存,io设备组成

cpu是由计算器和控制器组成。

常用io包括,键盘,显示器,磁盘,网卡

内存负责运行时数据存取

io主要用于数据输入输出

2按系列罗列Linux的发行版,并描述不同发行版之间的联系与区别

linux的主流发行版有debian,redhat,gentoo,slackware,suse,arch

Debian
ubuntu
mint
knopix
slackware
suse
opensuse
redhat
ehel
centos
fedore core
gentoo

archlinux

各发行版公用同一个linux内核。linux发行版分为个人版和企业版,区别主要是软件库不同,启动系统服务不同,开机启动项不同,网络配置方式不同。

3描述Linux的哲学思想,并按照自己的理解对其进行解释性描述。

linux哲学思想有:

1一切兼文件

2组合众多小程序完成复杂功能

4说明Linux系统上命令的使用格式;详细介绍ifconfig、echo、tty、startx、export、pwd、history、shutdown、poweroff、reboot、hwclock、date命令的使用,并配合相应的示例来阐述。

ifconfig:

   查看所有激活的网络配置 

[root@node1 ~]# ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0
ether 02:42:4f:1e:bb:83 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.198.141 netmask 255.255.255.0 broadcast 192.168.198.255
inet6 fe80::20c:29ff:fee9:100e prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:e9:10:0e txqueuelen 1000 (Ethernet)
RX packets 66941 bytes 4564903 (4.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 288472 bytes 18206331 (17.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 7734601 bytes 728193439 (694.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7734601 bytes 728193439 (694.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

查看某块网卡的网络配置:

[root@node1 ~]# ifconfig ens33
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.198.141 netmask 255.255.255.0 broadcast 192.168.198.255
inet6 fe80::20c:29ff:fee9:100e prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:e9:10:0e txqueuelen 1000 (Ethernet)
RX packets 66975 bytes 4567679 (4.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 288567 bytes 18214157 (17.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

查看所有网卡的网络配置,包括未激活:

[root@node1 ~]# ifconfig -a
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0
ether 02:42:4f:1e:bb:83 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.198.141 netmask 255.255.255.0 broadcast 192.168.198.255
inet6 fe80::20c:29ff:fee9:100e prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:e9:10:0e txqueuelen 1000 (Ethernet)
RX packets 67034 bytes 4571817 (4.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 288746 bytes 18225931 (17.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 7744705 bytes 729358117 (695.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7744705 bytes 729358117 (695.5 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

禁用某块网卡:

[root@node1 ~]# ifconfig docker0 down
[root@node1 ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.198.141 netmask 255.255.255.0 broadcast 192.168.198.255
inet6 fe80::20c:29ff:fee9:100e prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:e9:10:0e txqueuelen 1000 (Ethernet)
RX packets 67303 bytes 4593512 (4.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 289093 bytes 18263821 (17.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 7751096 bytes 729971860 (696.1 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7751096 bytes 729971860 (696.1 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

 


 


 

启用某块网卡:

[root@node1 ~]# ifconfig docker0 up
[root@node1 ~]# ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 0.0.0.0
ether 02:42:4f:1e:bb:83 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.198.141 netmask 255.255.255.0 broadcast 192.168.198.255
inet6 fe80::20c:29ff:fee9:100e prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:e9:10:0e txqueuelen 1000 (Ethernet)
RX packets 67402 bytes 4600878 (4.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 289299 bytes 18278599 (17.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 7754146 bytes 730141910 (696.3 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 7754146 bytes 730141910 (696.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

设置IP地址:

[root@node1 ~]# ifconfig docker0  172.17.0.1 netmask 255.255.255.0
[root@node1 ~]# ifconfig docker0
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.255.0 broadcast 172.17.0.255
ether 02:42:4f:1e:bb:83 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

取消multicast功能:

[root@node1 ~]# ifconfig docker0 -multicast
[root@node1 ~]# ifconfig docker0
docker0: flags=3<UP,BROADCAST> mtu 1500
inet 172.17.0.1 netmask 255.255.255.0 broadcast 172.17.0.255
ether 02:42:4f:1e:bb:83 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

启用multicast功能

[root@node1 ~]# ifconfig docker0 multicast
[root@node1 ~]# ifconfig docker0
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.255.0 broadcast 172.17.0.255
ether 02:42:4f:1e:bb:83 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

echo ,显示文字

[root@node1 ~]# echo "hello \n world"
hello \n world

 

[root@node1 ~]# echo -e "hello \n world"
hello
world

tty显示终端号

[root@node1 ~]# tty
/dev/pts/1

startx:启动图像界面

export:导出环境变量

[root@node1 ~]# b=1
[root@node1 ~]# c=2
[root@node1 ~]# bash
[root@node1 ~]# echo $b

[root@node1 ~]# exit
exit
[root@node1 ~]# export b
[root@node1 ~]# bash
[root@node1 ~]# echo $b
1
[root@node1 ~]# echo $c

[root@node1 ~]#

pwd打印当前工作目录:

[root@node1 ~]# pwd
/root
[root@node1 ~]#

history命令历史:

查看内存中命令历史:

[root@node1 ~]# history
12 history
13 cat .bash_history
14 history

清空内存中命令历史:

[root@node1 ~]# history -c
[root@node1 ~]# history
12 history
[root@node1 ~]#

命令历史记录文件:

more .bash_history

将内存中的命令历史追加到历史文件:

[root@node1 ~]# history -a

将内存中命令历史覆盖命令历史文件:

[root@node1 ~]# history -w
[root@node1 ~]# cat .bash_history
history
more .bash_history
history -a
cat .bash_history
history -a
history -w
[root@node1 ~]#

删除某一位置命令历史:

[root@node1 ~]# history
12 history
13 more .bash_history
14 history -a
15 cat .bash_history
16 history -a
17 history -w
18 cat .bash_history
19 history
[root@node1 ~]# history -d 18
[root@node1 ~]# history
12 history
13 more .bash_history
14 history -a
15 cat .bash_history
16 history -a
17 history -w
18 history
19 history -d 18
20 history

读取命令历史文件命令到内存中:

[root@node1 ~]# history -r
[root@node1 ~]# history
12 history
13 history -n
14 history
15 history -r
16 history
17 more .bash_history
18 history -a
19 cat .bash_history
20 history -a
21 history -w
22 history

相关环境变量:

[root@node1 ~]# echo $HISTFILE
/root/.bash_history
[root@node1 ~]# echo $HISTSIZE
1000
[root@node1 ~]#

shutdown关机:

关机取消关机:

[root@node1 ~]# shutdown
Shutdown scheduled for Sat 2018-06-23 11:42:41 CST, use 'shutdown -c' to cancel.
[root@node1 ~]#
Broadcast message from root@node1 (Sat 2018-06-23 11:41:41 CST):

The system is going down for power-off at Sat 2018-06-23 11:42:41 CST!

^C
[root@node1 ~]# shutdown -c
[root@node1 ~]#
Broadcast message from root@node1 (Sat 2018-06-23 11:41:51 CST):

The system shutdown has been cancelled at Sat 2018-06-23 11:42:51 CST!

重启:

shutdown -r

5分钟后重启,并提示信息

[root@node1 ~]# shutdown -r +5 "be careful going to reboot"
Shutdown scheduled for Sat 2018-06-23 11:51:58 CST, use 'shutdown -c' to cancel.
[root@node1 ~]#
Broadcast message from root@node1 (Sat 2018-06-23 11:46:58 CST):

be careful going to reboot
The system is going down for reboot at Sat 2018-06-23 11:51:58 CST!

 

poweroff:直接关机

 

reboot:重启

hwclock:硬件时钟

查看硬件时钟:

[root@node1 ~]# hwclock -r
Sat 23 Jun 2018 11:56:17 AM CST -0.287433 seconds

写入当前系统时间到硬件:

[root@node1 ~]# hwclock -w
[root@node1 ~]# hwclock -r
Sat 23 Jun 2018 11:57:26 AM CST -0.443789 seconds

设置硬件时钟为某个时间:

[root@node1 ~]# hwclock --set --date="2011-08-14 16:45:05"
[root@node1 ~]# hwclock -r
Sun 14 Aug 2011 04:45:12 PM CST -1.025827 seconds

date:显示设置系统时间

显示当前时间:

[root@node1 ~]# date
Sat Jun 23 12:02:48 CST 2018
[root@node1 ~]# date +'%Y-%m-%d %H:%M:%S %W' 
2018-06-23 12:10:58 25
[root@node1 ~]# date -d "tomorrow"
Sun Jun 24 12:08:34 CST 2018
[root@node1 ~]# date -d "yesterday"
Fri Jun 22 12:08:43 CST 2018
[root@node1 ~]# date -d "1 hour"
Sat Jun 23 13:08:48 CST 2018
[root@node1 ~]# date -d "2 day ago"
Thu Jun 21 12:08:54 CST 2018
[root@node1 ~]# date -d "3 month ago"
Fri Mar 23 12:08:59 CST 2018
[root@node1 ~]# date -d "2 year"
Tue Jun 23 12:09:04 CST 2020
[root@node1 ~]# date -d "last friday"
Fri Jun 22 00:00:00 CST 2018
[root@node1 ~]# date -d "next week"
Sat Jun 30 12:09:19 CST 2018
[root@node1 ~]# date -d "next month"
Mon Jul 23 12:09:26 CST 2018

设置时间:

[root@node1 ~]# date -s "20200101 10:01:10"
Wed Jan 1 10:01:10 CST 2020
[root@node1 ~]# date
Wed Jan 1 10:01:14 CST 2020

5、如何在Linux系统上获取命令的帮助信息,请详细列出,并描述man文档的章节是如何划分的。

获取命令帮助的方式有:

help command

man command

command --help 

info command

man各章节的含义:(数字表示章节)

1、所有用户可以使用的命令
2、系统内核调用,不是每个命令都有系统调用(如:man 2 read)
3、库调用
4、特殊文件,如:/dev/tty1
5、文件格式(命令配置文件的语法,如:man 5 passwd)
6、游戏相关
7、杂项

8、管理员命令,如:fdisk

6、请罗列Linux发行版的基础目录名称命名法则及功用规定

/bin  普通用户命令

/sbin 管理员命令

/etc 配置文件

/usr 用户安装程序位置

/opt 第三方程序

/proc 系统内存状态伪文件系统

/sys 伪文件系统

/boot 启动时使用到的文件

/tmp 临时目录

/root 管理员家目录

/home 用户目录根

/dev 设备文件目录

/mnt 挂载点目录

/var 可变状态存储