开关机,登入登出
- reboot 重启
- init 0
- init 3
- init 5
- exit 退出
- logout 登出
Shell下修改主机名(/etc/hosts 文件并未修改,有bug)
- hostnamectl set-hostname master
- bash
重启网络服务
- service network restart 重启网络服务( 不行的话 重启 虚拟机, 还不行 重启 vmware, 还不行 重启 电脑 )
防火墙
- systemctl status firewalld
- systemctl start firewalld
- systemctl stop firewalld
常用文件查询命令
- cat hello.txt | more
- cat hello.txt | less ( less 下 可以用 :/ 来 进行关键字查找 )
- cat hello.txt | grep hello
常用文件追加命令
- vim hello.txt
- echo 'abcd' > hello.txt ( cover )
- echo 'abcd' >> hello.txt
/etc/profile
修改此配置文件后,对所有的用户都生效,如对环境变量的修改
JAVA_HOME = fp
HADOOP_HOME = fp1
HBASE_HOME = fp2
export $PATH = $PATH:$JAVA_HOME/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin
修改后 需要用 source 刷新一下
yum
yum 是 redhat,centos下的软件安装方式,基于linux,shell前端软件包管理器。
基于rpm包管理,能够从指定的服务器自动下载rpm包并且安装,可以自动处理包的依赖性问题,一次性安装所有所需要的软件依赖包
- yum list
- yum list | grep firefox
- yum install firefox
rpm
redhat package manage , 用于 安装,卸载 rpm包 ( redhat, centos 下 的 包资源 管理器 )
- rpm -qa ( query all )
- rpm -qa | grep firefox
- rpm -q firefox
- rpm -ivh firefox ( i = install, v = verbose, h = hash )
- rpm -e fire fox ( erase )
rpm yum 常用于 redhat centos 下
ubuntu下 用 apt
attention
- 一般情况下 /etc/ 下的文件的 操作 只读:其他人 , 即 普通用户 , 读写: root,root组