{"id":23,"date":"2008-08-21T00:54:35","date_gmt":"2008-08-20T22:54:35","guid":{"rendered":"http:\/\/www.blackhats.es\/wordpress\/?p=23"},"modified":"2022-08-20T18:26:25","modified_gmt":"2022-08-20T16:26:25","slug":"shell","status":"publish","type":"post","link":"https:\/\/www.blackhats.es\/wordpress\/?p=23","title":{"rendered":"Shell"},"content":{"rendered":"<p>Podemos ejecutar comandos shell mediante <strong>M-!<\/strong> el cual mostrar\u00e1 su salida usando el buffer <strong>*Shell Command Output*<\/strong>. Tenemos otra alternativa si queremos ejecutar el comando tomando como entrada una regi\u00f3n dada, mediante el uso del comando <strong>M-|<\/strong>.<\/p>\n<p>Adem\u00e1s <strong>C-u M-!<\/strong> nos permitir\u00e1 ejecutar un comando y poner el resultado sobre esa misma regi\u00f3n.<\/p>\n<p>En el momento que deseemos ejecutar una cantidad ingente de comandos, podemos abrir un shell directamente mediante <strong>M-x shell<\/strong>. Desde este shell, podemos usar los siguientes keystrokes para tener un control mayor:<\/p>\n<ul>\n<li><strong>C-c C-v<\/strong> :&#8217;<span style=\"color: #0000ff;\">comint-kill-outpu<\/span>t&#8217;; oculta la salida de un comando.<\/li>\n<\/ul>\n<ul>\n<li><strong>C-c C-c<\/strong> : termina un comando en ejecuci\u00f3n.<\/li>\n<\/ul>\n<ul>\n<li><strong>C-c C-z<\/strong> : termina un comando en ejecuci\u00f3n.<\/li>\n<\/ul>\n<ul>\n<li><strong>C-c C-o<\/strong> : &#8216;<span style=\"color: #0000ff;\">comint-kill-output<\/span>&#8216;; sigue ejecutando el comando, pero oculta su salida.<\/li>\n<\/ul>\n<ul>\n<li><strong>C-c C-r<\/strong> : &#8216;<span style=\"color: #0000ff;\">comint-show-output<\/span>&#8216;; muestra la salida de un comando.<\/li>\n<\/ul>\n<ul>\n<li><strong>C-c C-e<\/strong> : &#8216;<span style=\"color: #0000ff;\">comint-show-maximum-output<\/span>&#8216;; muestra la salida de un comando con l\u00edmite de buffer.<\/li>\n<\/ul>\n<ul>\n<li><strong>C-c C-p<\/strong> : se mueve al anterior comando de grupo.<\/li>\n<\/ul>\n<ul>\n<li> <strong>C-c C-n<\/strong> : se mueve al siguiente comando de grupo.<\/li>\n<\/ul>\n<p>Se puede redefinir la shell por defecto a usar a\u00f1adiendo en nuestro <strong>.emacs<\/strong> dicha l\u00ednea:<br \/>\n<em><br \/>\n(setq shell-file-name \u00ab\/bin\/zsh\u00bb)<\/em><\/p>\n<p>Existe otro problema, y es que si usamos el shell para conectar a ordenadores remotos, mostrar\u00e1 el password, si queremos que permanezca invisible debemos a\u00f1adir esta l\u00ednea a nuestro <strong>.emacs<\/strong>:<\/p>\n<p><em>(add-hook &#8216;commit-output-filter-functions<br \/>\n&#8216;comint-watch-for&#8211;password-prompt)<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Podemos ejecutar comandos shell mediante M-! el cual mostrar\u00e1 su salida usando el buffer *Shell Command Output*. Tenemos otra alternativa si queremos ejecutar el comando tomando como entrada una regi\u00f3n dada, mediante el uso del comando M-|. Adem\u00e1s C-u M-! nos permitir\u00e1 ejecutar un comando y poner el resultado sobre esa misma regi\u00f3n. En el [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[32],"class_list":["post-23","post","type-post","status-publish","format-standard","hentry","category-basic","tag-emacs-shell"],"_links":{"self":[{"href":"https:\/\/www.blackhats.es\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/23"}],"collection":[{"href":"https:\/\/www.blackhats.es\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.blackhats.es\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.blackhats.es\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.blackhats.es\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=23"}],"version-history":[{"count":1,"href":"https:\/\/www.blackhats.es\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/23\/revisions"}],"predecessor-version":[{"id":807,"href":"https:\/\/www.blackhats.es\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/23\/revisions\/807"}],"wp:attachment":[{"href":"https:\/\/www.blackhats.es\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.blackhats.es\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.blackhats.es\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}