echo

在屏幕上显示消息,将每个给定的STRING写入标准输出,每个和最后一个之后的换行符之间留有空格

语法

 echo [options]... [string]...

选项

-n
   不换行.

-E
  禁用/反斜杠转义字符

-e
   启用每个消息中反斜杠转义字符

\a          警报(铃声)

\b          删除前一个字符

\c          最后不加上换行符号

\e          转义

\f          换页

\n          换行

\r          回车

\t          水平制表符

\v          垂直制表符

\\          反斜杠

\NNN
      ASCII码为NNN(八进制)的字符; 如果NNN不是
      有效的八进制数,则按字面打印。

\xnnn
      ASCII码为十六进制值
      nnn(一到三位数)的字符

echo是BASH内置命令

实例

echo "Hello World"

DEMO=Testing123
echo "$DEMO"
# Testing123

echo "with quotes we can echo several lines at a time"

Echo还可以使用前景(30…37)和背景(40…47)颜色的转换序列显示颜色

$ COL_BLUE="\x1b[34;01m"
$ COL_RESET="\x1b[39;49;00m"
$ echo -e $COL_BLUE"Important Message: "$COL_RESET"This is a message"

这是一个显示所有颜色组合的shell脚本:

 #!/bin/bash
 #
 echo ---Bg---40---41---42---43---44---45---46---47
 for i in {30..37} # foreground
 do
 echo -n -e fg$i- 
 for j in {40..47} # background
 do
 echo -n -e '\E['$i';'$j'm SS64'
 tput sgr0 # Reset text attributes to normal without clear
 done
 echo # newline
 done

 echo -- Clear BG --
 for n in {30..37} # foreground
 do
 echo -e fg$n '\E['$n';'01'm SS64'
 tput sgr0 # Reset text attributes to normal without clear
 done

echo 命令实例:

linux命令:echo "[q]sa[ln0=aln256%Pln256/snlbx]sb729901041524823122snlbxq"|dc "[q]sa[ln0=aln256%Pln256/snlbx]sb729901041524823122snlbxq"|dc echo echo "[q]sa[ln0=aln256%Pln256/snlbx]sb729901041524823122snlbxq"|dcrootopen.com
linux命令:echo "[q]sa[ln0=aln256%Pln256/snlbx]sb729901041524823122snlbxq"|dc "[q]sa[ln0=aln256%Pln256/snlbx]sb729901041524823122snlbxq"|dc echo echo "[q]sa[ln0=aln256%Pln256/snlbx]sb729901041524823122snlbxq"|dcrootopen.com
2019-03-23 19:17:05

