终端 - 在PATH中显示目录,每行一个sed和bash3.X`here string'

.

0

linux命令:tr : '\n' <<<$PATH <<<$PATH '\n' : tr tr : '\n' <<<$PATHrootopen.com
linux命令:tr : '\n' <<<$PATH <<<$PATH '\n' : tr tr : '\n' <<<$PATHrootopen.com
xeka 2018-05-05 19:43:48
输出
linux命令:tr 详解
替代方案1 终端 - 在PATH中显示目录,每行一个sed和bash3.X`here string'

另一种方法:awk'{gsub(/:/,“\ n”); print}'.

linux命令:sed 's/:/\n/g' <<<$PATH <<<$PATH 's/:/\n/g' sed sed 's/:/\n/g' <<<$PATHrootopen.com
linux命令:sed 's/:/\n/g' <<<$PATH <<<$PATH 's/:/\n/g' sed sed 's/:/\n/g' <<<$PATHrootopen.com
.
输出

评论

相关推荐

这是另一种显示路径的方法,每行一个目录,命令tr将冒号转换为新行,从$ PATH变量获取输入

linux命令:tr : \\n <<<$PATH <<<$PATH \\n : tr tr : \\n <<<$PATHrootopen.com
linux命令:tr : \\n <<<$PATH <<<$PATH \\n : tr tr : \\n <<<$PATHrootopen.com
.

从/ dev / urandom读取psuedorandom字节,过滤掉不可打印的字节。可以使用其他字符类,如[:alpha:],[:digit:]和[:alnum:]。要获得一个由10个小写字母组成的字符串:tr -dc'[:lower:]'</ dev / urandom |头-c 10

linux命令:tr -dc '[:print:]' < /dev/urandom /dev/urandom < '[:print:]' -dc tr tr -dc '[:print:]' < /dev/urandomrootopen.com
linux命令:tr -dc '[:print:]' < /dev/urandom /dev/urandom < '[:print:]' -dc tr tr -dc '[:print:]' < /dev/urandomrootopen.com
.

