Linux shell basic3 dd wc comm chmod ls
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的更多相关文章
- linux shell命令之wc/split及特殊字符
[时间:2018-07] [状态:Open] [关键词:linux, wc, split, 通配符,转义符,linux命令] 0 引言 整理这篇文章的目的不是为了什么学习,仅仅是为了强化下记忆,以便下 ...
- linux shell脚本之-变量极速入门与进阶(1)
1,如果创建shell脚本? 使用任意文本编辑软件,一般为vim,创建.sh结尾的文件,在文件的最开头用 #!/bin/bash 注明shell的类型 如: ghostwu@dev:~/linux/s ...
- linux shell ls -1 列显示文件
/******************************************************************************* * linux shell ls -1 ...
- LINUX SHELL脚本攻略笔记[速查]
Linux Shell脚本攻略笔记[速查] 资源 shell script run shell script echo printf 环境变量和变量 pgrep shell数学运算 命令状态 文件描述 ...
- Linux Shell常用shell命令
Linux Shell常用shell命令 一.文件.目录操作命令 1.ls命令 功能:显示文件和目录的信息 ls 以默认方式显示当前目录文件列表 ls -a 显示所有文件包括隐藏文件 ls -l 显示 ...
- 老李分享:《Linux Shell脚本攻略》 要点(三)
老李分享:<Linux Shell脚本攻略> 要点(三) 1.生产任意大小的文件 [root@localhost dd_test]#[root@localhost dd_test]# ...
- Linux shell 脚本(一)
一.初识脚本 shell:一类介于系统内核与用户之间的解释程序.脚本:一类使用特定语言,按预设顺序执行的文件批处理.宏.解释型程序创建shell脚本:理清任务过程--整理执行语句--完善文件结构1.任 ...
- Linux shell编写脚本部署pxe网络装机
Linux shell编写脚本部署pxe网络装机 人工安装配置,Linux PXE无人值守网络装机 https://www.cnblogs.com/yuzly/p/10582254.html 脚本实 ...
- Linux Shell基础(下)
Linux Shell基础(下) 目录 一.shell特殊符号cut命令 二.cut.sort.wc.uniq命令 三.tee.tr.split命令 四.简易审计系统 五.fork, exec, so ...
随机推荐
- vs 2013各个版本密钥
Visual Studio Ultimate 2013 KEY(密钥):BWG7X-J98B3-W34RT-33B3R-JVYW9 Visual Studio Premium 2013 KEY(密钥) ...
- ASP.NET WebAPI 12 Action的执行
Action的激活大概可以分为如下两个步骤:Action对应方法的调用,执行结果的协商.在WebAPI中由HttpActionInvoker(System.Web.Http.Controllers)进 ...
- 给我一个及时的问候——XMPP
XMPP总的来说就是:基于XML数据结构,点对点的,及时通讯协议 是 Linux操作系统+Apache软件+mySql数据库 + php 编程语言 组成 开始时要导入 XMPPFrameWork框 ...
- Runtime -----那些被忽略的技能
有人说现在的程序员都被惯坏了,尤其使用一些面向对象的语言开发的时候,只是简单的调用一些系统封装好的接口或者是调用一些“便利的”第三方,对于一个程序的真正实现有了解吗???又有多少了解呢 ...
- [vim] vim入门
1. 概述 工欲善其事 必先利其器.vim是非常好用的文本编辑器,可以将它看作是vi的进阶.绝大多数Unix系统都会内置vi编辑器,vi是文本编辑器,vim是程序编辑器.相比vi,它可以根据文件的类型 ...
- [ASP.NET MVC] 使用Bootstrap套件
[ASP.NET MVC] 使用Bootstrap套件 前言 在开发Web项目的时候,除了一些天赋异禀的开发人员之外,大多数的开发人员应该都跟我一样,对于如何建构出「美观」的用户接口而感到困扰.这时除 ...
- 基于UML项目的分析与设计
1,概述 项目中需求和设计的文档是必然的,UML工具可以帮助指导我们从不同的角度去看待一个新的系统,并把这个系统分解剖析出来.本篇文章主要讲述的是如何将UML应用到项目的开发工作中,关于如何学习UML ...
- mongodb 基本指令学习 (2)
db.collectionname.find(<criteria>, <projection>) <criteria> 可选 类型 文档 文档的过滤条 ...
- 趣味题:恺撒Caesar密码(c++实现)
描述:Julius Caesar 生活在充满危险和阴谋的年代.为了生存,他首次发明了密码,用于军队的消息传递.假设你是Caesar 军团中的一名军官,需要把Caesar 发送的消息破译出来.并提供给你 ...
- linux中fork()函数详解(原创!!实例讲解) (转载)
一.fork入门知识 一个进程,包括代码.数据和分配给进程的资源.fork()函数通过系统调用创建一个与原来进程几乎完全相同的进程, 也就是两个进程可以做完全相同的事,但如果初始参数或者传入的变量不 ...