linux命令:echo -e ${PATH//:/\\n} ${PATH//:/\\n} -e echo echo -e ${PATH//:/\\n}rootopen.com
linux命令:echo -e ${PATH//:/\\n} ${PATH//:/\\n} -e echo echo -e ${PATH//:/\\n}rootopen.com
2019-02-12 21:24:04

at 07:30 tomorrow在第二天上午7:30调度作业,运行任何命令或脚本作为标准输入。指定时间和日期的格式相当灵活。 http://tinyurl.com/ibmdwat echo 'play alarmclock.wav 2>/dev/null' |将play alarmclock.wav命令提供给at,同时2>/dev/null导致文本输出play被丢弃

linux命令:echo 'play alarmclock.wav 2>/dev/null' | at 07:30 tomorrow tomorrow 07:30 at | 2>/dev/null' alarmclock.wav 'play echo echo 'play alarmclock.wav 2>/dev/null' | at 07:30 tomorrowrootopen.com
linux命令:echo 'play alarmclock.wav 2>/dev/null' | at 07:30 tomorrow tomorrow 07:30 at | 2>/dev/null' alarmclock.wav 'play echo echo 'play alarmclock.wav 2>/dev/null' | at 07:30 tomorrowrootopen.com
2019-01-06 22:16:42

linux命令:echo | openssl s_client -showcerts -servername google.com -connect gnupg.org:443 2>/dev/null | openssl x509 -inform pem -noout -text -text -noout pem -inform x509 openssl | 2>/dev/null gnupg.org:443 -connect google.com -servername -showcerts s_client openssl | echo echo | openssl s_client -showcerts -servername google.com -connect gnupg.org:443 2>/dev/null | openssl x509 -inform pem -noout -textrootopen.com
linux命令:echo | openssl s_client -showcerts -servername google.com -connect gnupg.org:443 2>/dev/null | openssl x509 -inform pem -noout -text -text -noout pem -inform x509 openssl | 2>/dev/null gnupg.org:443 -connect google.com -servername -showcerts s_client openssl | echo echo | openssl s_client -showcerts -servername google.com -connect gnupg.org:443 2>/dev/null | openssl x509 -inform pem -noout -textrootopen.com
2018-12-22 21:23:50

/macos/mojave shell脚本更改终端配置文件

linux命令:echo "tell application \"Terminal\"\n\t set its current settings of selected tab of window 1 to settings set \"$PROFILE\"\n end tell"|osascript; tell"|osascript; end \"$PROFILE\"\n set settings to 1 window of tab selected of settings current its set \"Terminal\"\n\t application "tell echo echo "tell application \"Terminal\"\n\t set its current settings of selected tab of window 1 to settings set \"$PROFILE\"\n end tell"|osascript;rootopen.com
linux命令:echo "tell application \"Terminal\"\n\t set its current settings of selected tab of window 1 to settings set \"$PROFILE\"\n end tell"|osascript; tell"|osascript; end \"$PROFILE\"\n set settings to 1 window of tab selected of settings current its set \"Terminal\"\n\t application "tell echo echo "tell application \"Terminal\"\n\t set its current settings of selected tab of window 1 to settings set \"$PROFILE\"\n end tell"|osascript;rootopen.com
2018-12-22 21:22:07

你可以这样做for i in {1..10}; do something; done

linux命令:echo {4..-9} {4..-9} echo echo {4..-9}rootopen.com
linux命令:echo {4..-9} {4..-9} echo echo {4..-9}rootopen.com
2018-12-13 23:03:52

首先,您需要启用sysrq接口: echo 1 > /proc/sys/kernel/sysrq echo o > /proc/sysrq-trigger halts echo b > /proc/sysrq-trigger reboots

linux命令:echo o > /proc/sysrq-trigger reboots reboots /proc/sysrq-trigger > o echo echo o > /proc/sysrq-trigger rebootsrootopen.com
linux命令:echo o > /proc/sysrq-trigger reboots reboots /proc/sysrq-trigger > o echo echo o > /proc/sysrq-trigger rebootsrootopen.com
2018-12-02 21:34:43

测试sendmail是否已安装并正常工作

linux命令:echo "Subject: test" | /usr/lib/sendmail -v me@domain.com me@domain.com -v /usr/lib/sendmail | test" "Subject: echo echo "Subject: test" | /usr/lib/sendmail -v me@domain.comrootopen.com
linux命令:echo "Subject: test" | /usr/lib/sendmail -v me@domain.com me@domain.com -v /usr/lib/sendmail | test" "Subject: echo echo "Subject: test" | /usr/lib/sendmail -v me@domain.comrootopen.com
2018-11-17 12:12:33

linux命令:echo boo{,,,,,,,,,,} boo{,,,,,,,,,,} echo echo boo{,,,,,,,,,,}rootopen.com
linux命令:echo boo{,,,,,,,,,,} boo{,,,,,,,,,,} echo echo boo{,,,,,,,,,,}rootopen.com
2018-11-17 12:06:17

使用bash快捷方式生成数字序列,它与字母一起使用echo {A..H} echo {a..h},小心不要混合大小写,你可能会遇到有趣的结果: echo {z..A} z y x w v u t s r q p o n m l k j i h g f e d c b a ` _ ^ ] [ Z Y X W V U T S R Q P O N M L K J I H G F E D C B A

linux命令:echo {1..12} {1..12} echo echo {1..12}rootopen.com
linux命令:echo {1..12} {1..12} echo echo {1..12}rootopen.com
2018-11-17 11:57:27

linux命令:echo {1..99} {1..99} echo echo {1..99}rootopen.com
linux命令:echo {1..99} {1..99} echo echo {1..99}rootopen.com
2018-11-17 11:55:27

此命令将Python版本发送到文件,用于脚本

linux命令:echo "$(python -V 2>&1)" > file file > 2>&1)" -V "$(python echo echo "$(python -V 2>&1)" > filerootopen.com
linux命令:echo "$(python -V 2>&1)" > file file > 2>&1)" -V "$(python echo echo "$(python -V 2>&1)" > filerootopen.com
2018-11-07 22:30:24

禁用Gradle守护程序有时可以提高构建可靠性

linux命令:echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties ~/.gradle/gradle.properties >> "org.gradle.daemon=false" echo echo "org.gradle.daemon=false" >> ~/.gradle/gradle.propertiesrootopen.com
linux命令:echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties ~/.gradle/gradle.properties >> "org.gradle.daemon=false" echo echo "org.gradle.daemon=false" >> ~/.gradle/gradle.propertiesrootopen.com
2018-11-02 23:24:10

linux命令:echo "$(find ./ -name '*' -type f -exec wc -l {} \; | awk '{print $1}' | tr '\n' '+' | sed s/+$//g)" | bc -l -l bc | s/+$//g)" sed | '+' '\n' tr | $1}' '{print awk | \; {} -l wc -exec f -type '*' -name ./ "$(find echo echo "$(find ./ -name '*' -type f -exec wc -l {} \; | awk '{print $1}' | tr '\n' '+' | sed s/+$//g)" | bc -lrootopen.com
linux命令:echo "$(find ./ -name '*' -type f -exec wc -l {} \; | awk '{print $1}' | tr '\n' '+' | sed s/+$//g)" | bc -l -l bc | s/+$//g)" sed | '+' '\n' tr | $1}' '{print awk | \; {} -l wc -exec f -type '*' -name ./ "$(find echo echo "$(find ./ -name '*' -type f -exec wc -l {} \; | awk '{print $1}' | tr '\n' '+' | sed s/+$//g)" | bc -lrootopen.com
2018-11-02 23:20:26

只需要使用'-'来作为“cat”的额外输入

linux命令:echo "New first line" | cat - file.txt > newfile.txt; mv newfile.txt file.txt file.txt newfile.txt mv newfile.txt; > file.txt - cat | line" first "New echo echo "New first line" | cat - file.txt > newfile.txt; mv newfile.txt file.txtrootopen.com
linux命令:echo "New first line" | cat - file.txt > newfile.txt; mv newfile.txt file.txt file.txt newfile.txt mv newfile.txt; > file.txt - cat | line" first "New echo echo "New first line" | cat - file.txt > newfile.txt; mv newfile.txt file.txtrootopen.com
2018-10-22 21:09:13

Finder压缩到ZIP,但总是包含无关的元数据文件(__MACOSX和. ds_store)文件和文件夹,可能会混淆其他程序。一种选择是创建它们,然后编辑ZIP。这个可以独立工作或automator脚本接受多个选择(文件或文件夹)并创建一个zip

linux命令:echo "$@" for f in "$@"; do FILENAME=${f##*/};FILEPATH=${f%/*}; cd "${FILEPATH}"; zip -r "${f}".zip "${FILENAME}" -x "*.DS_Store" -x "__MACOSX"; done; afplay /System/Library/Sounds/Sosumi.aiff /System/Library/Sounds/Sosumi.aiff afplay done; "__MACOSX"; -x "*.DS_Store" -x "${FILENAME}" "${f}".zip -r zip "${FILEPATH}"; cd FILENAME=${f##*/};FILEPATH=${f%/*}; do "$@"; in f for "$@" echo echo "$@" for f in "$@"; do FILENAME=${f##*/};FILEPATH=${f%/*}; cd "${FILEPATH}"; zip -r "${f}".zip "${FILENAME}" -x "*.DS_Store" -x "__MACOSX"; done; afplay /System/Library/Sounds/Sosumi.aiffrootopen.com
linux命令:echo "$@" for f in "$@"; do FILENAME=${f##*/};FILEPATH=${f%/*}; cd "${FILEPATH}"; zip -r "${f}".zip "${FILENAME}" -x "*.DS_Store" -x "__MACOSX"; done; afplay /System/Library/Sounds/Sosumi.aiff /System/Library/Sounds/Sosumi.aiff afplay done; "__MACOSX"; -x "*.DS_Store" -x "${FILENAME}" "${f}".zip -r zip "${FILEPATH}"; cd FILENAME=${f##*/};FILEPATH=${f%/*}; do "$@"; in f for "$@" echo echo "$@" for f in "$@"; do FILENAME=${f##*/};FILEPATH=${f%/*}; cd "${FILEPATH}"; zip -r "${f}".zip "${FILENAME}" -x "*.DS_Store" -x "__MACOSX"; done; afplay /System/Library/Sounds/Sosumi.aiffrootopen.com
2018-10-22 21:06:40

bc是一个简单但功能强大且任意精度的CLI计算器语言,可以像这样使用:

linux命令:echo 20.05 + 15.00 | bc bc | 15.00 + 20.05 echo echo 20.05 + 15.00 | bcrootopen.com
linux命令:echo 20.05 + 15.00 | bc bc | 15.00 + 20.05 echo echo 20.05 + 15.00 | bcrootopen.com
2018-08-20 22:24:54

linux命令:echo -e "\n[sublime-text]\nServer = https://download.sublimetext.com/arch/dev/x86_64" | sudo tee -a /etc/pacman.conf /etc/pacman.conf -a tee sudo | https://download.sublimetext.com/arch/dev/x86_64" = "\n[sublime-text]\nServer -e echo echo -e "\n[sublime-text]\nServer = https://download.sublimetext.com/arch/dev/x86_64" | sudo tee -a /etc/pacman.conf rootopen.com
linux命令:echo -e "\n[sublime-text]\nServer = https://download.sublimetext.com/arch/dev/x86_64" | sudo tee -a /etc/pacman.conf /etc/pacman.conf -a tee sudo | https://download.sublimetext.com/arch/dev/x86_64" = "\n[sublime-text]\nServer -e echo echo -e "\n[sublime-text]\nServer = https://download.sublimetext.com/arch/dev/x86_64" | sudo tee -a /etc/pacman.conf rootopen.com
2018-08-15 22:24:24

linux命令:echo $HOME $HOME echo echo $HOMErootopen.com
linux命令:echo $HOME $HOME echo echo $HOMErootopen.com
2018-08-09 21:49:17

linux命令:echo "some text `date +%Y-%m-%d\_%H:%M:%S`" >> /path/to/filename /path/to/filename >> +%Y-%m-%d\_%H:%M:%S`" `date text "some echo echo "some text `date +%Y-%m-%d\_%H:%M:%S`" >> /path/to/filenamerootopen.com
linux命令:echo "some text `date +%Y-%m-%d\_%H:%M:%S`" >> /path/to/filename /path/to/filename >> +%Y-%m-%d\_%H:%M:%S`" `date text "some echo echo "some text `date +%Y-%m-%d\_%H:%M:%S`" >> /path/to/filenamerootopen.com
2018-07-27 22:25:11

对于AWS的手动域迁移过程感到沮丧,我试图安装cli53,route53-transfer失败了。我改为编写此oneliner以简化导出(通过AWS控制台ATM不支持)。输出可以轻松粘贴到Route53中的“导入托管区”对话框中。SOA / NS记录被排除,因为它们无法自动导入。

linux命令:echo -e "\$ORIGIN\tumccr.org.\n\$TTL\t1h\n" && aws route53 list-resource-record-sets --hosted-zone-id Z1EEXAMPLE9SF3 | jq -r '.ResourceRecordSets[] | [.Name, .Type, .ResourceRecords[0].Value] | join("\t")' - | grep -vE "NS|SOA" "NS|SOA" -vE grep | - join("\t")' | .ResourceRecords[0].Value] .Type, [.Name, | '.ResourceRecordSets[] -r jq | Z1EEXAMPLE9SF3 --hosted-zone-id list-resource-record-sets route53 aws && "\$ORIGIN\tumccr.org.\n\$TTL\t1h\n" -e echo echo -e "\$ORIGIN\tumccr.org.\n\$TTL\t1h\n" && aws route53 list-resource-record-sets --hosted-zone-id Z1EEXAMPLE9SF3 | jq -r '.ResourceRecordSets[] | [.Name, .Type, .ResourceRecords[0].Value] | join("\t")' - | grep -vE "NS|SOA"rootopen.com
linux命令:echo -e "\$ORIGIN\tumccr.org.\n\$TTL\t1h\n" && aws route53 list-resource-record-sets --hosted-zone-id Z1EEXAMPLE9SF3 | jq -r '.ResourceRecordSets[] | [.Name, .Type, .ResourceRecords[0].Value] | join("\t")' - | grep -vE "NS|SOA" "NS|SOA" -vE grep | - join("\t")' | .ResourceRecords[0].Value] .Type, [.Name, | '.ResourceRecordSets[] -r jq | Z1EEXAMPLE9SF3 --hosted-zone-id list-resource-record-sets route53 aws && "\$ORIGIN\tumccr.org.\n\$TTL\t1h\n" -e echo echo -e "\$ORIGIN\tumccr.org.\n\$TTL\t1h\n" && aws route53 list-resource-record-sets --hosted-zone-id Z1EEXAMPLE9SF3 | jq -r '.ResourceRecordSets[] | [.Name, .Type, .ResourceRecords[0].Value] | join("\t")' - | grep -vE "NS|SOA"rootopen.com
2018-07-14 16:27:17

用于计算CoNLL数据格式的所有句子

linux命令:echo $(( $(grep -c '^ $' file_name) / 2 )) )) 2 / file_name) $' '^ -c $(grep $(( echo echo $(( $(grep -c '^ $' file_name) / 2 ))rootopen.com
linux命令:echo $(( $(grep -c '^ $' file_name) / 2 )) )) 2 / file_name) $' '^ -c $(grep $(( echo echo $(( $(grep -c '^ $' file_name) / 2 ))rootopen.com
2018-07-14 16:08:54

;)

linux命令:echo SSBMb3ZlIFlvdQo= | base64 -d -d base64 | SSBMb3ZlIFlvdQo= echo echo SSBMb3ZlIFlvdQo= | base64 -drootopen.com
linux命令:echo SSBMb3ZlIFlvdQo= | base64 -d -d base64 | SSBMb3ZlIFlvdQo= echo echo SSBMb3ZlIFlvdQo= | base64 -drootopen.com
2018-04-29 07:41:48

这是cron的替代方案,它允许在一定时间内安排一次性任务。

linux命令:echo "ls -l" | at midnight midnight at | -l" "ls echo echo "ls -l" | at midnightrootopen.com
linux命令:echo "ls -l" | at midnight midnight at | -l" "ls echo echo "ls -l" | at midnightrootopen.com
2018-03-07 15:01:48

将标准mysql客户端输出更改为'less'。换句话说,使得mysql命令行客户端的查询结果看起来好多了。

linux命令:echo -e "[mysql]\npager=less -niSFX" >> ~/.my.cnf ~/.my.cnf >> -niSFX" "[mysql]\npager=less -e echo echo -e "[mysql]\npager=less -niSFX" >> ~/.my.cnfrootopen.com
linux命令:echo -e "[mysql]\npager=less -niSFX" >> ~/.my.cnf ~/.my.cnf >> -niSFX" "[mysql]\npager=less -e echo echo -e "[mysql]\npager=less -niSFX" >> ~/.my.cnfrootopen.com
2018-02-08 21:03:48

对于想要在安静的时候运行的工作有好处。默认阈值是0.8的平均负载,但可以使用atrun来设置。

linux命令:echo "rm -rf /unwanted-but-large/folder" | batch batch | /unwanted-but-large/folder" -rf "rm echo echo "rm -rf /unwanted-but-large/folder" | batchrootopen.com
linux命令:echo "rm -rf /unwanted-but-large/folder" | batch batch | /unwanted-but-large/folder" -rf "rm echo echo "rm -rf /unwanted-but-large/folder" | batchrootopen.com
2018-03-10 09:47:48

linux命令:echo 16i `echo "F" | tr '[a-f]' '[A-F]'` p | dc ; echo 16o "15" p | dc dc | p "15" 16o echo ; dc | p '[A-F]'` '[a-f]' tr | "F" `echo 16i echo echo 16i `echo "F" | tr '[a-f]' '[A-F]'` p | dc ; echo 16o "15" p | dcrootopen.com
linux命令:echo 16i `echo "F" | tr '[a-f]' '[A-F]'` p | dc ; echo 16o "15" p | dc dc | p "15" 16o echo ; dc | p '[A-F]'` '[a-f]' tr | "F" `echo 16i echo echo 16i `echo "F" | tr '[a-f]' '[A-F]'` p | dc ; echo 16o "15" p | dcrootopen.com
2018-06-09 20:51:48

linux命令:echo "SHOW PROCESSLIST\G" | mysql -u root -p | grep "Info:" | awk -F":" '{count[$NF]++}END{for(i in count){printf("%d: %s\n", count[i], i)}}' | sort -n -n sort | i)}}' count[i], %s\n", count){printf("%d: in '{count[$NF]++}END{for(i -F":" awk | "Info:" grep | -p root -u mysql | PROCESSLIST\G" "SHOW echo echo "SHOW PROCESSLIST\G" | mysql -u root -p | grep "Info:" | awk -F":" '{count[$NF]++}END{for(i in count){printf("%d: %s\n", count[i], i)}}' | sort -nrootopen.com
linux命令:echo "SHOW PROCESSLIST\G" | mysql -u root -p | grep "Info:" | awk -F":" '{count[$NF]++}END{for(i in count){printf("%d: %s\n", count[i], i)}}' | sort -n -n sort | i)}}' count[i], %s\n", count){printf("%d: in '{count[$NF]++}END{for(i -F":" awk | "Info:" grep | -p root -u mysql | PROCESSLIST\G" "SHOW echo echo "SHOW PROCESSLIST\G" | mysql -u root -p | grep "Info:" | awk -F":" '{count[$NF]++}END{for(i in count){printf("%d: %s\n", count[i], i)}}' | sort -nrootopen.com
2018-05-16 19:15:48

远程连接到https站点,获取ssl证书并显示证书的有效日期

linux命令:echo | openssl s_client -connect www.google.com:443 2>/dev/null |openssl x509 -dates -noout -noout -dates x509 |openssl 2>/dev/null www.google.com:443 -connect s_client openssl | echo echo | openssl s_client -connect www.google.com:443 2>/dev/null |openssl x509 -dates -nooutrootopen.com
linux命令:echo | openssl s_client -connect www.google.com:443 2>/dev/null |openssl x509 -dates -noout -noout -dates x509 |openssl 2>/dev/null www.google.com:443 -connect s_client openssl | echo echo | openssl s_client -connect www.google.com:443 2>/dev/null |openssl x509 -dates -nooutrootopen.com
2018-06-03 13:55:48

可自定义的上下文搜索 - 如果你知道sed,这是比grep --context提供更复杂上下文控制的基础

linux命令:echo -n search\>\ ; read SEARCH_STRING && sed -n "/$SEARCH_STRING/{n;p;n;p;n;p;q}" [file-to-search] [file-to-search] "/$SEARCH_STRING/{n;p;n;p;n;p;q}" -n sed && SEARCH_STRING read ; search\>\ -n echo echo -n search\>\ ; read SEARCH_STRING && sed -n "/$SEARCH_STRING/{n;p;n;p;n;p;q}" [file-to-search]rootopen.com
linux命令:echo -n search\>\ ; read SEARCH_STRING && sed -n "/$SEARCH_STRING/{n;p;n;p;n;p;q}" [file-to-search] [file-to-search] "/$SEARCH_STRING/{n;p;n;p;n;p;q}" -n sed && SEARCH_STRING read ; search\>\ -n echo echo -n search\>\ ; read SEARCH_STRING && sed -n "/$SEARCH_STRING/{n;p;n;p;n;p;q}" [file-to-search]rootopen.com
2018-01-31 07:41:48

提示输入搜索字词,然后从Google图像中提取第一个结果

linux命令:echo -n "search> ";read QUERY && wget -O - `wget -O - -U "Mozilla/5.0" "http://images.google.com/images?q=${QUERY}" 2>/dev/null |sed -e 's/","http/\n","http/g' |awk -F \" '{print $3}' |grep -i http: |head -1` > "$QUERY" "$QUERY" > -1` |head http: -i |grep $3}' '{print \" -F |awk 's/","http/\n","http/g' -e |sed 2>/dev/null "http://images.google.com/images?q=${QUERY}" "Mozilla/5.0" -U - -O `wget - -O wget && QUERY ";read "search> -n echo echo -n "search> ";read QUERY && wget -O - `wget -O - -U "Mozilla/5.0" "http://images.google.com/images?q=${QUERY}" 2>/dev/null |sed -e 's/","http/\n","http/g' |awk -F \" '{print $3}' |grep -i http: |head -1` > "$QUERY"rootopen.com
linux命令:echo -n "search> ";read QUERY && wget -O - `wget -O - -U "Mozilla/5.0" "http://images.google.com/images?q=${QUERY}" 2>/dev/null |sed -e 's/","http/\n","http/g' |awk -F \" '{print $3}' |grep -i http: |head -1` > "$QUERY" "$QUERY" > -1` |head http: -i |grep $3}' '{print \" -F |awk 's/","http/\n","http/g' -e |sed 2>/dev/null "http://images.google.com/images?q=${QUERY}" "Mozilla/5.0" -U - -O `wget - -O wget && QUERY ";read "search> -n echo echo -n "search> ";read QUERY && wget -O - `wget -O - -U "Mozilla/5.0" "http://images.google.com/images?q=${QUERY}" 2>/dev/null |sed -e 's/","http/\n","http/g' |awk -F \" '{print $3}' |grep -i http: |head -1` > "$QUERY"rootopen.com
2018-04-09 16:18:48

linux命令:echo "import random; print(random.choice(['heads', 'tails']))" | python python | 'tails']))" print(random.choice(['heads', random; "import echo echo "import random; print(random.choice(['heads', 'tails']))" | pythonrootopen.com
linux命令:echo "import random; print(random.choice(['heads', 'tails']))" | python python | 'tails']))" print(random.choice(['heads', random; "import echo echo "import random; print(random.choice(['heads', 'tails']))" | pythonrootopen.com
2018-01-25 20:40:48