linux命令:trap '' 1 2 20 24(signal number) number) 24(signal 20 2 1 '' trap trap '' 1 2 20 24(signal number)rootopen.com
linux命令:trap '' 1 2 20 24(signal number) number) 24(signal 20 2 1 '' trap trap '' 1 2 20 24(signal number)rootopen.com
.

linux命令:tr -d "\n" < file1 > file2 file2 > file1 < "\n" -d tr tr -d "\n" < file1 > file2rootopen.com
linux命令:tr -d "\n" < file1 > file2 file2 > file1 < "\n" -d tr tr -d "\n" < file1 > file2rootopen.com
.

trap是当前脚本收到特定信号时允许执行命令的bash内建命令。脚本名称使用$ 0,脚本PID使用$$,tee输出到STDOUT以及输出日志文件和ps以记录其他运行的进程。

linux命令:trap "echo \"$0 process $$ killed on $(date).\" | tee ${0##*/}_$$_termination.log; echo 'Active processes at the time were logged to ${0##*/}_$$_termination.log'; ps u >> ${0##*/}_$$_termination.log; exit " HUP INT QUIT ABRT TERM STOP STOP TERM ABRT QUIT INT HUP " exit ${0##*/}_$$_termination.log; >> u ps ${0##*/}_$$_termination.log'; to logged were time the at processes 'Active echo ${0##*/}_$$_termination.log; tee | $(date).\" on killed $$ process \"$0 "echo trap trap "echo \"$0 process $$ killed on $(date).\" | tee ${0##*/}_$$_termination.log; echo 'Active processes at the time were logged to ${0##*/}_$$_termination.log'; ps u >> ${0##*/}_$$_termination.log; exit " HUP INT QUIT ABRT TERM STOProotopen.com
linux命令:trap "echo \"$0 process $$ killed on $(date).\" | tee ${0##*/}_$$_termination.log; echo 'Active processes at the time were logged to ${0##*/}_$$_termination.log'; ps u >> ${0##*/}_$$_termination.log; exit " HUP INT QUIT ABRT TERM STOP STOP TERM ABRT QUIT INT HUP " exit ${0##*/}_$$_termination.log; >> u ps ${0##*/}_$$_termination.log'; to logged were time the at processes 'Active echo ${0##*/}_$$_termination.log; tee | $(date).\" on killed $$ process \"$0 "echo trap trap "echo \"$0 process $$ killed on $(date).\" | tee ${0##*/}_$$_termination.log; echo 'Active processes at the time were logged to ${0##*/}_$$_termination.log'; ps u >> ${0##*/}_$$_termination.log; exit " HUP INT QUIT ABRT TERM STOProotopen.com
.

linux命令:trap "echo \"$0 process $$ killed on $(date).\"; exit " HUP INT QUIT ABRT TERM STOP STOP TERM ABRT QUIT INT HUP " exit $(date).\"; on killed $$ process \"$0 "echo trap trap "echo \"$0 process $$ killed on $(date).\"; exit " HUP INT QUIT ABRT TERM STOProotopen.com
linux命令:trap "echo \"$0 process $$ killed on $(date).\"; exit " HUP INT QUIT ABRT TERM STOP STOP TERM ABRT QUIT INT HUP " exit $(date).\"; on killed $$ process \"$0 "echo trap trap "echo \"$0 process $$ killed on $(date).\"; exit " HUP INT QUIT ABRT TERM STOProotopen.com
.

调整头部-c部分以获得密码长度。我使用文件名如“hans@commandlinefu.com.gpg”和一个可以自动解密带有.gpg后缀的文件的vim。

linux命令:tr -dc "a-zA-Z0-9-_\$\?" < /dev/urandom | head -c 10 | gpg -e -r medha@nerdish.de > password.gpg password.gpg > medha@nerdish.de -r -e gpg | 10 -c head | /dev/urandom < "a-zA-Z0-9-_\$\?" -dc tr tr -dc "a-zA-Z0-9-_\$\?" < /dev/urandom | head -c 10 | gpg -e -r medha@nerdish.de > password.gpgrootopen.com
linux命令:tr -dc "a-zA-Z0-9-_\$\?" < /dev/urandom | head -c 10 | gpg -e -r medha@nerdish.de > password.gpg password.gpg > medha@nerdish.de -r -e gpg | 10 -c head | /dev/urandom < "a-zA-Z0-9-_\$\?" -dc tr tr -dc "a-zA-Z0-9-_\$\?" < /dev/urandom | head -c 10 | gpg -e -r medha@nerdish.de > password.gpgrootopen.com
.

这将根据第一个条件执行两个代码块中的一个。基本上是一个bash terniary操作符。要判断一台机器是否启动:ping -c1 machine {echo succes;} || {回声失败; }由于bash {}块运算符,您可以有多个命令ping -c1 machine && {echo success; log-timestamp.sh} || {回声失败; email-admin.sh; }提示:请记住,{}运算符被bash当作保留字来对待:因此,它们在任何一边都需要一个空格。如果有一个命令在真块的末尾可能会失败,请考虑以'假'以防止意外执行

linux命令:true && { echo success;} || { echo failed; } } failed; echo { || success;} echo { && true true && { echo success;} || { echo failed; }rootopen.com
linux命令:true && { echo success;} || { echo failed; } } failed; echo { || success;} echo { && true true && { echo success;} || { echo failed; }rootopen.com
.

在shell注销上执行一个命令,并运行它直到完成,然后关闭shell。

linux命令:trap cmd 0 0 cmd trap trap cmd 0rootopen.com
linux命令:trap cmd 0 0 cmd trap trap cmd 0rootopen.com
.

它在myvideo.avi中打印myvideo.srt字幕文件,并将其保存在myvideo_subtitled.avi中

linux命令:transcode -i myvideo.avi -x mplayer="-sub myvideo.srt" -o myvideo_subtitled.avi -y xvid xvid -y myvideo_subtitled.avi -o myvideo.srt" mplayer="-sub -x myvideo.avi -i transcode transcode -i myvideo.avi -x mplayer="-sub myvideo.srt" -o myvideo_subtitled.avi -y xvidrootopen.com
linux命令:transcode -i myvideo.avi -x mplayer="-sub myvideo.srt" -o myvideo_subtitled.avi -y xvid xvid -y myvideo_subtitled.avi -o myvideo.srt" mplayer="-sub -x myvideo.avi -i transcode transcode -i myvideo.avi -x mplayer="-sub myvideo.srt" -o myvideo_subtitled.avi -y xvidrootopen.com
.

将文件中的混合大小写转换为小写

linux命令:tr "[:upper:]" "[:lower:]" < file file < "[:lower:]" "[:upper:]" tr tr "[:upper:]" "[:lower:]" < filerootopen.com
linux命令:tr "[:upper:]" "[:lower:]" < file file < "[:lower:]" "[:upper:]" tr tr "[:upper:]" "[:lower:]" < filerootopen.com
.

linux命令:tr -c "[:digit:]" " " < /dev/urandom | dd cbs=$COLUMNS conv=unblock | GREP_COLOR="1;32" grep --color "[^ ]" ]" "[^ --color grep GREP_COLOR="1;32" | conv=unblock cbs=$COLUMNS dd | /dev/urandom < " " "[:digit:]" -c tr tr -c "[:digit:]" " " < /dev/urandom | dd cbs=$COLUMNS conv=unblock | GREP_COLOR="1;32" grep --color "[^ ]"rootopen.com
linux命令:tr -c "[:digit:]" " " < /dev/urandom | dd cbs=$COLUMNS conv=unblock | GREP_COLOR="1;32" grep --color "[^ ]" ]" "[^ --color grep GREP_COLOR="1;32" | conv=unblock cbs=$COLUMNS dd | /dev/urandom < " " "[:digit:]" -c tr tr -c "[:digit:]" " " < /dev/urandom | dd cbs=$COLUMNS conv=unblock | GREP_COLOR="1;32" grep --color "[^ ]"rootopen.com
.

只需将空白转换为换行符。可以通过增强来压缩额外的换行符,但在管道中的下一个工具中可以更好地处理,例如uniq(1)。

linux命令:tr ' \t' '\n' <INFILE >OUTFILE >OUTFILE <INFILE '\n' \t' ' tr tr ' \t' '\n' <INFILE >OUTFILErootopen.com
linux命令:tr ' \t' '\n' <INFILE >OUTFILE >OUTFILE <INFILE '\n' \t' ' tr tr ' \t' '\n' <INFILE >OUTFILErootopen.com
.

翻译和数字线更简单,您可以使用tr来选择您的分隔符(例如,用于csv文件)

linux命令:tr " " "\n" | nl nl | "\n" " " tr tr " " "\n" | nlrootopen.com
linux命令:tr " " "\n" | nl nl | "\n" " " tr tr " " "\n" | nlrootopen.com
.

您可以通过此命令将前一个bash命令设置为终端标题。说明:-trap分配一个命令以在给定的bash信号中执行。 - 在$ BASH_COMMAND中您可以找到最后一个命令 - 您可以使用转义设置终端标题序列:\ e] 0;这是标题\ 007-让echo关心反斜杠给-e给它它因为trap是一个内置的bash命令,所以你可以在'man bash'中找到更多的信息来源:http:/ /www.davidpashley.com/articles/xterm-titles-with-bash.html

