Generating files of any size

/dev/zerois a character special device, which infinitely returns the zero byte (\0).

The above command will create a file called junk.datathat is exactly 1MB in size. Let's go

through the parameters: ifstands for – inputfile, ofstands for – outputfile, bsstands for

BYTES for a block, and countstands for the number of blocks of bsspecified to be copied.

dd if=/dev/zero of=junk.data bs=1M count=1

1+0 records in

1+0 records out

1048576 bytes (1.0 MB) copied, 0.00263553 s, 398 MB/s

Comm command demo:

[hadoop@namenode test]$ cat file1.txt file2.txt

1

2

3

4

1

2

4

5

[hadoop@namenode test]$ comm file1.txt file2.txt

1

2

3

4

5

[hadoop@namenode test]$ comm file1.txt file2.txt -1

1

2

4

5

[hadoop@namenode test]$ comm file1.txt file2.txt -2

1

2

3

4

[hadoop@namenode test]$ comm file1.txt file2.txt -3

3

5

[hadoop@namenode test]$ comm file1.txt file2.txt -3 -1

5

-1 removes first column from output

-2 removes the second column

-3 removes the third column

[hadoop@namenode test]$ ll

total 1052

-rw-rw-r--. 1 hadoop hadoop 99 Feb 16 08:34 all_txt_files.txt

-rw-rw-r--. 1 hadoop hadoop 8 Feb 17 03:29 file1.txt

-rw-rw-r--. 1 hadoop hadoop 8 Feb 17 03:29 file2.txt

-rw-rw-r--. 1 hadoop hadoop 1048576 Feb 17 03:20 junk.data

-rw-rw-r--. 1 hadoop hadoop 44 Feb 16 02:06 mul_bank.txt

-rw-rw-r--. 1 hadoop hadoop 30 Feb 16 08:55 num.txt

drwxrwxr-x. 2 hadoop hadoop 4096 Feb 16 03:05 sub

-rw-rw-r--. 1 hadoop hadoop 44 Feb 16 02:11 test.txt

"-"—if it is a regular file.

"d"—if it is a directory

"c"—for a character device

"b"—for a block device

"l"—if it is a symbolic link

"s"—for a socket

"p"—for a pipe

chmod u=rwx g=rw o=r filename

Here:

u =specifies user permissions

g =specifies group permissions

o =specifies others permissions

chmod a+x filename

a statnd for all.

Read,write,and execute permissions have unique octal numbers as follows:

r--=4

-w-=2

--x=1

Touch is a command that can create blank files or modify the timestamp of files if they

already exist.

Symbolic links are just pointers to other files.

ln -s targetfilename(directory) link_name

ln -s test.txt test_link.txt

Counting number of lines, words, and characters in a file

$ wc -l file # count number of lines as follows:

$ wc -w file #count words number

$ head -10 filename

$ tail -10 filename

Head used to get the first n lines of the file.

Tail is used to get the last n lines of the file.

Linux shell basic3 dd wc comm chmod ls的更多相关文章

  1. linux shell命令之wc/split及特殊字符

    [时间:2018-07] [状态:Open] [关键词:linux, wc, split, 通配符,转义符,linux命令] 0 引言 整理这篇文章的目的不是为了什么学习,仅仅是为了强化下记忆,以便下 ...

  2. linux shell脚本之-变量极速入门与进阶(1)

    1,如果创建shell脚本? 使用任意文本编辑软件,一般为vim,创建.sh结尾的文件,在文件的最开头用 #!/bin/bash 注明shell的类型 如: ghostwu@dev:~/linux/s ...

  3. linux shell ls -1 列显示文件

    /******************************************************************************* * linux shell ls -1 ...

  4. LINUX SHELL脚本攻略笔记[速查]

    Linux Shell脚本攻略笔记[速查] 资源 shell script run shell script echo printf 环境变量和变量 pgrep shell数学运算 命令状态 文件描述 ...

  5. Linux Shell常用shell命令

    Linux Shell常用shell命令 一.文件.目录操作命令 1.ls命令 功能:显示文件和目录的信息 ls 以默认方式显示当前目录文件列表 ls -a 显示所有文件包括隐藏文件 ls -l 显示 ...

  6. 老李分享:《Linux Shell脚本攻略》 要点(三)

    老李分享:<Linux Shell脚本攻略> 要点(三)   1.生产任意大小的文件 [root@localhost dd_test]#[root@localhost dd_test]# ...

  7. Linux shell 脚本(一)

    一.初识脚本 shell:一类介于系统内核与用户之间的解释程序.脚本:一类使用特定语言,按预设顺序执行的文件批处理.宏.解释型程序创建shell脚本:理清任务过程--整理执行语句--完善文件结构1.任 ...

  8. Linux shell编写脚本部署pxe网络装机

    Linux shell编写脚本部署pxe网络装机 人工安装配置,Linux PXE无人值守网络装机  https://www.cnblogs.com/yuzly/p/10582254.html 脚本实 ...

  9. Linux Shell基础(下)

    Linux Shell基础(下) 目录 一.shell特殊符号cut命令 二.cut.sort.wc.uniq命令 三.tee.tr.split命令 四.简易审计系统 五.fork, exec, so ...

随机推荐

  1. javascript: jquery.gomap-1.3.3.js

    from:http://www.pittss.lv/jquery/gomap/solutions.php jquery.gomap-1.3.3.js: /** * jQuery goMap * * @ ...

  2. Dom4j 锁竞争性能低下解决

    在最近的项目中使用 Dom4j 解析 xml 发现性能低下,有锁竞争的情况,解决如下: SAXParserFactory factory = new org.apache.xerces.jaxp.SA ...

  3. DigitalOcean上SSH Key的创建(附DigitalOcean邀请)

    DigitalOcean是一家云主机商家,最低配置512M内存,20G的SSD,每月只有5刀.半个月前刚刚在这上面买了一个VPS,创建Droplet的时候看见创建SSH Key的时候就有点懵,不知道这 ...

  4. MUI - 图片预览(perviewimage)的优化

    主要对mui图片全屏预览插件做了以下三点补充 1.添加了预览图片文字说明,使用的时候需要添加以下css及DOM属性 .mui-slider-img-content { position: absolu ...

  5. MapGIS转Shp文件的单位问题

    在MapGIS浏览查看一下数据,各种不习惯:用mapgis自带的转shp功能,属性表会出错:利用名为map2shp的试用版软件可将mapgis格式的数据较为良好转成shp格式.但经常会遇到一个单位问题 ...

  6. Atitit.图片木马的原理与防范 attilax 总结

    Atitit.图片木马的原理与防范 attilax 总结 1.1. 像图片的木马桌面程序1 1.2. Web 服务端图片木马1 1.3. 利用了Windows的漏洞1 1.4. 这些漏洞不止Windo ...

  7. [leetcode] Rectangle Area

    Rectangle Area Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectang ...

  8. PL/SQL基础1(笔记)

    --基本结构DECLARE--变量声明部分:在此声明PL/SQL用到的变量,类型,游标,以及局部的存储过程和函数BEGIN --执行部分:过程及SQL语句,即程序的主要部分 EXCEPTION --执 ...

  9. OC字符串的一些常用的函数。

    )//获取字符串长度 NSUInteger len= str.length; () //通过指定索引返回对应的字符 unichar ch =[str characterAtIndex:]; ()//通 ...

  10. iOS 界面调试利器Reveal

    Reveal下载地址:http://revealapp.com/ ,目前要收费了,而且还不便宜,好东西都这样嘛~ 针对越狱设备和非越狱设备可以采取不同的方法,一种是在工程项目中加入Reveal.fra ...