xargs

Linux常用命令学习

别说谁变了你拦得住时间么 提交于 2019-12-06 00:56:16
1、ls命令 就是list的缩写,通过ls 命令不仅可以查看linux文件夹包含的文件,而且可以查看文件权限(包括目录、文件夹、文件权限)查看目录信息等等 常用参数搭配: ls -a 列出目录所有文件,包含以.开始的隐藏文件 ls -A 列出除.及..的其它文件 ls -r 反序排列 ls -t 以文件修改时间排序 ls -S 以文件大小排序 ls -h 以易读大小显示 ls -l 除了文件名之外,还将文件的权限、所有者、文件大小等信息详细列出来 实例: (1) 按易读方式按时间反序排序,并显示文件详细信息 ls -lhrt (2) 按大小反序显示文件详细信息 ls -lrS (3)列出当前目录中所有以“t”开头的目录的详细内容 ls -l t* (4) 列出文件绝对路径(不包含隐藏文件) ls | sed "s:^:`pwd`/:" (5) 列出文件绝对路径(包含隐藏文件) find $pwd -maxdepth 1 | xargs ls -ld 2、cd命令 (changeDirectory),命令语法:cd [目录名]。说明:切换当前目录至dirName 实例: (1)进入要目录 cd / (2)进入"家"目录 cd ~ (3)进入上一次工作路径 cd - (4)把上个命令的参数作为cd参数使用。 cd !$ 3、pwd命令 查看当前工作目录路径 实例: (1)查看当前路径

xargs just working with built in functions

邮差的信 提交于 2019-12-06 00:05:57
I am trying to speed up the processing of a database. I migrated towards xargs. But I'm seriously stuck. Piping a list of arguments to xargs does not work if the command invoked by xargs isn't a built in. I can't figure out why. Here is my code: #!/bin/bash list='foo bar' test(){ echo "$1" } echo "$list" | tr '\012' '\000' | xargs -0 -n1 -I '{}' 'test' {} So there is no output at all. And test function never gets executed. But if I replace "test" in the "xargs" command with "echo" or "printf" it works fine. xargs takes an executable as an argument (including custom scripts) rather than a

find的使用及xargs

让人想犯罪 __ 提交于 2019-12-05 19:05:10
1.参数介绍 pathname: find命令所查找的目录路径。例如用.来表示当前目录,用/来表示系统根目录。 -print: find命令将匹配的文件输出到标准输出。 -exec: find命令对匹配的文件执行该参数所给出的shell命令。相应命令的形式为'command' { } \;,注意{ }和\;之间的空格。 -ok: 和-exec的作用相同,只不过以一种更为安全的模式来执行该参数所给出的shell命令,在执行每一个命令之前,都会给出提示,让用户来确定是否执行。 #-print 将查找到的文件输出到标准输出 #-exec command {} \; —–将查到的文件执行command操作,{} 和 \;之间有空格 #-ok 和-exec相同,只不过在操作前要询用户 -name filename #查找名为filename的文件 -perm #按执行权限来查找 -user username #按文件属主来查找 -group groupname #按组来查找 -mtime -n +n #按文件更改时间来查找文件,-n指n天以内,+n指n天以前 -atime -n +n #按文件访问时间来查GIN: 0px"> -ctime -n +n #按文件创建时间来查找文件,-n指n天以内,+n指n天以前 -nogroup #查无有效属组的文件,即文件的属组在/etc

xargs: git : Bad file number

纵然是瞬间 提交于 2019-12-05 17:57:35
Anyone know what could cause this error? I am trying to create a package on git using this command: git diff -z --name-only --diff-filter=MAR 5e2a4b4 5261fe1 | xargs -s1000000 -0 git archive develop -o 'package.zip' Apart from getting the error on ssh, which you've already ruled out, it could also be that git archive can handle a limited number of argument on the command line. You are already (suspiciously) limiting the total running length of the arguments with -s , and you indicated your command is working for some commits but not the others. You could investigate the difference further by

find的基本查询命令《二》

