xargs

linux文本格式转换

匿名 (未验证) 提交于 2019-12-02 21:59:42
dos2unix命令用来将DOS格式的文本文件转换成UNIX格式的(DOS/MAC to UNIX text file format converter)。 DOS下的文本文件的换行符为\r\n,表示成十六进制就是0D 0A,而Unix下的文本文件换行符为\n,表示成十六进制就是0A。DOS格式的文本文件在Linux上用较低版本的vi打开行尾会显示^M,并且很多命令都无法的处理好这种格式的文件,因此产生了两种格式文件相互转换的需求,对应的将UNIX格式文本文件转成成DOS格式的是unix2dos命令。 使用cat -v查看文件中的非打印字符 语法: dos2unix [- hkqV ] [- c convmode ] [- o file ...] [- n infile outfile ...] 选项: -k:保持输出文件的日期不变 -q:安静模式,不提示任何警告信息 -V:查看版本 -c:转换模式,模式有:ASCII, 7bit, ISO, Mac, 默认是:ASCII -o:写入到源文件 -n:写入到新文件 实例 转换单个或多个文件 最简单的用法是dos2unix直接接一个文件或多个文件 dos2unix file1 file2 file3 ... 批量转换目录下的文件 Linux本身提供了dos2unix和unix2dos这两个命令来实现windows和linux文件的转换,

【Linux】史上最全的Find命令

匿名 (未验证) 提交于 2019-12-02 21:56:30
Find 功能说明 :查找文件或目录。 语  法:find (-$) 参  数 && 说  明: [目录...] [-amin <分钟>] 查找在指定时间曾被存取过的文件或目录,单位以分钟计算 [-anewer <参考文件或目录>] 查找其存取时间较指定文件或目录的存取时间更接近现在的文件或目录 [-atime <24小时数>] 查找在指定时间曾被存取过的文件或目录,单位以24小时计算 [-cmin <分钟>] 查找在指定时间之时被更改的文件或目录 [-cnewer <参考文件或目录>] 查找其更改时间较指定文件或目录的更改时间更接近现在的文件或目录 [-ctime <24小时数>] 查找在指定时间之时被更改的文件或目录,单位以24小时计 [-daystart] 从本日开始计算时间 [-depyh] 从指定目录下最深层的子目录开始查找 [-empty] 寻找文件大小为0 Byte的文件,或目录下没有任何子目录或文件的空目录 [-exec <执行指令>] 假设find指令的回传值为True,就执行该指令 [-false] 将find指令的回传值皆设为False [-fls <列表文件>] 此参数的效果和指定"-ls"参数类似,但会把结果保存为指定的列表文件 [-follow] 排除符号连接 [-fprint <列表文件>] 此参数的效果和指定"-print"参数类似

linux中常用命令

匿名 (未验证) 提交于 2019-12-02 21:56:30
平时的积累,记录的比较散: ls -lrt ls -t按照时间顺序显示文件列表,r 最新的再最后面 more:显示文件(文本)的内容(分屏显示) less:显示文件(文本)的内容(分屏显示、可回溯) sort:对文本文件中的各行按字母进行排序 ls | sort wc: wc [选项] 文件列表 统计指定文件中的字节数(-c)、字数(-w)、行数(-l), 并将统计结果显示输出。 cat xx | wc -l echo $HOME 来查看自己的主目录 . 当前目录 ..上一级目录 ~当前用户主目录 /文件系统根目录 chmod 设置文件/目录的权限 chmod [选项] 文件和目录列表 使用八进制数设置权限三位八进制数字分别代表:u(user:用户)、g(group:组用户)、o(other:其他用户)的权限。可读权限、可写权限和可执行权限所对应的数值分别是4,2和1。 若要rwx属性则4+2+1=7; 若要rw-属性则4+2=6; 若要r-x属性则4+1=5 如:chmod 755 file1 chown:改变文件和目录的所有权 chgrp:改变文件和目录的所有权 find find . -maxdepth 1 -name "@*" 这个命令意思是,查找当前目录下以@开头的文件或者目录,搜索深度为一级也就是只在当前目录找,不进入子目录,如果你要从/目录开始找就: find /

Is there a way to uninstall multiple packages with pip?

吃可爱长大的小学妹 提交于 2019-12-02 20:21:22
I am attempting to remove all of the installed "pyobjc-framework"-prefixed packages. I have tried the following: % pip freeze | grep pyobjc-framework | xargs pip uninstall but this barfs because each pip uninstall requires confirmation (perhaps a way to bypass this would be a solution). Please help before I have to break down and uninstall each of these manually! Nobody wants that. Your command should actually work if you add the -y | --yes flag to pip :-) -y, --yes Don't ask for confirmation of uninstall deletions. Possibly: % pip freeze | grep pyobjc-framework | xargs pip uninstall -y

