虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export

时间:2024-04-05 07:00:48

1、打开VMware、设置NAT网络DHCP
虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export2、选择创建虚拟机
虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
3、稍后选择系统
虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
4、选择安装系统centos7 64位
虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
5、选择安装位置
虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
6、选择硬盘大小
虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
7、选择内存2G、选择镜像位置,网络NAT
虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
8、启动虚拟机
9、选择安装
虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
10、语言选择English虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
11、时区选择上海、最小化安装,关闭内核日志记录,生产中开启
12、安装位置选择、分配分区,采用LVM,/boot 500M;biosboot 100M;SWAP 物理内存1-2倍;其余选择根;
虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
13、安装并设置root密码及创建个人用户
虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
14、安装好后重启、做好快照、登录
虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
15、设置命令历史记录显示时间
设置局部环境变量或者全局变量
vim .bash_profile 或者 vim /etc/profile
HISTTIMEFORMAT="%F %T"
虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export

  1. Linux哲学思想:

    1、一切皆文件
    2、多个单一功能程序组合完成复杂任务
    3、配置信息保存于文件中

  2. Linux命令使用格式
    COMMAND 选项 参数1 参数2…
    如:echo、screen、date、ifconfig、export
    echo:以文本形式显示
    -n 不换行,echo默认换行显示
    虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
    -e 启用反斜线转义,转义通过man查询见详情
    虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
    -E 禁用反斜线转义
    虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export

  3. screen 可以理解为共享终端,多人可同时操作、显示
    创建一个会话
    screen -S help
    虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
    进入新终端,重新打开一个新终端加入会话
    查看已有的会话
    虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
    加入
    screen -x help
    -r 7998 关闭会话,或者在会话中exit关闭
    暂时离开会话
    ctrl+a+d

  4. date 打印或者设置系统日志或时间
    虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
    显示当前时间
    虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
    显示两天前时间 -d
    虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
    修改时间 -s
    虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
    往后设置三天
    虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
    以年-月-日 时:分:秒格式显示时间
    虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export
    虚拟机安装centos7.6及Linux简单命令date、screen、echo、ifconfig、export

  5. ifconfig 查看网卡信息
    ifconfig ens33指定查看网卡信息

  6. export
    export 查看当前系统所有环境变量
    env/set/export/declare都可以显示shell的变量
    区别:
    (1)env与export输出的是环境变量
    (2)set与declare是输出环境变量和自定义变量

环境变量的作用:
当你想输入一个变量(例如date命令)而没有指定系统执行date的路径,linux就会求助于$PATH环境变量

修改环境变量:export PATH=$PATH:/home/roc/operation_tools这里是将/home/roc/operation_tools环境变量加入了进去
(如果在添加变量的时候不添加export,即该变量为自定义变量)