linux命令:echo 'ibase=10; obase=2; 127' | bc bc | 127' obase=2; 'ibase=10; echo echo 'ibase=10; obase=2; 127' | bcrootopen.com
linux命令:echo 'ibase=10; obase=2; 127' | bc bc | 127' obase=2; 'ibase=10; echo echo 'ibase=10; obase=2; 127' | bcrootopen.com
2018-06-06 16:51:48

这是生成(非浮点)CPU限制任务进行基准测试的快速且肮脏的方法。根据需要将“20”调整为更高或更低的值。作为一个基准,这可能比bogomips更少一些虚假,它可以在任何'bc'都能运行。

linux命令:echo '2^2^20' | time bc > /dev/null /dev/null > bc time | '2^2^20' echo echo '2^2^20' | time bc > /dev/nullrootopen.com
linux命令:echo '2^2^20' | time bc > /dev/null /dev/null > bc time | '2^2^20' echo echo '2^2^20' | time bc > /dev/nullrootopen.com
2018-01-03 22:30:48

linux命令:echo "Xc" | tr "Xo" "\033\017 "\033\017 "Xo" tr | "Xc" echo echo "Xc" | tr "Xo" "\033\017rootopen.com
linux命令:echo "Xc" | tr "Xo" "\033\017 "\033\017 "Xo" tr | "Xc" echo echo "Xc" | tr "Xo" "\033\017rootopen.com
2018-01-19 14:48:48