shell 文本处理之 grep

痴心易碎 提交于 2019-12-02 19:49:23
过滤来自一个文件或标准输入匹配模式内容。 除了grep外,还有egrep、fgrep。egrep是grep的扩展,相当于grep -E。fgrep相当于grep -f,用的少。 Usage: grep [OPTION]... PATTERN [FILE]... 支持的正则 描述 -E,--extended-regexp 模式是扩展正则表达式(ERE) -F,--fixed-strings 模式是换行分隔固定字符串 -G,--basic-regexp 模式是基本正则表达式(BRE) -P,--perl-regexp 模式是Perl正则表达式 -e,--regexp=PATTERN 使用模式匹配,可指定多个模式匹配 -f,--file=FILE 从文件每一行获取模式 -i,--ignore-case 忽略大小写 -w,--word-regexp 模式匹配整个单词 -x,--line-regexp 模式匹配整行 -v,--invert-match 打印不匹配的行 输出控制 描述 -m,--max-count=NUM 输出匹配的结果num数 -n,--line-number 打印行号 -H,--with-filename 打印每个匹配的文件名 -h,--no-filename 不输出文件名 -o,--only-matching 只打印匹配的内容 -q,--quiet 不输出正常信息 -s,

Understanding the UNIX command xargs

﹥>﹥吖頭↗ 提交于 2019-12-02 19:09:48
I'm pretty much confused on this. Need some clarifications. Example 1 : pgrep string | xargs ps Example 2 : find . | xargs grep whatever From Example 1, I gather it's this way: Search for a "string" which is part of name of running process and return the process-ids of all the matches to 'xargs ps' -> which just appends ps to the matches (which are process-ids themselves) to get the same output as : ps <processid> Can someone explain what xargs really does in this case? From Example 2, I gather it's this way: It's to search for some "string" recursively from the current working directory. Here

how to export ssl key , crt and CA from httpd.conf apache to use it into nginx for all users

走远了吗. 提交于 2019-12-02 13:14:56
use custom setup that use nginx as web engine with cpanel need command to export ssl files to use it into nginx cpanel now use AutoSSL powered by Comodo that give it free and will renew it automatic when any users domains ssl expire example httpd.conf <VirtualHost 4xx30:4433> ServerName xnxxsch.com <IfModule ssl_module> SSLCertificateFile /var/cpanel/ssl/installed/certs/xnh_com_d98c5_67ca3_150707$ SSLCertificateKeyFile /var/cpanel/ssl/installed/keys/d98c5_67ca3_76c14a301e0260891bbe91504$ SSLCACertificateFile /var/cpanel/ssl/installed/cabundles/cPanel_Inc__681917bfb43af6b642178$ </IfModule> <

grep

◇◆丶佛笑我妖孽 提交于 2019-12-02 12:28:32
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 本文链接: https://blog.csdn.net/qq_33283716/article/details/80881765 grep介绍 过滤来自一个文件或标准输入匹配模式内容。 除了 grep 外,还有 egrep、fgrep。egrep 是 grep 的扩展,相当于 grep -E。fgrep 相当于 grep - f,用的少。 Usage: grep [OPTION]... PATTERN [FILE]... 支持的正则 | 描述 ---|--- -E,--extended-regexp | 模式是扩展正则表达式(ERE) -F,--fixed-strings | 模式是换行分隔固定字符串 -G,--basic-regexp | 模式是基本正则表达式(BRE) -P,--perl-regexp | 模式是 Perl 正则表达式 -e,--regexp=PATTERN | 使用模式匹配,可指定多个模式匹配 -f,--file=FILE | 从文件每一行获取模式 -i,--ignore-case | 忽略大小写 -w,--word-regexp | 模式匹配整个单词 -x,--line-regexp | 模式匹配整行 -v,--invert-match |

To understand recursive grep in xargs

妖精的绣舞 提交于 2019-12-02 08:39:55
问题 What is the practical difference between the following two commands? Command A find . -type f -print0 | xargs -0 grep -r masi Command B find . -type f -print0 | xargs -0 grep masi In short, what is the practical benefit of Command A? 回答1: None .. -r is for recursively searching directories, but the -type f will prevent find from returning directory names. 回答2: I think none The A will try to recurse over file names (as the find is only searching for files) so it will not recurse into anything.