Cent7开机自动联网设置

本文介绍如何设置 CentOS 7 在启动时自动连接互联网。通过修改网络配置文件 ifcfg-网络名 中的 ONBOOT 参数,将其从 no 改为 yes,实现系统启动时自动联网。

Cent7默认开机是不会自动连接到互联网的,遇到了这个问题,记录一下解决方式,大神勿喷!

  1. 打开终端,以root身份登录系统: su -
  2. 进入网络配置文件目录: cd /etc/sysconfig/network-scripts/
  3. 查看目录下的文件: ls
  4. 编辑配置文件: vi ifcfg-网络名
    ONBOOT=no 改成 ONBOOT=yes
  5. 保存退出,重启系统测试是否自动连接
### CentOS 7 中 `~/.bashrc` 文件的默认内容 在 CentOS 7 系统中,`~/.bashrc` 文件主要用于配置用户专属的 Bash Shell 设置。它是每个用户在其家目录下维护的一个文件,默认情况下由系统预设了一些基本功能和环境变量初始化逻辑[^3]。以下是 CentOS 7 下典型的 `.bashrc` 文件默认内容: ```bash # .bashrc # User specific aliases and functions alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' # Source global definitions if [ -f /etc/bashrc ]; then . /etc/bashrc fi # Uncomment the following line if you would like to disable case-sensitive # completion. # set completion-ignore-case On # Set the prompt string based on user identity (\u@\h:\w\$ for normal users, # \[\e[0;31m\]\u@\h:\w\\$\[\e[m\] for root). case $PS1 in *\u*@*\h*:*\\\$*) ;; *) PS1='[\u@\h \W]\\$ ' ;; esac # Enable color support of ls and also add handy aliases if [ "$TERM" != "dumb" ] && [ -x /usr/bin/dircolors ]; then eval "`dircolors -b`" alias ls='ls --color=auto' alias grep='grep --color=auto' fi # Some more ls aliases alias ll='ls -l' alias l.='ls -d .* --color=auto' # Add an "alert" alias for long running commands. Use like so: # sleep 10; alert alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^ *[0-9]* *//;s/[;&|]\{1,\}/;/g'\'')"' # Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, if you don't do it already. ``` 这段脚本的主要作用包括但不限于以下几方面: - 定义常用的命令别名(如 `rm`, `cp`, `mv` 加入 `-i` 参数以防止误操作删除或覆盖文件)[^4]。 - 判断是否存在 `/etc/bashrc` 并将其导入当前用户的 shell 配置中[^3]。 - 自定义命令提示符 (`PS1`) 的显示方式,区分普通用户与超级管理员(root)[^3]。 - 支持彩色终端输出,增强用户体验,特别是对于 `ls` 和 `grep` 命令的结果可视化效果提升显著[^4]。 --- ####
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值