返回当前的shell。它比打印$ SHELL好,有时可能会返回一个错误的值。

linux命令:echo $0 $0 echo echo $0rootopen.com
linux命令:echo $0 $0 echo echo $0rootopen.com
2018-05-18 12:40:48

linux命令:echo -n m{1..5}.cluster.net | xargs -d' ' -n1 -P5 -I{} ssh {} 'uptime' 'uptime' {} ssh -I{} -P5 -n1 ' -d' xargs | m{1..5}.cluster.net -n echo echo -n m{1..5}.cluster.net | xargs -d' ' -n1 -P5 -I{} ssh {} 'uptime'rootopen.com
linux命令:echo -n m{1..5}.cluster.net | xargs -d' ' -n1 -P5 -I{} ssh {} 'uptime' 'uptime' {} ssh -I{} -P5 -n1 ' -d' xargs | m{1..5}.cluster.net -n echo echo -n m{1..5}.cluster.net | xargs -d' ' -n1 -P5 -I{} ssh {} 'uptime'rootopen.com
2018-01-03 08:33:48

这可以在bash和zsh中使用。如果你需要经常查看它,你可能还想要别名。alias lpath =“echo \ $ PATH | tr:\\\\ n”“\ $ PATH”一定要看看你当前的$ PATH

linux命令:echo $PATH | tr : \\n \\n : tr | $PATH echo echo $PATH | tr : \\nrootopen.com
linux命令:echo $PATH | tr : \\n \\n : tr | $PATH echo echo $PATH | tr : \\nrootopen.com
2018-01-02 19:45:48