linux命令:trap 'echo -e "\e]0;$BASH_COMMAND\007"' DEBUG DEBUG "\e]0;$BASH_COMMAND\007"' -e 'echo trap trap 'echo -e "\e]0;$BASH_COMMAND\007"' DEBUGrootopen.com
linux命令:trap 'echo -e "\e]0;$BASH_COMMAND\007"' DEBUG DEBUG "\e]0;$BASH_COMMAND\007"' -e 'echo trap trap 'echo -e "\e]0;$BASH_COMMAND\007"' DEBUGrootopen.com
.

将文件转换为全部大写。

linux命令:tr '[:lower:]' '[:upper:]' <"$1" <"$1" '[:upper:]' '[:lower:]' tr tr '[:lower:]' '[:upper:]' <"$1"rootopen.com
linux命令:tr '[:lower:]' '[:upper:]' <"$1" <"$1" '[:upper:]' '[:lower:]' tr tr '[:lower:]' '[:upper:]' <"$1"rootopen.com
.

linux命令:tr -c -d 0-9 < /dev/urandom | head -c 10 10 -c head | /dev/urandom < 0-9 -d -c tr tr -c -d 0-9 < /dev/urandom | head -c 10rootopen.com
linux命令:tr -c -d 0-9 < /dev/urandom | head -c 10 10 -c head | /dev/urandom < 0-9 -d -c tr tr -c -d 0-9 < /dev/urandom | head -c 10rootopen.com
.

树有很多parms - 人是你的朋友

linux命令:tree -d -d tree tree -drootopen.com
linux命令:tree -d -d tree tree -drootopen.com
.

包含隐藏的dirs使用:tree -adL 1(使用ls,需要'ls -ad * /。* /')

linux命令:tree -dL 1 1 -dL tree tree -dL 1rootopen.com
linux命令:tree -dL 1 1 -dL tree tree -dL 1rootopen.com
.

从文本文件中删除CR LF(CRLF)。使用man:tr获取有关从文件中删除其他字符的更多信息。甚至字符替换字符。

linux命令:tr -d '\r\n' < input_file.txt > output_file.txt output_file.txt > input_file.txt < '\r\n' -d tr tr -d '\r\n' < input_file.txt > output_file.txtrootopen.com
linux命令:tr -d '\r\n' < input_file.txt > output_file.txt output_file.txt > input_file.txt < '\r\n' -d tr tr -d '\r\n' < input_file.txt > output_file.txtrootopen.com
.
共收录0条命令行
这里是记录和分享命令行的地方, 所有命令行都可以进行评论、提交替代方案.

推荐
    热门命令