吃可爱长大的小学妹 提交于 2019-12-05 13:58:39
Linux find命令详解 由于find具有强大的功能,所以它的选项也很多,其中大部分选项都值得我们花时间来了解一下。即使系统中含有网络文件系统( NFS),find命令在该文件系统中同样有效,只你具有相应的权限。 在运行一个非常消耗资源的find命令时,很多人都倾向于把它放在后台执行,因为遍历一个大的文件系统可能会花费很长的时间(这里是指30G字节以上的文件系统)。 一、find 命令格式 1、find命令的一般形式为; find pathname -options [-print -exec -ok ...] 2、find命令的参数; pathname: find命令所查找的目录路径。例如用.来表示当前目录,用/来表示系统根目录。 -print: find命令将匹配的文件输出到标准输出。 -exec: find命令对匹配的文件执行该参数所给出的shell命令。相应命令的形式为'command' { } \;,注意{ }和\;之间的空格。 -ok: 和-exec的作用相同,只不过以一种更为安全的模式来执行该参数所给出的shell命令,在执行每一个命令之前,都会给出提示,让用户来确定是否执行。 3、find命令选项 -name 按照文件名查找文件。 -perm 按照文件权限来查找文件。 -prune 使用这一选项可以使find命令不在当前指定的目录中查找,如果同时使用

Git打包指定分支所提交的文件

橙三吉。 提交于 2019-12-05 11:39:36
原文内容来自于LZ(楼主)的印象笔记,如出现排版异常或图片丢失等问题,可查看当前链接: https://app.yinxiang.com/shard/s17/nl/19391737/da7e233a-c51d-4714-a5c4-9fe03a8b070b git diff 表示查看当前未提交且被修改的文件记录(将会详细展示当前文件的被修改内容和修改前的内容变化记录,红色标识表示新增,绿色标识表示被删除)(git diff 表示显示文件修改详情) git diff --name-only 表示查看当前未提交且被修改的文件记录,不同的是由于增加了--name-only选项,则结果是只显示当前被修改的文件名称。不显示内容被修改的标识数据。 git diff --name-only commId1 commId2 表示查看当前commId1 和commId2 之间所提交的文件的数据名称集合;此处 commId1 和commId2 之间则表示只查看commId1提交数据的集合显示,如果是 commId1 和 commId3的id区间 ,则表示查看commId1 和commId2 的数据集合显示; commid1表示最新提交的ID ----------------------------------------------指定git提交记录进行打包-----------------------

挖矿病毒入侵-分析总结

…衆ロ難τιáo~ 提交于 2019-12-05 07:57:10
  最近,托管云平台出现大量的挖矿病毒;没有安全意识的小伙伴们就只能乖乖交智商睡了;   抓了好几次,终于反过来抓到入侵脚本;在此做下简单的分析,希望能给大伙一些小小的灵感; ##一个朴实无华的脚本,base64 编码,一脸懵逼;要不是从 /proc/PID 找到线索,还真得被毒打一顿; #!/bin/bash exec &>/dev/null sleep $((RANDOM % 600)) {echo

linux下杀掉某用户所有进程

徘徊边缘 提交于 2019-12-05 06:29:49
直接删除用户,提示该用户下还有进程,以下两种方法可解决: 1.结束所有username的进程(如果提示没有该命令,那么用下面方法) killall -u username 2.杀死某一用户下的所有进程 ps -ef | grep ^username | cut -c 10-15 | xargs kill -9 ^username 表示从一行开始匹配 username,xargs 就是用来把 cut 后的输出逐个以空白符分割后输给 kill。 之后可删除 username用户: userdel username 来源: https://www.cnblogs.com/ZhaoHS/p/11910646.html

Can xargs' default delimiter be changed?

坚强是说给别人听的谎言 提交于 2019-12-05 03:56:55
I want the following behavior without having to explicitly specify it with options: xargs -d '\n' Unlike with most commands, you can't just use an alias because pipes don't recognize aliases (as a side-note, why is it designed this way?). I also tried creating my own ~/bin/xargs script but I think it's not as simple as reading "$@" as a string inside the script. Any suggestions how to make the delimiter a newline by default? I don't want to get a bunch of errors when I have a space in the path (and using find ... -print0 | xargs -0 has other unwanted effects). UPDATE My shell script attempt is

find with xargs and tar

断了今生、忘了曾经 提交于 2019-12-05 02:23:57
I have the following I want to do: find . -maxdepth 6 ( -name *.tar.gz -o -name bediskmodel -o -name src -o -name ciao -o -name heasoft -o -name firefly -o -name starlink -o -name Chandra ) -prune -o -print| tar cvf somefile.tar --files-from=- i.e. exclude a whole lot of stuff, only look to 6 subdirs depth, and then once pruning is done, tar up the rest. Not hard. The bit before the pipe (|) works 100%. If I exclude the tar, then I get what I'm after (to the screen). But once I include the pipe, and the tar, it tars everything, including all the stuff I've just excluded in the find. I've tried