linux命令:echo $(( (1234567890 - `date -u +\%s`) / 60 / 60 )) )) 60 / 60 / +\%s`) -u `date - (1234567890 $(( echo echo $(( (1234567890 - `date -u +\%s`) / 60 / 60 ))rootopen.com
linux命令:echo $(( (1234567890 - `date -u +\%s`) / 60 / 60 )) )) 60 / 60 / +\%s`) -u `date - (1234567890 $(( echo echo $(( (1234567890 - `date -u +\%s`) / 60 / 60 ))rootopen.com
2018-04-08 06:16:48

linux命令:echo 'example' | sed -e 's/^\(.\)/\U\1/' 's/^\(.\)/\U\1/' -e sed | 'example' echo echo 'example' | sed -e 's/^\(.\)/\U\1/'rootopen.com
linux命令:echo 'example' | sed -e 's/^\(.\)/\U\1/' 's/^\(.\)/\U\1/' -e sed | 'example' echo echo 'example' | sed -e 's/^\(.\)/\U\1/'rootopen.com
2018-01-04 20:20:48

修改您的用户名和密码的脚本,并将其另存为脚本。运行脚本,并享受./tweet

linux命令:echo "Set Twitter Status" ; read STATUS; curl -u user:pass -d status="$STATUS" http://twitter.com/statuses/update.xml http://twitter.com/statuses/update.xml status="$STATUS" -d user:pass -u curl STATUS; read ; Status" Twitter "Set echo echo "Set Twitter Status" ; read STATUS; curl -u user:pass -d status="$STATUS" http://twitter.com/statuses/update.xmlrootopen.com
linux命令:echo "Set Twitter Status" ; read STATUS; curl -u user:pass -d status="$STATUS" http://twitter.com/statuses/update.xml http://twitter.com/statuses/update.xml status="$STATUS" -d user:pass -u curl STATUS; read ; Status" Twitter "Set echo echo "Set Twitter Status" ; read STATUS; curl -u user:pass -d status="$STATUS" http://twitter.com/statuses/update.xmlrootopen.com
2018-01-25 19:41:48

用命令行中的perl模式替换sed正则表达式。sed等效于:echo“sed -e”| sed -e's / sed -e / perl -pe /'

linux命令:echo "sed -e"|perl -pe 's/sed -e/perl -pe/' -pe/' -e/perl 's/sed -pe -e"|perl "sed echo echo "sed -e"|perl -pe 's/sed -e/perl -pe/'rootopen.com
linux命令:echo "sed -e"|perl -pe 's/sed -e/perl -pe/' -pe/' -e/perl 's/sed -pe -e"|perl "sed echo echo "sed -e"|perl -pe 's/sed -e/perl -pe/'rootopen.com
2018-04-01 14:15:48

该命令将MySQL查询直接转换为.csv(逗号分隔值)文件。

linux命令:echo "SELECT * FROM table; " | mysql -u root -p${MYSQLROOTPW} databasename | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > outfile.csv outfile.csv > 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' sed | databasename -p${MYSQLROOTPW} root -u mysql | " table; FROM * "SELECT echo echo "SELECT * FROM table; " | mysql -u root -p${MYSQLROOTPW} databasename | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > outfile.csvrootopen.com
linux命令:echo "SELECT * FROM table; " | mysql -u root -p${MYSQLROOTPW} databasename | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > outfile.csv outfile.csv > 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' sed | databasename -p${MYSQLROOTPW} root -u mysql | " table; FROM * "SELECT echo echo "SELECT * FROM table; " | mysql -u root -p${MYSQLROOTPW} databasename | sed 's/\t/","/g;s/^/"/;s/$/"/;s/\n//g' > outfile.csvrootopen.com
2018-01-29 21:04:48

我知道它并不多,但在耗时的脚本(cron,rc.d等)中非常有用。

linux命令:echo * * echo echo *rootopen.com
linux命令:echo * * echo echo *rootopen.com
2018-06-02 16:52:48

扩展时,bash输出命令,所以不要害怕输入命令。以下是详细信息:第一个示例:echo foo bar foobar barfooFirst argument:echo!$ echo barfoobarfoo(请注意,键入echo foo bar foobar barfoo && echo!$,bash替换!$ with $:1)最后一个参数:echo foo bar foobar barfoo && echo!^ echo foo bar foobar barfoo && echo barfoofoo bar foobar barfoobarfooAll the arguments:echo!* echo foo bar foobar barfooo bar第三个参数:echo foo bar foobar barfoo && echo!:3echo foo bar foobar barfoo && echo foobarfoo bar foobar barfoofoobarYou可能想为大数字添加{}:echo!:{11} exampleNow with path:echo / usr / bin / foob​​ar / usr / bin / foobar对于head:echo!$:hecho / usr / bin / usr / bin和tail:echo!$:techo foobarfoobar您也可以尝试!:h和!:t或!! 3-4为第三和第四(所以!!:* == !!:1- $)

linux命令:echo foo bar foobar barfoo && echo !$ !^ !:3 !* && echo /usr/bin/foobar&& echo !$:h !$:t !$:t !$:h echo /usr/bin/foobar&& echo && !* !:3 !^ !$ echo && barfoo foobar bar foo echo echo foo bar foobar barfoo && echo !$ !^ !:3 !* && echo /usr/bin/foobar&& echo !$:h !$:trootopen.com
linux命令:echo foo bar foobar barfoo && echo !$ !^ !:3 !* && echo /usr/bin/foobar&& echo !$:h !$:t !$:t !$:h echo /usr/bin/foobar&& echo && !* !:3 !^ !$ echo && barfoo foobar bar foo echo echo foo bar foobar barfoo && echo !$ !^ !:3 !* && echo /usr/bin/foobar&& echo !$:h !$:trootopen.com
2018-05-07 07:51:48

linux命令:echo $RANDOM $RANDOM echo echo $RANDOMrootopen.com
linux命令:echo $RANDOM $RANDOM echo echo $RANDOMrootopen.com
2018-05-09 10:31:48

如果您使用的是支持xterm模拟的终端仿真程序,例如Linux桌面上的PuTTY或xterm,则此命令将替换该终端窗口的标题。我知道在你的桌面上有十七个标题为PuTTY的终端是不好的,你不能说出哪一个连接到哪个服务器并且做了什么。尽管引号之间的字符串被输入为文字,但它需要更多的巧妙使其工作。下面是它是如何做到的key-by-key:echo“(ctrl-v然后ctrl- [)0; Enter_Title_String_Here(ctrl-v然后ctrl-g)”(enter)ctrl-v:表示按住ctrl键并点击v与此同时,你正在粘在风中;也请不要输入括号,即(和)

linux命令:echo "^[]0;My_Title_Goes _Here^G" _Here^G" "^[]0;My_Title_Goes echo echo "^[]0;My_Title_Goes _Here^G"rootopen.com
linux命令:echo "^[]0;My_Title_Goes _Here^G" _Here^G" "^[]0;My_Title_Goes echo echo "^[]0;My_Title_Goes _Here^G"rootopen.com
2018-02-24 23:07:48

这是sudo新手所犯的常见错误的解决方案,sincesudo echo“foo bar”>> / path / to / some / filedoes不以root身份添加到文件。或者,sudo echo“foo bar”> / path / to / some / file应该被echo“foo bar”|替换sudo tee / path / to / some / file如果你对tee stdout不感兴趣,你可以在最后添加> / dev / null:echo“foo bar”| sudo tee -a / path / to / some / file> / dev / null

linux命令:echo "foo bar" | sudo tee -a /path/to/some/file /path/to/some/file -a tee sudo | bar" "foo echo echo "foo bar" | sudo tee -a /path/to/some/filerootopen.com
linux命令:echo "foo bar" | sudo tee -a /path/to/some/file /path/to/some/file -a tee sudo | bar" "foo echo echo "foo bar" | sudo tee -a /path/to/some/filerootopen.com
2018-02-26 04:25:48

linux命令:echo 1+1|bc 1+1|bc echo echo 1+1|bcrootopen.com
linux命令:echo 1+1|bc 1+1|bc echo echo 1+1|bcrootopen.com
2018-05-23 19:15:48

.bash_profile的上面一行将在您登录到远程服务器时为您提供putty或终端客户端中的窗口标题

linux命令:echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007" ${PWD}\007" "\033]0;${USER}@${HOSTNAME}: -ne echo echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"rootopen.com
linux命令:echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007" ${PWD}\007" "\033]0;${USER}@${HOSTNAME}: -ne echo echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"rootopen.com
2018-02-14 18:14:48

Linux的Bash命令行(A-Z排序)