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 ...
随机推荐
- iOS7 UI兼容 导航栏按钮边框 UINavigationItem left and right padding
iOS7之前的UI为: 而在iOS7中,由于设计方面的原因,使得UI变为: 修改的方法重写UINavigationItem的setLeftBarButtonItem和setRightBarButton ...
- sql server2008中sql server身份能登录,window身份登录不了
用sql server身份的sa登录成功进入,一切正常,用window身份登录不了,问题如下
- 晒自己做的一个管理系统(清新风格)EasyUI
最近项目结束了,现在也要自己总结一下自己的成果了,总结会加深自己对项目的印象的.这里我就先晒一些作品图片了,希望大家看了会赞美一个! 项目虽然结束了,但是接下来的这个项目可就不是我一个人可以搞定的了, ...
- 51Node 1364--- 最大字典序排列(树状数组)
51Node 1364--- 最大字典序排列(树状数组) 1364 最大字典序排列 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 收藏 关注 给出一个1至N ...
- C语言范例学习01
编程语言的能力追求T型. 以前学过C语言,但是只学了理论. 从今天开始,我买了本<C语言程序开发范例宝典>.我要把它通关掉. 这应该可以极大地提升我的编程能力. 第一章 基础知识 这章没太 ...
- OpenGL 圆角矩形
本来打算用四个圆角GL_TRIANGLE_FANS+两个矩形来填充, 后来经无情公子的提醒, 突然发现:"尼玛就是一压扁了的圆啊!" 于是全部用GL_TRIANGLE_FANS, ...
- R 网页数据爬虫1
For collecting and analyzing data. [启示]本处所分享的内容均是笔者从一些专业书籍中学习所得,也许会有一些自己使用过程中的技巧.心得.小经验一类的,但远比不上书中所讲 ...
- PHP生成图片验证码demo【OOP面向对象版本】
下面是我今天下午用PHP写的一个生成图片验证码demo,仅供参考. 这个demo总共分为4个文件,具体代码如下: 1.code.html中的代码: <!doctype html> < ...
- Linux命令详解之–ls命令
今天开始为大家介绍下Linux中常用的命令,首先给大家介绍下Linux中使用频率最高的命令--ls命令. 更多Linux命令详情请看:Linux命令速查手册 linux ls命令用于显示指定工作目录下 ...
- sphinx使用随笔
为什么需要进行全文搜索呢? 一个表中有a.b.c多个字段.我们使用sql进行like搜索的时候,往往只能匹配某个字段.或者是这样的形式:a LIKE “%关键词%”or b LIKE “关键词” 这样 ...