
{"id":17193,"date":"2018-09-23T19:18:50","date_gmt":"2018-09-23T19:18:50","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=17193"},"modified":"2018-09-23T19:18:50","modified_gmt":"2018-09-23T19:18:50","slug":"compgen-builtin-command-exposure","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2018\/09\/23\/compgen-builtin-command-exposure\/","title":{"rendered":"compgen builtin command exposure"},"content":{"rendered":"<p><u>ABOUT compgen<\/u><\/p>\n<pre>\ncompgen is bash built-in command and it will show all available commands, aliases, and functions for you. \n<\/pre>\n<p><u>TYPICAL COMMANDLINE EXPOSURE RELATED<\/u><br \/>\n[bash]<br \/>\n$compgen -k<br \/>\nif<br \/>\nthen<br \/>\nelse<br \/>\nelif<br \/>\nfi<br \/>\ncase<br \/>\nesac<br \/>\nfor<br \/>\nselect<br \/>\nwhile<br \/>\nuntil<br \/>\ndo<br \/>\ndone<br \/>\nin<br \/>\nfunction<br \/>\ntime<br \/>\n{<br \/>\n}<br \/>\n!<br \/>\n[[<br \/>\n]]<br \/>\ncoproc<br \/>\n$<br \/>\n$compgen -a<br \/>\nls<br \/>\n$<br \/>\n$compgen -b<br \/>\n.<br \/>\n:<br \/>\n[<br \/>\nalias<br \/>\nbg<br \/>\nbind<br \/>\nbreak<br \/>\nbuiltin<br \/>\ncaller<br \/>\ncd<br \/>\ncommand<br \/>\ncompgen<br \/>\ncomplete<br \/>\ncompopt<br \/>\ncontinue<br \/>\ndeclare<br \/>\ndirs<br \/>\ndisown<br \/>\necho<br \/>\nenable<br \/>\neval<br \/>\nexec<br \/>\nexit<br \/>\nexport<br \/>\nfalse<br \/>\nfc<br \/>\nfg<br \/>\ngetopts<br \/>\nhash<br \/>\nhelp<br \/>\nhistory<br \/>\njobs<br \/>\nkill<br \/>\nlet<br \/>\nlocal<br \/>\nlogout<br \/>\nmapfile<br \/>\npopd<br \/>\nprintf<br \/>\npushd<br \/>\npwd<br \/>\nread<br \/>\nreadarray<br \/>\nreadonly<br \/>\nreturn<br \/>\nset<br \/>\nshift<br \/>\nshopt<br \/>\nsource<br \/>\nsuspend<br \/>\ntest<br \/>\ntimes<br \/>\ntrap<br \/>\ntrue<br \/>\ntype<br \/>\ntypeset<br \/>\nulimit<br \/>\numask<br \/>\nunalias<br \/>\nunset<br \/>\nwait<br \/>\n$<br \/>\n[\/bash]<br \/>\n[bash]<br \/>\n$cat comp.sh<br \/>\n#!\/bin\/bash<\/p>\n<p>commands=`compgen -c`<br \/>\nlet count=1<\/p>\n<p>for i in ${commands[@]}<br \/>\ndo<\/p>\n<p>        what=`whatis $i`<\/p>\n<p>        echo -e &quot;n33[38;5;148m$count. $i: 33[39m&quot;<br \/>\n        echo -e &quot;$what&quot;<\/p>\n<p>        ((count++))<\/p>\n<p>done<br \/>\n$<\/p>\n<p>$bash comp.sh  | head<br \/>\nif: nothing appropriate.<br \/>\nn33[38;5;148m1. if: 33[39m<\/p>\n<p>then: nothing appropriate.<br \/>\nn33[38;5;148m2. then: 33[39m<\/p>\n<p>else: nothing appropriate.<br \/>\nn33[38;5;148m3. else: 33[39m<\/p>\n<p>elif: nothing appropriate.<br \/>\nn33[38;5;148m4. elif: 33[39m<\/p>\n<p>fi: nothing appropriate.<br \/>\nn33[38;5;148m5. fi: 33[39m<\/p>\n<p>case: nothing appropriate.<br \/>\n$<\/p>\n<p>[\/bash]<br \/>\nLINKS<br \/>\n<a href=\"https:\/\/www.cyberciti.biz\/open-source\/command-line-hacks\/compgen-linux-command\/\">https:\/\/www.cyberciti.biz\/open-source\/command-line-hacks\/compgen-linux-command\/<\/a><br \/>\n<a href=\"https:\/\/www.gnu.org\/software\/bash\/manual\/html_node\/A-Programmable-Completion-Example.html\">https:\/\/www.gnu.org\/software\/bash\/manual\/html_node\/A-Programmable-Completion-Example.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ABOUT compgen compgen is bash built-in command and it will show all available commands, aliases, and functions for you. TYPICAL COMMANDLINE EXPOSURE RELATED [bash] $compgen -k if then else elif fi case esac for select while until do done in function time { } ! [[ ]] coproc $ $compgen -a ls $ $compgen -b &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2018\/09\/23\/compgen-builtin-command-exposure\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;compgen builtin command exposure&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,8],"tags":[563],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/17193"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=17193"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/17193\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=17193"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=17193"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=17193"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}