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 ...
随机推荐
- SQL索引学习-索引结构
前一阵无意中和同事讨论过一个SQL相关的题(通过一个小问题来学习SQL关联查询),很惭愧一个非常简单的问题由于种种原因居然没有回答正确,数据库知识方面我算不上技术好,谈起SQL知识的学习我得益于200 ...
- ref与out的区别
若要使用 ref 参数,方法定义和调用方法均必须显式使用 ref 关键字,如下面的示例所示. class RefExample { static void Method(ref int i) { // ...
- jquery实现网页选项卡
这个功能在现在的网站中使用较为普遍,就是以选项卡的形式来对一些内容做了分类.,比如下面的天猫商城. 下面的源码是仿照天猫写的一个选项卡,实现起来的效果如下. 主要是利用我们在点击相应板块是触发它的单击 ...
- MVC5+EF6 入门完整教程12--灵活控制Action权限
大家久等了. 本篇专题主要讲述MVC中的权限方案. 权限控制是每个系统都必须解决的问题,也是园子里讨论最多的专题之一. 前面的系列文章中我们用到了 SysUser, SysRole, SysUserR ...
- python 的import机制2
http://blog.csdn.net/sirodeng/article/details/17095591 python 的import机制,以备忘: python中,每个py文件被称之为模块, ...
- lavarel框架中如何使用ajax提交表单
开门见山,因为laravel以post形式提交数据时候需要加{{csrf_field()}}防止跨站攻击,所以当你用ajax提交表单时候自然也要加 在网上看了很多的解决方式,我是用下面这种方法解决的: ...
- python3学习笔记目录
目录: Python基础(一),Day1 python基础(二),Day2 python函数和常用模块(一),Day3 python函数和常用模块(二),Day4 python函数和常用模块(三),D ...
- mysql命令行备份数据库
MySQL数据库使用命令行备份|MySQL数据库备份命令 例如: 数据库地址:127.0.0.1 数据库用户名:root 数据库密码:pass 数据库名称:myweb 备份数据库到D盘跟目录 mysq ...
- Win10的分辨率问题
个人觉得win10扁平化的界面给人全新的感觉,但安装后,发现分辨率只有1280x720.1152x864.1024x768(推荐).800x600,不管调整哪一个,都觉得分辨率还是有问题,看起来字体. ...
- tomcat已 .war 包的形式发布项目
一:首相将写好的工程打成.war 文件包, 借助eclipse工具完成. 右键项目名称 --> Export --> WAR file 进入如下图 二: 进入到Tomcat的 webap ...