复习Linux常用命令:
shutdown now 关机 reboot 重启 mkdir 创建文件夹 mkdir -p 递归创建文件夹 touch filename 创建文件 rm -r filename 删除文件 rm -rf filename 删除文件夹 vi filename 编辑文件 i--->可编辑状态 esc --> : --->wq 保存退出 q! 不保存退出 wq! 强制保存退出 cat 查看文件内容 grep 搜索文件某些内容 find 查看文件内容 ifconfig 查看本机IP ping 测试是否连通 useradd 添加用户 chmod 777 filename 修改文件夹权限 more 查看更多 cp srcfile destfile 复制文件 mv 重命名,移动文件 tar -zxvf filename -C destpath 解压缩命令 ls 查看目录下所有文件 ls -a 查看目录下所有隐藏文件 pwd 查看当前目录的绝对路径 firewall: 防火墙 service iptables start/stop/status/restart centos7 : systemctl stop firewalld.service systemctl -cmd --state 修改网络配置文件: /etc/sysconfig/network-scripts/ifcfg-eth1 配置环境变量 /etc/profile ~/.bash_profile /etc/profile.d/x.sh JAVA export JAVA_HOME=/root/app/jdk1.8.0_161 export PATH=$JAVA_HOME/bin:$PATH 配置文件生效: source ~/.bash_priofile 查看java安装目录 echo $JAVA_HOME
HDFS Shell 操作:
1,查看Hdfs上的文件 hdfs dfs -ls / hadoop fs -ls / 2,将本地文件上传到hdfs hdfs dfs -put hello.txt / 3,查看hdfs文件内容 hdfs dfs -cat /hello.txt hdfs dfs -text /hello.txt 4,在hdfs创建目录 hdfs dfs -mkdir /hello 5,hdfs递归创建目录 hdfs dfs -mkdir -p /test/a/b 6,递归查询目录 hdfs dfs -ls -p /test 7,将hdfs上的文件下载到本地 hdfs dfs -get /hello.txt 8,将本地文件拷贝到hdfs上 /test/a/b hdfs dfs -copyFromLocal hello.txt /test/a/b/h.txt 9,删除hdfs上目录 hdfs dfs -rm -R /hello 10,删除hdfs上的文件 hdfs dfs -rm /hello.txt