基本界面介绍
例子:
【root@localhost ~】#
| 符号 | 含义 |
|---|---|
| root | 当前登陆用户 |
| loalhost | 主机名 |
| ~ | 当前所在目录(~表示家目录) |
| # | 超级用户提示符号(普通用户为$) |
命令基本格式
格式:
- 命令 【选项】 【参数】
| 命令 | 选项 | 参数 |
|---|---|---|
| ls | -a(显示所有) | |
import java.io.InputStream;
import java.net.URI;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.*;
import org.apache.hadoop.io.IOUtils;
public class FileSystemCat {
public static void main(String [] args) throws Exception
{
String uri=args[0];
Configuration conf = new Configuration();
FileSystem fs= FileSystem. get(URI.create(uri),conf);
InputStream in =null;
try {
in =fs.open(new Path(uri));
IOUtils.copyBytes(in,System.out,4096,false);
}finally {
IOUtils.closeStream(in);
}
}
}
hadoop jar FileSystemCat.jar FileSystemCat /class4/quangle.txt
jar -cvf FileSystemCat.jar File*.class
6万+

被折叠的 条评论
为什么被折叠?



