听课笔记,文中没有详细的例子,所以没有多大参考价值,给自己看的。。。。
系统配置
1,init num:
init 0: poweroff
init 1: Emergency mode!(只能使用root用户登录)
init 5: 图像化
init 6: 重启
2,修改主机名:/etc/hostname
3,/etc/hostname 和 /etc/sysconfig/network 的区别
4,新装CentOS Minimal无法使用ping命令, 是因为网卡默认关闭
打开方式:/etc/sysconfig/network-scripts/ifcfg-xxx(eth0/ensxx),属性ONBOOT=yes
5,新装CentOS Minimal无法使用ifconfig命令, 是因为此版本没有安装ifconfig
安装即可:yum -y install net-tools
6,集群基本网络环境配置(VMware虚拟机环境,根据个人虚拟机环境自行配置):
1) 删掉MAC地址:HWADDR
2) 删掉UUID:UUID
3) IP获取方式由默认动态DHCP为手动指定静态IP:BOOTPROTO=DHCP 改为 BOOTRPOTO=static
4) 指定静态IP:192.168.20.11(其他节点分配为12,13,14)
5) 指定子网掩码:NETMASK=255.255.255.0
6) 配置网关:GATEWAY=192.168.20.2
7) 配置DNS:DNS1=114.114.114.114 DNS2=8.8.8.8
Shell命令
1,type:判断命令是内部命令(type cd/ type echo)还是外部命令(type -a ls/type yum)
2,help:内部命令帮助命令
3,man:外部命令帮助命令(man man)
1) 用户命令 (/bin,/usr/bin,/usr/local/bin)
2) 系统调用
3) 库文件
4) 特殊文件(块设备文件block, 字符设备character, 符号链接文件link, 命令管道文件pipe, 套接字文件socket)
5) 文件格式(配置文件的语法)
6) 游戏
7) 杂项
8) 管理命令(/sbin, /usr/sbin, /usr/local/sbin)
4,whereis:定位命令位置
5,file:查看文件类型 file hello.txt ---> ASCII text
6,echo:打印到标准输出
7,$PATH:环境变量 echo $PATH ---> /usr/local/sbin:/usr/local/bin:/usr/sbin/:/usr/bin:/root/bin
8,$LANG:系统字符集 echo $LANG ---> en_US.UTF-8
9,--->$ a=(1 2 3) --->echo ${a[2]} ---> 3
10,--->echo $$ (打印当前Shell的PID)
11,ps -fe:打印当前进程
12,hash hash -r:[root@node01 ~]# hash
hits command
1 /usr/bin/umount
3 /usr/bin/df
2 /usr/bin/file
2 /usr/bin/du
1 /usr/bin/chmod
4 /usr/bin/cat
4 /usr/bin/touch
1 /usr/bin/whereis
7 /usr/bin/stat
5 /usr/bin/yum
2 /usr/bin/cp
11 /usr/bin/man
56 /usr/bin/ls
3 /usr/bin/vimtutor
3 /usr/bin/tree
3 /usr/bin/clear
[root@node01 ~]# hash -r
[root@node01 ~]# hash
hash: hash table empty
13,df -h:查看磁盘的使用状况
14,du -h:查看文件的使用状况
15,ln a b.H: 硬链接
16,ln -s a b.S: 软链接
17,stat file:查看文件状态(时间信息等)
18,touch file:刷新文件的时间信息
19,cat:查看文件全部内容
20,more:一页一页的查看(阻塞)
21,less:B 往回翻(文件全部加载到内存)
22,head: -n 前n行
23,tail: -n 最后n行(其他用途: 阻塞住某文件tail -f file , 其他用户往该文件写操作时,tail -f 能捕获到追加内容)
24,cat hello.txt | head -3
25,echo "/" | ls -l 与 echo "/" | xargs ls -l
26,head -6 profile | tail -1 (输出文件的第6行)