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. Python OOP(1):从基础开始

    本文旨在Python复习和总结: 1.如何创建类和实例? # 创建类 class ClassName(object): """docstring for ClassNam ...

  2. 【JS复习笔记】07 复习感想

    好吧,其实<JavaScript语言精粹>后面还简单介绍了代码风格,优美特性,以及包含的毒瘤.糟粕. 但我很快就看完了,发现其实都在前面讲过了,所以就不写了. 至今为止已经算是把JavaS ...

  3. 看了一本Unity3D的教程

    国内写的<Unity 3D游戏开发>. 实例挺多,对于有基础的人来说,上手会挺快的: 但进阶的东西没有涉及,可能与书的定位有关吧

  4. [Redis] redis-cli 命令总结

    Redis提供了丰富的命令(command)对数据库和各种数据类型进行操作,这些command可以在Linux终端使用.在编程时,比如使用Redis 的Java语言包,这些命令都有对应的方法.下面将R ...

  5. mybatis3批量更新 批量插入

    在公司ERP项目开发中,遇到批量数据插入或者更新,因为每次连接数据库比较耗时,所以决定改为批量操作,提升效率.库存盘点导入时,需要大量数据批量操作. 1:数据库连接代码中必须开启批量操作.加上这句,& ...

  6. SQL数据库基础(五)

    字符串函数: 时间日期函数: SELECT @@DATEFIRST AS '1st Day', DATEPART(dw, GETDATE()) AS 'Today' SELECT GETDATE() ...

  7. AsyncTask.cancel()的结束问题

    实际项目中有这么一个问题,用户进入详情界面,那么我们就要网络加载数据并展现在UI上,这个加载用线程或者异步. 这里就拿项目中统一用异步任务来获取网络数据把. 用户可能会有这么一个操作,它在一个商品(说 ...

  8. C++语言-03-类与对象

    类 类是面向对象编程中的核心概念,用于定义一个数据类型的蓝图,描述类的对象包括什么,以及可以在这些对象上执行那些操作. 类的成员 数据成员 描述数据的表示方法 class ClassName { ac ...

  9. Reveal常用技巧(翻译来自Reveal官网blog)

    翻译来自官网:http://revealapp.com/blog/reveal-common-tips-cn.html 以下基于Reveal 1.6. 用于快速上手的内置应用 刚刚下载Reveal,啥 ...

  10. iOS之学习资源收集--很好的IOS技术学习网站

    点击图片也能打开相关的网站: https://boxueio.com/skill/swift http://ios.b2mp.cn/ http://gold.xitu.io/welcome/?utm_ ...