案例一: 安装与配置Linux操作系统
拉取centos:centos7镜像
docker pull centos:centos7
创建容器名为zzn,别名自定义
docker run -it --name=zzn centos:centos7 /bin/bash
使用yum安装net-tools.x86_64
yum install -y net-tools.x86_64
查看容器IP地址
ifconfig回车
案例二:
查看当前用户信息
id 回车
查看当前用户是谁
Whoami
重置root密码password
passwd root 回车
输入密码:zhang315 回车
输入新密码:zhang315 回车
添加test账户
adduser test
设置test密码
passwd test 回车
输入密码 123456
输入确认密码 123456
切换至test用户
su test
切换回root用户
su或者su root
案例三 vim命令
查看根目录所有文件
ls /
查看当前目录所有文件
ls
根目录下创建文件夹名为zzn,文件名自定义
mkdir zzn
zzn下创建文件1.sh
touch /zzn/1.sh
或者
cd zzn && touch 1.sh
查看当前目录完整路径
pwd
写入1.sh一句话,内容为Hello World
echo “Hello World” >> 1.sh
查看1.sh内的文件内容
cat /zzn/1.sh
拷贝1.sh为2.sh
cp /zzn/1.sh /zzn/2.sh
拷贝zzn文件夹为zs
cp -r /zzn /zs
案例四 权限控制
创建脚本文件1.sh
touch 1.sh
查看文件的详情
ll
为1.sh的用户添加执行权限
u:用户权限 g:分组权限 o:其他权限
chmod u+x 1.sh
为1.sh分配所有权限
chmod 777 1.sh
案例五 安装和管理软件包(184页最下方至185页最上方)
安装gcc
yum -y install gcc gcc-c++ autoconf make
创建C语言的脚本文件hello.c
touch hello.c