Terminal (2/3): rede, compressão e processos

Terminal (2/3): rede, compressão e processos

Na primeira parte aprendemos a nos mover pela terminal, gerenciar arquivos e diretórios, as permissões, os redirecionamentos e a busca. Neste segundo capítulo damos o salto para as **utilidades de rede**, a **compressão de arquivos** e o **gerenciamento de processos**.

Aviso: Este post foi traduzido para o português usando um modelo de tradução automática. Por favor, me avise se encontrar algum erro.

📚 **Esta entrada faz parte da série _Introdução ao terminal_**, dividida em três capítulos que se lêem em ordem:

> * Parte 1: Navegação, arquivos y comandos

* 👉 **Parte 2: Rede, compressão e processos**

* Parte 3: Administração do sistema

Utilidades de redelink image 61

Informações das interfaces de rede com ifconfiglink image 62

O primeiro comando será ifconfig, que nos mostra informações das nossas interfaces de rede.

	
< > Input
Python
!ifconfig
Copied
>_ Output
			
br-470e52ae2708: flags=4099&lt;UP,BROADCAST,MULTICAST&gt; mtu 1500
inet 172.18.0.1 netmask 255.255.0.0 broadcast 172.18.255.255
ether 02:42:ac:d0:b9:eb txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
docker0: flags=4099&lt;UP,BROADCAST,MULTICAST&gt; mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:5d:15:1c:e9 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
enp6s0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt; mtu 1500
inet 192.168.1.144 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::7dc2:6944:3fbe:c18e prefixlen 64 scopeid 0x20&lt;link&gt;
ether 24:4b:fe:5c:f6:59 txqueuelen 1000 (Ethernet)
RX packets 144369 bytes 123807349 (123.8 MB)
RX errors 0 dropped 2056 overruns 0 frame 0
TX packets 100672 bytes 55678042 (55.6 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73&lt;UP,LOOPBACK,RUNNING&gt; mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10&lt;host&gt;
loop txqueuelen 1000 (Bucle local)
RX packets 10748 bytes 1832545 (1.8 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 10748 bytes 1832545 (1.8 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlp5s0: flags=4099&lt;UP,BROADCAST,MULTICAST&gt; mtu 1500
ether 4c:77:cb:1d:66:cc txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Como vemos, temos as informações de todas as interfaces de rede do meu computador, mas se eu quiser saber apenas a de uma, ela é especificada adicionando seu nome

	
< > Input
Python
!ifconfig enp6s0
Copied
>_ Output
			
enp6s0: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt; mtu 1500
inet 192.168.1.144 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::7dc2:6944:3fbe:c18e prefixlen 64 scopeid 0x20&lt;link&gt;
ether 24:4b:fe:5c:f6:59 txqueuelen 1000 (Ethernet)
RX packets 144467 bytes 123842258 (123.8 MB)
RX errors 0 dropped 2060 overruns 0 frame 0
TX packets 100786 bytes 55749109 (55.7 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Informações das interfaces de rede com iplink image 63

Outra maneira de obter as informações das nossas interfaces de rede é por meio do comando ip, adicionando a ele nos dá as informações de todas as interfaces

	
< > Input
Python
!ip a
Copied
>_ Output
			
1: lo: &lt;LOOPBACK,UP,LOWER_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp6s0: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 24:4b:fe:5c:f6:59 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.144/24 brd 192.168.1.255 scope global dynamic noprefixroute enp6s0
valid_lft 80218sec preferred_lft 80218sec
inet6 fe80::7dc2:6944:3fbe:c18e/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: wlp5s0: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 4c:77:cb:1d:66:cc brd ff:ff:ff:ff:ff:ff
4: br-470e52ae2708: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:ac:d0:b9:eb brd ff:ff:ff:ff:ff:ff
inet 172.18.0.1/16 brd 172.18.255.255 scope global br-470e52ae2708
valid_lft forever preferred_lft forever
5: docker0: &lt;NO-CARRIER,BROADCAST,MULTICAST,UP&gt; mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:5d:15:1c:e9 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever

Teste de comunicações com pinglink image 64

Outro comando útil é ping, que nos pode servir para ver se temos conexão com uma determinada IP. Por exemplo, a IP do Google é 142.250.200.78, por isso fazemos ping para ver se nos responde. O comando ping no Linux faz pings sem parar, por isso nunca termina até que o interrompamos; para que isso não aconteça, adicionamos a flag -c e o número de tentativas

	
< > Input
Python
!ping 142.250.200.132 -c 4
Copied
>_ Output
			
PING 142.250.200.132 (142.250.200.132) 56(84) bytes of data.
64 bytes from 142.250.200.132: icmp_seq=1 ttl=117 time=3.46 ms
64 bytes from 142.250.200.132: icmp_seq=2 ttl=117 time=3.77 ms
64 bytes from 142.250.200.132: icmp_seq=3 ttl=117 time=2.81 ms
64 bytes from 142.250.200.132: icmp_seq=4 ttl=117 time=2.86 ms
--- 142.250.200.132 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 2.812/3.227/3.773/0.405 ms

O mesmo teria acontecido se o tivéssemos feito diretamente em google.com

	
< > Input
Python
!ping www.google.com -c 4
Copied
>_ Output
			
PING www.google.com (142.250.200.132) 56(84) bytes of data.
64 bytes from mad41s14-in-f4.1e100.net (142.250.200.132): icmp_seq=1 ttl=117 time=2.74 ms
64 bytes from mad41s14-in-f4.1e100.net (142.250.200.132): icmp_seq=2 ttl=117 time=3.96 ms
64 bytes from mad41s14-in-f4.1e100.net (142.250.200.132): icmp_seq=3 ttl=117 time=3.56 ms
64 bytes from mad41s14-in-f4.1e100.net (142.250.200.132): icmp_seq=4 ttl=117 time=2.87 ms
--- www.google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 2.741/3.283/3.962/0.499 ms

Baixar arquivos-fonte com curllink image 65

Podemos obter um arquivo de texto de um endereço dado por meio do comando curl, por exemplo, podemos baixar o HTML do Google

	
< > Input
Python
!curl https://www.google.com
Copied
>_ Output
			
&lt;!doctype html&gt;&lt;html itemscope="" itemtype="http://schema.org/WebPage" lang="es"&gt;&lt;head&gt;&lt;meta content="Google.es permite acceder a la informaci�n mundial en castellano, catal�n, gallego, euskara e ingl�s." name="description"&gt;&lt;meta content="noodp" name="robots"&gt;&lt;meta content="text/html; charset=UTF-8" http-equiv="Content-Type"&gt;&lt;meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"&gt;&lt;title&gt;Google&lt;/title&gt;&lt;script nonce="zXcc4tMJWBRoE7q_o_Z2fQ"&gt;(function(){window.google={kEI:'M5GOY6PeLr-jkdUP1pir0AE',kEXPI:'0,1359409,6059,206,4804,2316,383,246,5,5367,1123753,1197713,688,380089,16115,28684,22430,1362,12312,17587,4998,13228,3847,10622,22741,5081,1593,1279,2742,149,1103,840,1983,214,4100,3514,606,2023,2297,14670,3227,2845,7,4773,28997,1850,15757,3,346,230,6459,149,13975,4,1528,2304,7039,27731,7357,13658,4437,16786,5815,2542,4094,4052,3,3541,1,14262,27892,2,14022,6248,19490,5680,1021,2380,28741,4569,6255,23421,1252,5835,14967,4333,7484,11406,15676,8155,7381,15970,873,14804,1,4828,7,1922,5784,12208,10330,587,12192,4832,26504,5796,3,14433,3890,751,13384,1499,3,679,1622,1779,1886,338,1627,1119,6,8909,80,243,458,3438,1763,722,1020,813,91,1133,10,280,2306,44,77,1420,3,562,402,314,275,2095,440,399,138,384,1033,334,2667,2,723,444,79,403,501,929,3,785,2,240,78,2022,284,196,732,175,342,244,617,335,1,841,1275,14,979,57,857,446,2,1900,838,251,227,50,21,8,3,442,57,40,936,697,773,95,121,643,1502,163,355,702,195,1,452,50,334,687,109,1,19,109,134,546,80,5,36,124,68,135,131,415,47,27,266,563,48,231,742,15,527,2,6,495,1,495,5,62,1627,441,262,5,3,648,3,6,4,13,39,538,792,337,9,115,98,180,148,308,401,1240,2,726,243,2044,5286450,84,19,32,115,11,70,5995534,2803414,3311,141,795,19735,1,1,346,1755,1004,41,342,1,189,14,1,10,8,1,5,4,2,1,3,2,2,1,3,1,3,1,4,3,1,3,2,2,23947076,511,21,11,4041599,1964,1007,2087,13579,3102,303,5595,11,3835,3637,2623,9,136,1524825',kBL:'p9Xv'};google.sn='webhp';google.kHL='es';})();(function(){
var f=this||self;var h,k=[];function l(a){for(var b;a&amp;&amp;(!a.getAttribute||!(b=a.getAttribute("eid")));)a=a.parentNode;return b||h}function m(a){for(var b=null;a&amp;&amp;(!a.getAttribute||!(b=a.getAttribute("leid")));)a=a.parentNode;return b}
function n(a,b,c,d,g){var e="";c||-1!==b.search("&amp;ei=")||(e="&amp;ei="+l(d),-1===b.search("&amp;lei=")&amp;&amp;(d=m(d))&amp;&amp;(e+="&amp;lei="+d));d="";!c&amp;&amp;f._cshid&amp;&amp;-1===b.search("&amp;cshid=")&amp;&amp;"slh"!==a&amp;&amp;(d="&amp;cshid="+f._cshid);c=c||"/"+(g||"gen_204")+"?atyp=i&amp;ct="+a+"&amp;cad="+b+e+"&amp;zx="+Date.now()+d;/^http:/i.test(c)&amp;&amp;"https:"===window.location.protocol&amp;&amp;(google.ml&amp;&amp;google.ml(Error("a"),!1,{src:c,glmm:1}),c="");return c};h=google.kEI;google.getEI=l;google.getLEI=m;google.ml=function(){return null};google.log=function(a,b,c,d,g){if(c=n(a,b,c,d,g)){a=new Image;var e=k.length;k[e]=a;a.onerror=a.onload=a.onabort=function(){delete k[e]};a.src=c}};google.logUrl=n;}).call(this);(function(){google.y={};google.sy=[];google.x=function(a,b){if(a)var c=a.id;else{do c=Math.random();while(google.y[c])}google.y[c]=[a,b];return!1};google.sx=function(a){google.sy.push(a)};google.lm=[];google.plm=function(a){google.lm.push.apply(google.lm,a)};google.lq=[];google.load=function(a,b,c){google.lq.push([[a],b,c])};google.loadAll=function(a,b){google.lq.push([a,b])};google.bx=!1;google.lx=function(){};}).call(this);google.f={};(function(){
document.documentElement.addEventListener("submit",function(b){var a;if(a=b.target){var c=a.getAttribute("data-submitfalse");a="1"===c||"q"===c&amp;&amp;!a.elements.q.value?!0:!1}else a=!1;a&amp;&amp;(b.preventDefault(),b.stopPropagation())},!0);document.documentElement.addEventListener("click",function(b){var a;a:{for(a=b.target;a&amp;&amp;a!==document.documentElement;a=a.parentElement)if("A"===a.tagName){a="1"===a.getAttribute("data-nohref");break a}a=!1}a&amp;&amp;b.preventDefault()},!0);}).call(this);&lt;/script&gt;&lt;style&gt;#gbar,#guser{font-size:13px;padding-top:1px !important;}#gbar{height:22px}#guser{padding-bottom:7px !important;text-align:right}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}@media all{.gb1{height:22px;margin-right:.5em;vertical-align:top}#gbar{float:left}}a.gb1,a.gb4{text-decoration:underline !important}a.gb1,a.gb4{color:#00c !important}.gbi .gb4{color:#dd8e27 !important}.gbf .gb4{color:#900 !important}
&lt;/style&gt;&lt;style&gt;body,td,a,p,.h{font-family:arial,sans-serif}body{margin:0;overflow-y:scroll}#gog{padding:3px 8px 0}td{line-height:.8em}.gac_m td{line-height:17px}form{margin-bottom:20px}.h{color:#1558d6}em{font-weight:bold;font-style:normal}.lst{height:25px;width:496px}.gsfi,.lst{font:18px arial,sans-serif}.gsfs{font:17px arial,sans-serif}.ds{display:inline-box;display:inline-block;margin:3px 0 4px;margin-left:4px}input{font-family:inherit}body{background:#fff;color:#000}a{color:#4b11a8;text-decoration:none}a:hover,a:active{text-decoration:underline}.fl a{color:#1558d6}a:visited{color:#4b11a8}.sblc{padding-top:5px}.sblc a{display:block;margin:2px 0;margin-left:13px;font-size:11px}.lsbb{background:#f8f9fa;border:solid 1px;border-color:#dadce0 #70757a #70757a #dadce0;height:30px}.lsbb{display:block}#WqQANb a{display:inline-block;margin:0 12px}.lsb{background:url(/images/nav_logo229.png) 0 -261px repeat-x;border:none;color:#000;cursor:pointer;height:30px;margin:0;outline:0;font:15px arial,sans-serif;vertical-align:top}.lsb:active{background:#dadce0}.lst:focus{outline:none}&lt;/style&gt;&lt;script nonce="zXcc4tMJWBRoE7q_o_Z2fQ"&gt;(function(){window.google.erd={jsr:1,bv:1698,de:true};
var h=this||self;var k,l=null!=(k=h.mei)?k:1,n,p=null!=(n=h.sdo)?n:!0,q=0,r,t=google.erd,v=t.jsr;google.ml=function(a,b,d,m,e){e=void 0===e?2:e;b&amp;&amp;(r=a&amp;&amp;a.message);if(google.dl)return google.dl(a,e,d),null;if(0&gt;v){window.console&amp;&amp;console.error(a,d);if(-2===v)throw a;b=!1}else b=!a||!a.message||"Error loading script"===a.message||q&gt;=l&amp;&amp;!m?!1:!0;if(!b)return null;q++;d=d||{};b=encodeURIComponent;var c="/gen_204?atyp=i&amp;ei="+b(google.kEI);google.kEXPI&amp;&amp;(c+="&amp;jexpid="+b(google.kEXPI));c+="&amp;srcpg="+b(google.sn)+"&amp;jsr="+b(t.jsr)+"&amp;bver="+b(t.bv);var f=a.lineNumber;void 0!==f&amp;&amp;(c+="&amp;line="+f);var g=
a.fileName;g&amp;&amp;(0&lt;g.indexOf("-extension:/")&amp;&amp;(e=3),c+="&amp;script="+b(g),f&amp;&amp;g===window.location.href&amp;&amp;(f=document.documentElement.outerHTML.split(" ")[f],c+="&amp;cad="+b(f?f.substring(0,300):"No script found.")));c+="&amp;jsel="+e;for(var u in d)c+="&amp;",c+=b(u),c+="=",c+=b(d[u]);c=c+"&amp;emsg="+b(a.name+": "+a.message);c=c+"&amp;jsst="+b(a.stack||"N/A");12288&lt;=c.length&amp;&amp;(c=c.substr(0,12288));a=c;m||google.log(0,"",a);return a};window.onerror=function(a,b,d,m,e){r!==a&amp;&amp;(a=e instanceof Error?e:Error(a),void 0===d||"lineNumber"in a||(a.lineNumber=d),void 0===b||"fileName"in a||(a.fileName=b),google.ml(a,!1,void 0,!1,"SyntaxError"===a.name||"SyntaxError"===a.message.substring(0,11)||-1!==a.message.indexOf("Script error")?3:0));r=null;p&amp;&amp;q&gt;=l&amp;&amp;(window.onerror=null)};})();&lt;/script&gt;&lt;/head&gt;&lt;body bgcolor="#fff"&gt;&lt;script nonce="zXcc4tMJWBRoE7q_o_Z2fQ"&gt;(function(){var src='/images/nav_logo229.png';var iesg=false;document.body.onload = function(){window.n &amp;&amp; window.n();if (document.images){new Image().src=src;}
if (!iesg){document.f&amp;&amp;document.f.q.focus();document.gbqf&amp;&amp;document.gbqf.q.focus();}
}
})();&lt;/script&gt;&lt;div id="mngb"&gt;&lt;div id=gbar&gt;&lt;nobr&gt;&lt;b class=gb1&gt;B�squeda&lt;/b&gt; &lt;a class=gb1 href="https://www.google.es/imghp?hl=es&amp;tab=wi"&gt;Im�genes&lt;/a&gt; &lt;a class=gb1 href="https://maps.google.es/maps?hl=es&amp;tab=wl"&gt;Maps&lt;/a&gt; &lt;a class=gb1 href="https://play.google.com/?hl=es&amp;tab=w8"&gt;Play&lt;/a&gt; &lt;a class=gb1 href="https://www.youtube.com/?tab=w1"&gt;YouTube&lt;/a&gt; &lt;a class=gb1 href="https://news.google.com/?tab=wn"&gt;Noticias&lt;/a&gt; &lt;a class=gb1 href="https://mail.google.com/mail/?tab=wm"&gt;Gmail&lt;/a&gt; &lt;a class=gb1 href="https://drive.google.com/?tab=wo"&gt;Drive&lt;/a&gt; &lt;a class=gb1 style="text-decoration:none" href="https://www.google.es/intl/es/about/products?tab=wh"&gt;&lt;u&gt;M�s&lt;/u&gt; &amp;raquo;&lt;/a&gt;&lt;/nobr&gt;&lt;/div&gt;&lt;div id=guser width=100%&gt;&lt;nobr&gt;&lt;span id=gbn class=gbi&gt;&lt;/span&gt;&lt;span id=gbf class=gbf&gt;&lt;/span&gt;&lt;span id=gbe&gt;&lt;/span&gt;&lt;a href="http://www.google.es/history/optout?hl=es" class=gb4&gt;Historial web&lt;/a&gt; | &lt;a href="/preferences?hl=es" class=gb4&gt;Ajustes&lt;/a&gt; | &lt;a target=_top id=gb_70 href="https://accounts.google.com/ServiceLogin?hl=es&amp;passive=true&amp;continue=https://www.google.com/&amp;ec=GAZAAQ" class=gb4&gt;Iniciar sesi�n&lt;/a&gt;&lt;/nobr&gt;&lt;/div&gt;&lt;div class=gbh style=left:0&gt;&lt;/div&gt;&lt;div class=gbh style=right:0&gt;&lt;/div&gt;&lt;/div&gt;&lt;center&gt;&lt;br clear="all" id="lgpd"&gt;&lt;div id="lga"&gt;&lt;img alt="Google" height="92" src="/images/branding/googlelogo/1x/googlelogo_white_background_color_272x92dp.png" style="padding:28px 0 14px" width="272" id="hplogo"&gt;&lt;br&gt;&lt;br&gt;&lt;/div&gt;&lt;form action="/search" name="f"&gt;&lt;table cellpadding="0" cellspacing="0"&gt;&lt;tr valign="top"&gt;&lt;td width="25%"&gt;&amp;nbsp;&lt;/td&gt;&lt;td align="center" nowrap=""&gt;&lt;input name="ie" value="ISO-8859-1" type="hidden"&gt;&lt;input value="es" name="hl" type="hidden"&gt;&lt;input name="source" type="hidden" value="hp"&gt;&lt;input name="biw" type="hidden"&gt;&lt;input name="bih" type="hidden"&gt;&lt;div class="ds" style="height:32px;margin:4px 0"&gt;&lt;input class="lst" style="margin:0;padding:5px 8px 0 6px;vertical-align:top;color:#000" autocomplete="off" value="" title="Buscar con Google" maxlength="2048" name="q" size="57"&gt;&lt;/div&gt;&lt;br style="line-height:0"&gt;&lt;span class="ds"&gt;&lt;span class="lsbb"&gt;&lt;input class="lsb" value="Buscar con Google" name="btnG" type="submit"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="ds"&gt;&lt;span class="lsbb"&gt;&lt;input class="lsb" id="tsuid_1" value="Voy a tener suerte" name="btnI" type="submit"&gt;&lt;script nonce="zXcc4tMJWBRoE7q_o_Z2fQ"&gt;(function(){var id='tsuid_1';document.getElementById(id).onclick = function(){if (this.form.q.value){this.checked = 1;if (this.form.iflsig)this.form.iflsig.disabled = false;}
else top.location='/doodles/';};})();&lt;/script&gt;&lt;input value="AJiK0e8AAAAAY46fQwdyVrbrgW6gkEtVkGfp2nyO0ZXL" name="iflsig" type="hidden"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;td class="fl sblc" align="left" nowrap="" width="25%"&gt;&lt;a href="/advanced_search?hl=es&amp;amp;authuser=0"&gt;B�squeda avanzada&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;input id="gbv" name="gbv" type="hidden" value="1"&gt;&lt;script nonce="zXcc4tMJWBRoE7q_o_Z2fQ"&gt;(function(){var a,b="1";if(document&amp;&amp;document.getElementById)if("undefined"!=typeof XMLHttpRequest)b="2";else if("undefined"!=typeof ActiveXObject){var c,d,e=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];for(c=0;d=e[c++];)try{new ActiveXObject(d),b="2"}catch(h){}}a=b;if("2"==a&amp;&amp;-1==location.search.indexOf("&amp;gbv=2")){var f=google.gbvu,g=document.getElementById("gbv");g&amp;&amp;(g.value=a);f&amp;&amp;window.setTimeout(function(){location.href=f},0)};}).call(this);&lt;/script&gt;&lt;/form&gt;&lt;div id="gac_scont"&gt;&lt;/div&gt;&lt;div style="font-size:83%;min-height:3.5em"&gt;&lt;br&gt;&lt;div id="gws-output-pages-elements-homepage_additional_languages__als"&gt;&lt;style&gt;#gws-output-pages-elements-homepage_additional_languages__als{font-size:small;margin-bottom:24px}#SIvCob{color:#3c4043;display:inline-block;line-height:28px;}#SIvCob a{padding:0 3px;}.H6sW5{display:inline-block;margin:0 2px;white-space:nowrap}.z4hgWe{display:inline-block;margin:0 2px}&lt;/style&gt;&lt;div id="SIvCob"&gt;Ofrecido por Google en: &lt;a href="https://www.google.com/setprefs?sig=0_vwUKUD2Xhro4NnrueK1hCfItt30%3D&amp;amp;hl=ca&amp;amp;source=homepage&amp;amp;sa=X&amp;amp;ved=0ahUKEwjjw_C44uP7AhW_UaQEHVbMChoQ2ZgBCAU"&gt;catal�&lt;/a&gt; &lt;a href="https://www.google.com/setprefs?sig=0_vwUKUD2Xhro4NnrueK1hCfItt30%3D&amp;amp;hl=gl&amp;amp;source=homepage&amp;amp;sa=X&amp;amp;ved=0ahUKEwjjw_C44uP7AhW_UaQEHVbMChoQ2ZgBCAY"&gt;galego&lt;/a&gt; &lt;a href="https://www.google.com/setprefs?sig=0_vwUKUD2Xhro4NnrueK1hCfItt30%3D&amp;amp;hl=eu&amp;amp;source=homepage&amp;amp;sa=X&amp;amp;ved=0ahUKEwjjw_C44uP7AhW_UaQEHVbMChoQ2ZgBCAc"&gt;euskara&lt;/a&gt; &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;span id="footer"&gt;&lt;div style="font-size:10pt"&gt;&lt;div style="margin:19px auto;text-align:center" id="WqQANb"&gt;&lt;a href="http://www.google.es/intl/es/services/"&gt;Soluciones Empresariales&lt;/a&gt;&lt;a href="/intl/es/about.html"&gt;Todo acerca de Google&lt;/a&gt;&lt;a href="https://www.google.com/setprefdomain?prefdom=ES&amp;amp;prev=https://www.google.es/&amp;amp;sig=K_a2UXepORMQOw5-SHU8h4noB_VWk%3D"&gt;Google.es&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;p style="font-size:8pt;color:#70757a"&gt;&amp;copy; 2022 - &lt;a href="/intl/es/policies/privacy/"&gt;Privacidad&lt;/a&gt; - &lt;a href="/intl/es/policies/terms/"&gt;T�rminos&lt;/a&gt;&lt;/p&gt;&lt;/span&gt;&lt;/center&gt;&lt;script nonce="zXcc4tMJWBRoE7q_o_Z2fQ"&gt;(function(){window.google.cdo={height:757,width:1440};(function(){var a=window.innerWidth,b=window.innerHeight;if(!a||!b){var c=window.document,d="CSS1Compat"==c.compatMode?c.documentElement:c.body;a=d.clientWidth;b=d.clientHeight}a&amp;&amp;b&amp;&amp;(a!=google.cdo.width||b!=google.cdo.height)&amp;&amp;google.log("","","/client_204?&amp;atyp=i&amp;biw="+a+"&amp;bih="+b+"&amp;ei="+google.kEI);}).call(this);})();&lt;/script&gt; &lt;script nonce="zXcc4tMJWBRoE7q_o_Z2fQ"&gt;(function(){google.xjs={ck:'xjs.hp.oxai9SxkIQY.L.X.O',cs:'ACT90oEGh-_ImDfBjn6aD_ABGaOlD2MqVw',excm:[]};})();&lt;/script&gt; &lt;script nonce="zXcc4tMJWBRoE7q_o_Z2fQ"&gt;(function(){var u='/xjs/_/js/k=xjs.hp.en.9b-uVUIpJU8.O/am=AADoBABQAGAB/d=1/ed=1/rs=ACT90oG-6KYVksw4jxVvNcwan406xE6qVw/m=sb_he,d';var amd=0;
var d=this||self,e=function(a){return a};var g;var l=function(a,b){this.g=b===h?a:""};l.prototype.toString=function(){return this.g+""};var h={};
function m(){var a=u;google.lx=function(){p(a);google.lx=function(){}};google.bx||google.lx()}
function p(a){google.timers&amp;&amp;google.timers.load&amp;&amp;google.tick&amp;&amp;google.tick("load","xjsls");var b=document;var c="SCRIPT";"application/xhtml+xml"===b.contentType&amp;&amp;(c=c.toLowerCase());c=b.createElement(c);if(void 0===g){b=null;var k=d.trustedTypes;if(k&amp;&amp;k.createPolicy){try{b=k.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(q){d.console&amp;&amp;d.console.error(q.message)}g=b}else g=b}a=(b=g)?b.createScriptURL(a):a;a=new l(a,h);c.src=a instanceof l&amp;&amp;a.constructor===l?a.g:"type_error:TrustedResourceUrl";var f,n;(f=(a=null==(n=(f=(c.ownerDocument&amp;&amp;c.ownerDocument.defaultView||window).document).querySelector)?void 0:n.call(f,"script[nonce]"))?a.nonce||a.getAttribute("nonce")||"":"")&amp;&amp;c.setAttribute("nonce",f);document.body.appendChild(c);google.psa=!0};google.xjsu=u;setTimeout(function(){0&lt;amd?google.caft(function(){return m()},amd):m()},0);})();function _DumpException(e){throw e;}
function _F_installCss(c){}
(function(){google.jl={blt:'none',chnk:0,dw:false,dwu:true,emtn:0,end:0,ico:false,ikb:0,ine:false,injs:'none',injt:0,injth:0,injv2:false,lls:'default',pdt:0,rep:0,snet:true,strt:0,ubm:false,uwp:true};})();(function(){var pmc='{"d":{},"sb_he":{"agen":true,"cgen":true,"client":"heirloom-hp","dh":true,"ds":"","fl":true,"host":"google.com","jsonp":true,"lm":true,"msgs":{"cibl":"Borrar b�squeda","dym":"Quiz�s quisiste decir:","lcky":"Voy a tener suerte","lml":"M�s informaci�n","psrc":"Esta b�squeda se ha eliminado de tu \u003Ca href=\"/history\"\u003Ehistorial web\u003C/a\u003E.","psrl":"Eliminar","sbit":"Buscar por imagen","srch":"Buscar con Google"},"ovr":{},"pq":"","rfs":[],"sbas":"0 3px 8px 0 rgba(0,0,0,0.2),0 0 0 1px rgba(0,0,0,0.08)","stok":"gh8wSanWNWQy8f-PH0wGTjDkvYQ"}}';google.pmc=JSON.parse(pmc);})();&lt;/script&gt; &lt;/body&gt;&lt;/html&gt;

Também podemos fazer um pipeline para salvá-lo em um arquivo

	
< > Input
Python
!curl https://www.google.com &gt; google.html
Copied
>_ Output
			
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 15168 0 15168 0 0 135k 0 --:--:-- --:--:-- --:--:-- 137k

Agora podemos ver se foi salvo corretamente

	
< > Input
Python
!cat google.html
Copied
>_ Output
			
&lt;!doctype html&gt;&lt;html itemscope="" itemtype="http://schema.org/WebPage" lang="es"&gt;&lt;head&gt;&lt;meta content="Google.es permite acceder a la informaci�n mundial en castellano, catal�n, gallego, euskara e ingl�s." name="description"&gt;&lt;meta content="noodp" name="robots"&gt;&lt;meta content="text/html; charset=UTF-8" http-equiv="Content-Type"&gt;&lt;meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"&gt;&lt;title&gt;Google&lt;/title&gt;&lt;script nonce="Jo7WFU6XWWwu6NrdwaRyIw"&gt;(function(){window.google={kEI:'R5GOY-LZHLegkdUP_IqzoAE',kEXPI:'0,1359409,6059,206,4804,2316,383,246,5,5367,1123753,1197777,380713,16115,28684,22430,1362,283,12036,17580,4998,13228,516,3331,10622,22741,5081,1593,1279,2742,149,1103,840,1983,4,210,4100,3514,606,2023,2299,14668,3229,2843,7,4773,826,23475,4696,1851,15756,3,346,230,6459,149,13975,4,1528,2304,7039,20309,7422,7357,13658,4437,16786,5812,2545,4094,4052,3,3541,1,11943,30211,2,8984,1,5037,6249,19490,5679,1020,2378,28745,4568,6258,23418,1252,5835,14967,4333,4239,3245,27082,239,7916,7381,15969,874,19633,6,1923,5784,3995,21779,1120,8423,4832,26080,423,107,5690,3,14433,3890,751,14879,3,683,217,1405,1779,1854,31,1966,1119,6,8909,323,5659,1741,814,1224,10,280,2346,82,1419,3,565,401,519,68,970,1125,440,398,156,367,1034,333,3392,526,396,3,1431,3,785,2,312,2312,196,907,342,244,618,314,1,293,568,171,1104,14,89,891,56,857,306,14,509,154,246,1110,219,628,249,229,49,8,8,3,55,4,399,55,39,1072,49,43,2,468,782,83,123,641,1502,166,350,707,195,5,140,358,329,692,109,1,20,108,134,547,67,5,49,93,31,77,124,79,355,160,27,829,236,764,12,35,118,98,803,1,65,436,5,5,54,2065,262,5,3,647,3,8,2,14,39,65,380,80,14,790,346,115,99,1323,4,711,242,2,723,2286,5280608,12,5934,147,81,8798948,3311,141,795,19735,1,1,346,1755,1004,41,342,1,189,14,9,4,6,3,3,4,1,2,2,3,2,2,2,1,2,5,2,2,1,2,2,2,23947077,512,18,13,2737921,1303678,1964,3094,13579,3405,5595,11,3835,1923,3208,1069,1480676,40778',kBL:'p9Xv'};google.sn='webhp';google.kHL='es';})();(function(){
var f=this||self;var h,k=[];function l(a){for(var b;a&amp;&amp;(!a.getAttribute||!(b=a.getAttribute("eid")));)a=a.parentNode;return b||h}function m(a){for(var b=null;a&amp;&amp;(!a.getAttribute||!(b=a.getAttribute("leid")));)a=a.parentNode;return b}
function n(a,b,c,d,g){var e="";c||-1!==b.search("&amp;ei=")||(e="&amp;ei="+l(d),-1===b.search("&amp;lei=")&amp;&amp;(d=m(d))&amp;&amp;(e+="&amp;lei="+d));d="";!c&amp;&amp;f._cshid&amp;&amp;-1===b.search("&amp;cshid=")&amp;&amp;"slh"!==a&amp;&amp;(d="&amp;cshid="+f._cshid);c=c||"/"+(g||"gen_204")+"?atyp=i&amp;ct="+a+"&amp;cad="+b+e+"&amp;zx="+Date.now()+d;/^http:/i.test(c)&amp;&amp;"https:"===window.location.protocol&amp;&amp;(google.ml&amp;&amp;google.ml(Error("a"),!1,{src:c,glmm:1}),c="");return c};h=google.kEI;google.getEI=l;google.getLEI=m;google.ml=function(){return null};google.log=function(a,b,c,d,g){if(c=n(a,b,c,d,g)){a=new Image;var e=k.length;k[e]=a;a.onerror=a.onload=a.onabort=function(){delete k[e]};a.src=c}};google.logUrl=n;}).call(this);(function(){google.y={};google.sy=[];google.x=function(a,b){if(a)var c=a.id;else{do c=Math.random();while(google.y[c])}google.y[c]=[a,b];return!1};google.sx=function(a){google.sy.push(a)};google.lm=[];google.plm=function(a){google.lm.push.apply(google.lm,a)};google.lq=[];google.load=function(a,b,c){google.lq.push([[a],b,c])};google.loadAll=function(a,b){google.lq.push([a,b])};google.bx=!1;google.lx=function(){};}).call(this);google.f={};(function(){
document.documentElement.addEventListener("submit",function(b){var a;if(a=b.target){var c=a.getAttribute("data-submitfalse");a="1"===c||"q"===c&amp;&amp;!a.elements.q.value?!0:!1}else a=!1;a&amp;&amp;(b.preventDefault(),b.stopPropagation())},!0);document.documentElement.addEventListener("click",function(b){var a;a:{for(a=b.target;a&amp;&amp;a!==document.documentElement;a=a.parentElement)if("A"===a.tagName){a="1"===a.getAttribute("data-nohref");break a}a=!1}a&amp;&amp;b.preventDefault()},!0);}).call(this);&lt;/script&gt;&lt;style&gt;#gbar,#guser{font-size:13px;padding-top:1px !important;}#gbar{height:22px}#guser{padding-bottom:7px !important;text-align:right}.gbh,.gbd{border-top:1px solid #c9d7f1;font-size:1px}.gbh{height:0;position:absolute;top:24px;width:100%}@media all{.gb1{height:22px;margin-right:.5em;vertical-align:top}#gbar{float:left}}a.gb1,a.gb4{text-decoration:underline !important}a.gb1,a.gb4{color:#00c !important}.gbi .gb4{color:#dd8e27 !important}.gbf .gb4{color:#900 !important}
&lt;/style&gt;&lt;style&gt;body,td,a,p,.h{font-family:arial,sans-serif}body{margin:0;overflow-y:scroll}#gog{padding:3px 8px 0}td{line-height:.8em}.gac_m td{line-height:17px}form{margin-bottom:20px}.h{color:#1558d6}em{font-weight:bold;font-style:normal}.lst{height:25px;width:496px}.gsfi,.lst{font:18px arial,sans-serif}.gsfs{font:17px arial,sans-serif}.ds{display:inline-box;display:inline-block;margin:3px 0 4px;margin-left:4px}input{font-family:inherit}body{background:#fff;color:#000}a{color:#4b11a8;text-decoration:none}a:hover,a:active{text-decoration:underline}.fl a{color:#1558d6}a:visited{color:#4b11a8}.sblc{padding-top:5px}.sblc a{display:block;margin:2px 0;margin-left:13px;font-size:11px}.lsbb{background:#f8f9fa;border:solid 1px;border-color:#dadce0 #70757a #70757a #dadce0;height:30px}.lsbb{display:block}#WqQANb a{display:inline-block;margin:0 12px}.lsb{background:url(/images/nav_logo229.png) 0 -261px repeat-x;border:none;color:#000;cursor:pointer;height:30px;margin:0;outline:0;font:15px arial,sans-serif;vertical-align:top}.lsb:active{background:#dadce0}.lst:focus{outline:none}&lt;/style&gt;&lt;script nonce="Jo7WFU6XWWwu6NrdwaRyIw"&gt;(function(){window.google.erd={jsr:1,bv:1698,de:true};
var h=this||self;var k,l=null!=(k=h.mei)?k:1,n,p=null!=(n=h.sdo)?n:!0,q=0,r,t=google.erd,v=t.jsr;google.ml=function(a,b,d,m,e){e=void 0===e?2:e;b&amp;&amp;(r=a&amp;&amp;a.message);if(google.dl)return google.dl(a,e,d),null;if(0&gt;v){window.console&amp;&amp;console.error(a,d);if(-2===v)throw a;b=!1}else b=!a||!a.message||"Error loading script"===a.message||q&gt;=l&amp;&amp;!m?!1:!0;if(!b)return null;q++;d=d||{};b=encodeURIComponent;var c="/gen_204?atyp=i&amp;ei="+b(google.kEI);google.kEXPI&amp;&amp;(c+="&amp;jexpid="+b(google.kEXPI));c+="&amp;srcpg="+b(google.sn)+"&amp;jsr="+b(t.jsr)+"&amp;bver="+b(t.bv);var f=a.lineNumber;void 0!==f&amp;&amp;(c+="&amp;line="+f);var g=
a.fileName;g&amp;&amp;(0&lt;g.indexOf("-extension:/")&amp;&amp;(e=3),c+="&amp;script="+b(g),f&amp;&amp;g===window.location.href&amp;&amp;(f=document.documentElement.outerHTML.split(" ")[f],c+="&amp;cad="+b(f?f.substring(0,300):"No script found.")));c+="&amp;jsel="+e;for(var u in d)c+="&amp;",c+=b(u),c+="=",c+=b(d[u]);c=c+"&amp;emsg="+b(a.name+": "+a.message);c=c+"&amp;jsst="+b(a.stack||"N/A");12288&lt;=c.length&amp;&amp;(c=c.substr(0,12288));a=c;m||google.log(0,"",a);return a};window.onerror=function(a,b,d,m,e){r!==a&amp;&amp;(a=e instanceof Error?e:Error(a),void 0===d||"lineNumber"in a||(a.lineNumber=d),void 0===b||"fileName"in a||(a.fileName=b),google.ml(a,!1,void 0,!1,"SyntaxError"===a.name||"SyntaxError"===a.message.substring(0,11)||-1!==a.message.indexOf("Script error")?3:0));r=null;p&amp;&amp;q&gt;=l&amp;&amp;(window.onerror=null)};})();&lt;/script&gt;&lt;/head&gt;&lt;body bgcolor="#fff"&gt;&lt;script nonce="Jo7WFU6XWWwu6NrdwaRyIw"&gt;(function(){var src='/images/nav_logo229.png';var iesg=false;document.body.onload = function(){window.n &amp;&amp; window.n();if (document.images){new Image().src=src;}
if (!iesg){document.f&amp;&amp;document.f.q.focus();document.gbqf&amp;&amp;document.gbqf.q.focus();}
}
})();&lt;/script&gt;&lt;div id="mngb"&gt;&lt;div id=gbar&gt;&lt;nobr&gt;&lt;b class=gb1&gt;B�squeda&lt;/b&gt; &lt;a class=gb1 href="https://www.google.es/imghp?hl=es&amp;tab=wi"&gt;Im�genes&lt;/a&gt; &lt;a class=gb1 href="https://maps.google.es/maps?hl=es&amp;tab=wl"&gt;Maps&lt;/a&gt; &lt;a class=gb1 href="https://play.google.com/?hl=es&amp;tab=w8"&gt;Play&lt;/a&gt; &lt;a class=gb1 href="https://www.youtube.com/?tab=w1"&gt;YouTube&lt;/a&gt; &lt;a class=gb1 href="https://news.google.com/?tab=wn"&gt;Noticias&lt;/a&gt; &lt;a class=gb1 href="https://mail.google.com/mail/?tab=wm"&gt;Gmail&lt;/a&gt; &lt;a class=gb1 href="https://drive.google.com/?tab=wo"&gt;Drive&lt;/a&gt; &lt;a class=gb1 style="text-decoration:none" href="https://www.google.es/intl/es/about/products?tab=wh"&gt;&lt;u&gt;M�s&lt;/u&gt; &amp;raquo;&lt;/a&gt;&lt;/nobr&gt;&lt;/div&gt;&lt;div id=guser width=100%&gt;&lt;nobr&gt;&lt;span id=gbn class=gbi&gt;&lt;/span&gt;&lt;span id=gbf class=gbf&gt;&lt;/span&gt;&lt;span id=gbe&gt;&lt;/span&gt;&lt;a href="http://www.google.es/history/optout?hl=es" class=gb4&gt;Historial web&lt;/a&gt; | &lt;a href="/preferences?hl=es" class=gb4&gt;Ajustes&lt;/a&gt; | &lt;a target=_top id=gb_70 href="https://accounts.google.com/ServiceLogin?hl=es&amp;passive=true&amp;continue=https://www.google.com/&amp;ec=GAZAAQ" class=gb4&gt;Iniciar sesi�n&lt;/a&gt;&lt;/nobr&gt;&lt;/div&gt;&lt;div class=gbh style=left:0&gt;&lt;/div&gt;&lt;div class=gbh style=right:0&gt;&lt;/div&gt;&lt;/div&gt;&lt;center&gt;&lt;br clear="all" id="lgpd"&gt;&lt;div id="lga"&gt;&lt;img alt="Google" height="92" src="/images/branding/googlelogo/1x/googlelogo_white_background_color_272x92dp.png" style="padding:28px 0 14px" width="272" id="hplogo"&gt;&lt;br&gt;&lt;br&gt;&lt;/div&gt;&lt;form action="/search" name="f"&gt;&lt;table cellpadding="0" cellspacing="0"&gt;&lt;tr valign="top"&gt;&lt;td width="25%"&gt;&amp;nbsp;&lt;/td&gt;&lt;td align="center" nowrap=""&gt;&lt;input name="ie" value="ISO-8859-1" type="hidden"&gt;&lt;input value="es" name="hl" type="hidden"&gt;&lt;input name="source" type="hidden" value="hp"&gt;&lt;input name="biw" type="hidden"&gt;&lt;input name="bih" type="hidden"&gt;&lt;div class="ds" style="height:32px;margin:4px 0"&gt;&lt;input class="lst" style="margin:0;padding:5px 8px 0 6px;vertical-align:top;color:#000" autocomplete="off" value="" title="Buscar con Google" maxlength="2048" name="q" size="57"&gt;&lt;/div&gt;&lt;br style="line-height:0"&gt;&lt;span class="ds"&gt;&lt;span class="lsbb"&gt;&lt;input class="lsb" value="Buscar con Google" name="btnG" type="submit"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="ds"&gt;&lt;span class="lsbb"&gt;&lt;input class="lsb" id="tsuid_1" value="Voy a tener suerte" name="btnI" type="submit"&gt;&lt;script nonce="Jo7WFU6XWWwu6NrdwaRyIw"&gt;(function(){var id='tsuid_1';document.getElementById(id).onclick = function(){if (this.form.q.value){this.checked = 1;if (this.form.iflsig)this.form.iflsig.disabled = false;}
else top.location='/doodles/';};})();&lt;/script&gt;&lt;input value="AJiK0e8AAAAAY46fV7gpXBHCT6KAebFZAqGv1l-4BtIR" name="iflsig" type="hidden"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;&lt;td class="fl sblc" align="left" nowrap="" width="25%"&gt;&lt;a href="/advanced_search?hl=es&amp;amp;authuser=0"&gt;B�squeda avanzada&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;input id="gbv" name="gbv" type="hidden" value="1"&gt;&lt;script nonce="Jo7WFU6XWWwu6NrdwaRyIw"&gt;(function(){var a,b="1";if(document&amp;&amp;document.getElementById)if("undefined"!=typeof XMLHttpRequest)b="2";else if("undefined"!=typeof ActiveXObject){var c,d,e=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];for(c=0;d=e[c++];)try{new ActiveXObject(d),b="2"}catch(h){}}a=b;if("2"==a&amp;&amp;-1==location.search.indexOf("&amp;gbv=2")){var f=google.gbvu,g=document.getElementById("gbv");g&amp;&amp;(g.value=a);f&amp;&amp;window.setTimeout(function(){location.href=f},0)};}).call(this);&lt;/script&gt;&lt;/form&gt;&lt;div id="gac_scont"&gt;&lt;/div&gt;&lt;div style="font-size:83%;min-height:3.5em"&gt;&lt;br&gt;&lt;div id="gws-output-pages-elements-homepage_additional_languages__als"&gt;&lt;style&gt;#gws-output-pages-elements-homepage_additional_languages__als{font-size:small;margin-bottom:24px}#SIvCob{color:#3c4043;display:inline-block;line-height:28px;}#SIvCob a{padding:0 3px;}.H6sW5{display:inline-block;margin:0 2px;white-space:nowrap}.z4hgWe{display:inline-block;margin:0 2px}&lt;/style&gt;&lt;div id="SIvCob"&gt;Ofrecido por Google en: &lt;a href="https://www.google.com/setprefs?sig=0_HljXEzVisqsnlJP1S5dx0Fao0Lw%3D&amp;amp;hl=ca&amp;amp;source=homepage&amp;amp;sa=X&amp;amp;ved=0ahUKEwiimaPC4uP7AhU3UKQEHXzFDBQQ2ZgBCAU"&gt;catal�&lt;/a&gt; &lt;a href="https://www.google.com/setprefs?sig=0_HljXEzVisqsnlJP1S5dx0Fao0Lw%3D&amp;amp;hl=gl&amp;amp;source=homepage&amp;amp;sa=X&amp;amp;ved=0ahUKEwiimaPC4uP7AhU3UKQEHXzFDBQQ2ZgBCAY"&gt;galego&lt;/a&gt; &lt;a href="https://www.google.com/setprefs?sig=0_HljXEzVisqsnlJP1S5dx0Fao0Lw%3D&amp;amp;hl=eu&amp;amp;source=homepage&amp;amp;sa=X&amp;amp;ved=0ahUKEwiimaPC4uP7AhU3UKQEHXzFDBQQ2ZgBCAc"&gt;euskara&lt;/a&gt; &lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;span id="footer"&gt;&lt;div style="font-size:10pt"&gt;&lt;div style="margin:19px auto;text-align:center" id="WqQANb"&gt;&lt;a href="http://www.google.es/intl/es/services/"&gt;Soluciones Empresariales&lt;/a&gt;&lt;a href="/intl/es/about.html"&gt;Todo acerca de Google&lt;/a&gt;&lt;a href="https://www.google.com/setprefdomain?prefdom=ES&amp;amp;prev=https://www.google.es/&amp;amp;sig=K_8O8QHBmoai9DOT5YZxMWevJK8VI%3D"&gt;Google.es&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;p style="font-size:8pt;color:#70757a"&gt;&amp;copy; 2022 - &lt;a href="/intl/es/policies/privacy/"&gt;Privacidad&lt;/a&gt; - &lt;a href="/intl/es/policies/terms/"&gt;T�rminos&lt;/a&gt;&lt;/p&gt;&lt;/span&gt;&lt;/center&gt;&lt;script nonce="Jo7WFU6XWWwu6NrdwaRyIw"&gt;(function(){window.google.cdo={height:757,width:1440};(function(){var a=window.innerWidth,b=window.innerHeight;if(!a||!b){var c=window.document,d="CSS1Compat"==c.compatMode?c.documentElement:c.body;a=d.clientWidth;b=d.clientHeight}a&amp;&amp;b&amp;&amp;(a!=google.cdo.width||b!=google.cdo.height)&amp;&amp;google.log("","","/client_204?&amp;atyp=i&amp;biw="+a+"&amp;bih="+b+"&amp;ei="+google.kEI);}).call(this);})();&lt;/script&gt; &lt;script nonce="Jo7WFU6XWWwu6NrdwaRyIw"&gt;(function(){google.xjs={ck:'xjs.hp.oxai9SxkIQY.L.X.O',cs:'ACT90oEGh-_ImDfBjn6aD_ABGaOlD2MqVw',excm:[]};})();&lt;/script&gt; &lt;script nonce="Jo7WFU6XWWwu6NrdwaRyIw"&gt;(function(){var u='/xjs/_/js/k=xjs.hp.en.9b-uVUIpJU8.O/am=AADoBABQAGAB/d=1/ed=1/rs=ACT90oG-6KYVksw4jxVvNcwan406xE6qVw/m=sb_he,d';var amd=0;
var d=this||self,e=function(a){return a};var g;var l=function(a,b){this.g=b===h?a:""};l.prototype.toString=function(){return this.g+""};var h={};
function m(){var a=u;google.lx=function(){p(a);google.lx=function(){}};google.bx||google.lx()}
function p(a){google.timers&amp;&amp;google.timers.load&amp;&amp;google.tick&amp;&amp;google.tick("load","xjsls");var b=document;var c="SCRIPT";"application/xhtml+xml"===b.contentType&amp;&amp;(c=c.toLowerCase());c=b.createElement(c);if(void 0===g){b=null;var k=d.trustedTypes;if(k&amp;&amp;k.createPolicy){try{b=k.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(q){d.console&amp;&amp;d.console.error(q.message)}g=b}else g=b}a=(b=g)?b.createScriptURL(a):a;a=new l(a,h);c.src=a instanceof l&amp;&amp;a.constructor===l?a.g:"type_error:TrustedResourceUrl";var f,n;(f=(a=null==(n=(f=(c.ownerDocument&amp;&amp;c.ownerDocument.defaultView||window).document).querySelector)?void 0:n.call(f,"script[nonce]"))?a.nonce||a.getAttribute("nonce")||"":"")&amp;&amp;c.setAttribute("nonce",f);document.body.appendChild(c);google.psa=!0};google.xjsu=u;setTimeout(function(){0&lt;amd?google.caft(function(){return m()},amd):m()},0);})();function _DumpException(e){throw e;}
function _F_installCss(c){}
(function(){google.jl={blt:'none',chnk:0,dw:false,dwu:true,emtn:0,end:0,ico:false,ikb:0,ine:false,injs:'none',injt:0,injth:0,injv2:false,lls:'default',pdt:0,rep:0,snet:true,strt:0,ubm:false,uwp:true};})();(function(){var pmc='{"d":{},"sb_he":{"agen":true,"cgen":true,"client":"heirloom-hp","dh":true,"ds":"","fl":true,"host":"google.com","jsonp":true,"lm":true,"msgs":{"cibl":"Borrar b�squeda","dym":"Quiz�s quisiste decir:","lcky":"Voy a tener suerte","lml":"M�s informaci�n","psrc":"Esta b�squeda se ha eliminado de tu \u003Ca href=\"/history\"\u003Ehistorial web\u003C/a\u003E.","psrl":"Eliminar","sbit":"Buscar por imagen","srch":"Buscar con Google"},"ovr":{},"pq":"","rfs":[],"sbas":"0 3px 8px 0 rgba(0,0,0,0.2),0 0 0 1px rgba(0,0,0,0.08)","stok":"GYSMF2y7hymT0L3W0W4RPVIsSrU"}}';google.pmc=JSON.parse(pmc);})();&lt;/script&gt; &lt;/body&gt;&lt;/html&gt;

Baixar arquivos com wgetlink image 66

Outro comando parecido é wget, no entanto, ao contrário de curl, wget baixa o arquivo diretamente

	
< > Input
Python
!wget https://www.google.com
Copied
>_ Output
			
--2022-12-06 01:49:19-- https://www.google.com/
Resolviendo www.google.com (www.google.com)... 142.250.200.68, 2a00:1450:4003:80c::2004
Conectando con www.google.com (www.google.com)[142.250.200.68]:443... conectado.
Petición HTTP enviada, esperando respuesta... 200 OK
Longitud: no especificado [text/html]
Guardando como: “index.html.1”
index.html.1 [ &lt;=&gt; ] 14,76K --.-KB/s en 0,002s
2022-12-06 01:49:19 (7,17 MB/s) - “index.html.1” guardado [15117]
	
< > Input
Python
!ls -l
Copied
>_ Output
			
total 316
-rw-rw-r-- 1 wallabot wallabot 285898 dic 6 00:28 2021-02-11-Introduccion-a-Python.ipynb
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 Abc
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos1
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos123
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot2.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 file.txt
-rw-rw-r-- 1 wallabot wallabot 15168 dic 6 01:48 google.html
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 index.html
-rw-rw-r-- 1 wallabot wallabot 15117 dic 6 01:49 index.html.1
-rw-rw-r-- 1 wallabot wallabot 182 dic 6 01:06 lista.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 01:08 secuential.txt

Vemos que ele o salvou como index.html, que é como o Google o tem nomeado

Se quisermos que seja salvo com um nome específico, podemos usar a flag -O

	
< > Input
Python
!wget https://www.google.com -O google2.html
Copied
>_ Output
			
--2022-12-06 01:49:37-- https://www.google.com/
Resolviendo www.google.com (www.google.com)... 142.250.200.68, 2a00:1450:4003:80c::2004
Conectando con www.google.com (www.google.com)[142.250.200.68]:443... conectado.
Petición HTTP enviada, esperando respuesta... 200 OK
Longitud: no especificado [text/html]
Guardando como: “google2.html”
google2.html [ &lt;=&gt; ] 14,78K --.-KB/s en 0,003s
2022-12-06 01:49:37 (5,27 MB/s) - “google2.html” guardado [15131]
	
< > Input
Python
!ls -l
Copied
>_ Output
			
total 332
-rw-rw-r-- 1 wallabot wallabot 285898 dic 6 00:28 2021-02-11-Introduccion-a-Python.ipynb
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 Abc
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos1
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos123
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot2.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 file.txt
-rw-rw-r-- 1 wallabot wallabot 15131 dic 6 01:49 google2.html
-rw-rw-r-- 1 wallabot wallabot 15168 dic 6 01:48 google.html
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 index.html
-rw-rw-r-- 1 wallabot wallabot 15117 dic 6 01:49 index.html.1
-rw-rw-r-- 1 wallabot wallabot 182 dic 6 01:06 lista.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 01:08 secuential.txt

Depuração da rota com traceroutelink image 67

Um comando muito útil é ver a rota até um destino, para isso usamos traceroute, por exemplo, vamos ver todos os sites pelos quais tenho que passar para me conectar ao Google

	
< > Input
Python
!traceroute www.google.com
Copied
>_ Output
			
traceroute to www.google.com (142.250.200.68), 64 hops max
1 192.168.1.1 0,435ms 0,154ms 0,133ms
2 188.127.176.1 3,979ms 2,914ms 3,397ms
3 10.15.0.77 3,600ms 3,914ms 2,669ms
4 10.15.246.6 3,567ms 3,713ms 2,926ms
5 * * *
6 72.14.209.84 3,981ms 2,914ms 2,993ms
7 * * *
8 142.251.54.148 3,856ms 2,916ms 2,905ms
9 142.250.200.68 2,908ms 2,949ms 3,037ms

Depuração da rota com mtrlink image 68

Outra ferramenta de depuração é mtr, que é uma versão aprimorada de traceroute. Oferece informações de cada salto, como o tempo de resposta, a porcentagem de pacotes perdidos, etc.

	
< > Input
Python
!mtr -n maximofn.com
Copied
>_ Output
			
wallabot (192.168.178.144)
Keys: Help Display mode Restart statistics Order of fields quit
Packets Pings
Host Loss% Snt Last Avg Best Wrst StDev
1. 192.168.178.1 0.0% 345 0.3 0.3 0.3 0.3 0.0
2. 192.168.0.1 0.0% 344 0.8 1.1 1.1 1.1 0.0
3. (waiting for reply)
4. 10.183.52.41 0.0% 344 2.8 2.5 2.5 2.5 0.0
5. 172.29.0.161 47.7% 344 2.3 3.1 3.1 23.1 0.0
6. (waiting for reply)
7. 193.149.1.97 0.0% 344 3.6 3.6 3.6 38.6 0.0
8. (waiting for reply)
9. 185.125.78.197 2.9% 344 6.9 6.9 6.9 6.9 0.0

Como se pode ver no salto 5, quase 50% dos pacotes são perdidos, então isso me serviria para ligar para minha operadora de telefonia e dizer que tente me encaminhar por outro caminho.

Nome da nossa máquina com hostnamelink image 69

Se quisermos saber o nome da nossa equipe, podemos usar hostname, o que é útil se quisermos nos conectar à nossa máquina a partir de outra.

	
< > Input
Python
!hostname
Copied
>_ Output
			
wallabot

Informação de enlace de porta padrão com route -nlink image 70

Se quisermos conhecer nosso gateway padrão, usamos o comando route -n

	
< > Input
Python
!route -n
Copied
>_ Output
			
Tabla de rutas IP del núcleo
Destino Pasarela Genmask Indic Métric Ref Uso Interfaz
0.0.0.0 192.168.1.1 0.0.0.0 UG 100 0 0 enp6s0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 enp6s0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 br-470e52ae2708
192.168.1.0 0.0.0.0 255.255.255.0 U 100 0 0 enp6s0

Informações do IP de um domínio com nslookuplink image 71

Se quisermos saber o IP de algum domínio, podemos descobri-lo por meio do comando nslookup

	
< > Input
Python
!nslookup google.com
Copied
>_ Output
			
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: google.com
Address: 142.250.185.14
Name: google.com
Address: 2a00:1450:4003:808::200e

Isto nos diz que o IPv4 do Google é 172.217.168.174 e seu IPv6 é 2a00:1450:4003:803::200e

Informações da nossa rede com netstatslink image 72

O último comando de utilidade é netstats, este comando nos dá o estado da nossa rede; além disso, com a flag -i ele nos retorna nossas interfaces de rede

	
< > Input
Python
!netstat -i
Copied
>_ Output
			
Tabla de la interfaz del núcleo
Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
br-470e5 1500 0 0 0 0 0 0 0 0 BMU
docker0 1500 0 0 0 0 0 0 0 0 BMU
enp6s0 1500 148385 0 2182 0 106135 0 0 0 BMRU
lo 65536 11674 0 0 0 11674 0 0 0 LRU
wlp5s0 1500 0 0 0 0 0 0 0 0 BMU

Consultas DNS com diglink image 73

Com o comando dig <dominio> podemos fazer consultas DNS, por exemplo, vamos fazer uma consulta ao Google

	
< > Input
Python
!dig google.com
Copied
>_ Output
			
; &lt;&lt;&gt;&gt; DiG 9.16.1-Ubuntu &lt;&lt;&gt;&gt; google.com
;; global options: +cmd
;; Got answer:
;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 20527
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 283 IN A 142.250.184.14
;; Query time: 8 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: dom sep 24 01:32:07 CEST 2023
;; MSG SIZE rcvd: 55

Pode-se ver

;; SEÇÃO DE RESPOSTA:
google.com. 283 IN A 142.250.184.14

Portanto, a consulta nos deu o IP do Google

Podemos fazer a consulta a um servidor DNS específico com dig @<servidor DNS> <domínio>

	
< > Input
Python
!dig @1.1.1.1 google.com
Copied
>_ Output
			
; &lt;&lt;&gt;&gt; DiG 9.16.1-Ubuntu &lt;&lt;&gt;&gt; @1.1.1.1 google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 15633
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;google.com. IN A
;; ANSWER SECTION:
google.com. 190 IN A 142.250.184.14
;; Query time: 8 msec
;; SERVER: 1.1.1.1#53(1.1.1.1)
;; WHEN: dom sep 24 01:33:40 CEST 2023
;; MSG SIZE rcvd: 44

Fizemos a mesma consulta, mas a fizemos ao DNS da Cloudflare

Compactando arquivoslink image 74

Antes de comprimir e descomprimir, vamos ver o que vamos comprimir. Primeiro, imprimimos nosso caminho e listamos os arquivos.

	
< > Input
Python
!pwd; ls -l
Copied
>_ Output
			
/home/wallabot/Documentos/web/portafolio/posts/prueba
total 332
-rw-rw-r-- 1 wallabot wallabot 285898 dic 6 00:28 2021-02-11-Introduccion-a-Python.ipynb
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 Abc
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos1
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos123
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot2.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 file.txt
-rw-rw-r-- 1 wallabot wallabot 15131 dic 6 01:49 google2.html
-rw-rw-r-- 1 wallabot wallabot 15168 dic 6 01:48 google.html
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 index.html
-rw-rw-r-- 1 wallabot wallabot 15117 dic 6 01:49 index.html.1
-rw-rw-r-- 1 wallabot wallabot 182 dic 6 01:06 lista.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 01:08 secuential.txt

Vamos criar uma nova pasta e copiar tudo o que está dentro da pasta atual para ela

	
< > Input
Python
!mkdir tocompress; cp * tocompress; ls -l
Copied
>_ Output
			
cp: -r not specified; omitting directory 'tocompress'
total 336
-rw-rw-r-- 1 wallabot wallabot 285898 dic 6 00:28 2021-02-11-Introduccion-a-Python.ipynb
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 Abc
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos1
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos123
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot2.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 file.txt
-rw-rw-r-- 1 wallabot wallabot 15131 dic 6 01:49 google2.html
-rw-rw-r-- 1 wallabot wallabot 15168 dic 6 01:48 google.html
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 index.html
-rw-rw-r-- 1 wallabot wallabot 15117 dic 6 01:49 index.html.1
-rw-rw-r-- 1 wallabot wallabot 182 dic 6 01:06 lista.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 01:08 secuential.txt
drwxrwxr-x 2 wallabot wallabot 4096 dic 6 01:52 tocompress

Como vemos, foi copiado tudo, exceto a própria pasta tocompress, já que não colocamos a flag -r no comando cp. Mas o que aconteceu foi exatamente o que queríamos

Comprimir com tarlink image 75

O primeiro comando que vamos usar para comprimir é tar, ao qual vamos adicionar a flag -c de compress, -v de verbose, para que vá mostrando o que está fazendo, e a flag -f de file, e em seguida o nome que queremos que o arquivo comprimido tenha e o nome do arquivo que queremos comprimir

	
< > Input
Python
!tar -cvf tocompress.tar tocompress
Copied
>_ Output
			
tocompress/
tocompress/lista.txt
tocompress/dot.txt
tocompress/google.html
tocompress/index.html
tocompress/Abc
tocompress/google2.html
tocompress/dot2.txt
tocompress/secuential.txt
tocompress/index.html.1
tocompress/file.txt
tocompress/datos1
tocompress/2021-02-11-Introduccion-a-Python.ipynb
tocompress/datos123
	
< > Input
Python
!ls -l
Copied
>_ Output
			
total 676
-rw-rw-r-- 1 wallabot wallabot 285898 dic 6 00:28 2021-02-11-Introduccion-a-Python.ipynb
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 Abc
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos1
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos123
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot2.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 file.txt
-rw-rw-r-- 1 wallabot wallabot 15131 dic 6 01:49 google2.html
-rw-rw-r-- 1 wallabot wallabot 15168 dic 6 01:48 google.html
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 index.html
-rw-rw-r-- 1 wallabot wallabot 15117 dic 6 01:49 index.html.1
-rw-rw-r-- 1 wallabot wallabot 182 dic 6 01:06 lista.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 01:08 secuential.txt
drwxrwxr-x 2 wallabot wallabot 4096 dic 6 01:52 tocompress
-rw-rw-r-- 1 wallabot wallabot 348160 dic 6 01:53 tocompress.tar

Vemos que criou o arquivo tocompress.tar

Agora vamos repetir o processo, mas adicionando a flag -z. O que isso faz é comprimir no formato gzip, que é um algoritmo de compressão mais eficiente

	
< > Input
Python
!tar -cvzf tocompress.tar.gz tocompress
Copied
>_ Output
			
tocompress/
tocompress/lista.txt
tocompress/dot.txt
tocompress/google.html
tocompress/index.html
tocompress/Abc
tocompress/google2.html
tocompress/dot2.txt
tocompress/secuential.txt
tocompress/index.html.1
tocompress/file.txt
tocompress/datos1
tocompress/2021-02-11-Introduccion-a-Python.ipynb
tocompress/datos123
	
< > Input
Python
!ls -lh
Copied
>_ Output
			
total 728K
-rw-rw-r-- 1 wallabot wallabot 280K dic 6 00:28 2021-02-11-Introduccion-a-Python.ipynb
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 Abc
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos1
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos123
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot2.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 file.txt
-rw-rw-r-- 1 wallabot wallabot 15K dic 6 01:49 google2.html
-rw-rw-r-- 1 wallabot wallabot 15K dic 6 01:48 google.html
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 index.html
-rw-rw-r-- 1 wallabot wallabot 15K dic 6 01:49 index.html.1
-rw-rw-r-- 1 wallabot wallabot 182 dic 6 01:06 lista.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 01:08 secuential.txt
drwxrwxr-x 2 wallabot wallabot 4,0K dic 6 01:52 tocompress
-rw-rw-r-- 1 wallabot wallabot 340K dic 6 01:53 tocompress.tar
-rw-rw-r-- 1 wallabot wallabot 52K dic 6 01:53 tocompress.tar.gz

Como se pode ver, o arquivo tocompress.tar ocupa 340 kB, enquanto o arquivo tocompress.tar.gz ocupa apenas 52 kB

Agora vamos descompactar os arquivos. Para descompactar, usa-se o mesmo comando, só que trocando a flag -c pela flag -x

Primeiro, apagamos a pasta original

	
< > Input
Python
!rm -r tocompress
Copied

Descompactamos

	
< > Input
Python
!tar -xvf tocompress.tar
Copied
>_ Output
			
tocompress/
tocompress/lista.txt
tocompress/dot.txt
tocompress/google.html
tocompress/index.html
tocompress/Abc
tocompress/google2.html
tocompress/dot2.txt
tocompress/secuential.txt
tocompress/index.html.1
tocompress/file.txt
tocompress/datos1
tocompress/2021-02-11-Introduccion-a-Python.ipynb
tocompress/datos123
	
< > Input
Python
!ls -lh
Copied
>_ Output
			
total 728K
-rw-rw-r-- 1 wallabot wallabot 280K dic 6 00:28 2021-02-11-Introduccion-a-Python.ipynb
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 Abc
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos1
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos123
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot2.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 file.txt
-rw-rw-r-- 1 wallabot wallabot 15K dic 6 01:49 google2.html
-rw-rw-r-- 1 wallabot wallabot 15K dic 6 01:48 google.html
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 index.html
-rw-rw-r-- 1 wallabot wallabot 15K dic 6 01:49 index.html.1
-rw-rw-r-- 1 wallabot wallabot 182 dic 6 01:06 lista.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 01:08 secuential.txt
drwxrwxr-x 2 wallabot wallabot 4,0K dic 6 01:52 tocompress
-rw-rw-r-- 1 wallabot wallabot 340K dic 6 01:53 tocompress.tar
-rw-rw-r-- 1 wallabot wallabot 52K dic 6 01:53 tocompress.tar.gz

Fazemos o mesmo com o gzip

	
< > Input
Python
!rm -r tocompress
Copied
	
< > Input
Python
!tar -xvzf tocompress.tar.gz
Copied
>_ Output
			
tocompress/
tocompress/lista.txt
tocompress/dot.txt
tocompress/google.html
tocompress/index.html
tocompress/Abc
tocompress/google2.html
tocompress/dot2.txt
tocompress/secuential.txt
tocompress/index.html.1
tocompress/file.txt
tocompress/datos1
tocompress/2021-02-11-Introduccion-a-Python.ipynb
tocompress/datos123
	
< > Input
Python
!ls -lh
Copied
>_ Output
			
total 728K
-rw-rw-r-- 1 wallabot wallabot 280K dic 6 00:28 2021-02-11-Introduccion-a-Python.ipynb
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 Abc
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos1
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos123
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot2.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 file.txt
-rw-rw-r-- 1 wallabot wallabot 15K dic 6 01:49 google2.html
-rw-rw-r-- 1 wallabot wallabot 15K dic 6 01:48 google.html
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 index.html
-rw-rw-r-- 1 wallabot wallabot 15K dic 6 01:49 index.html.1
-rw-rw-r-- 1 wallabot wallabot 182 dic 6 01:06 lista.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 01:08 secuential.txt
drwxrwxr-x 2 wallabot wallabot 4,0K dic 6 01:52 tocompress
-rw-rw-r-- 1 wallabot wallabot 340K dic 6 01:53 tocompress.tar
-rw-rw-r-- 1 wallabot wallabot 52K dic 6 01:53 tocompress.tar.gz

Compactar com ziplink image 76

Outro comando para comprimir com zip; para compactar, basta adicionar a flag -r (recursive), o nome que queremos que o arquivo compactado tenha e o arquivo que queremos compactar

	
< > Input
Python
!zip -r tocompress.zip tocompress
Copied
>_ Output
			
adding: tocompress/ (stored 0%)
adding: tocompress/lista.txt (deflated 23%)
adding: tocompress/dot.txt (stored 0%)
adding: tocompress/google.html (deflated 56%)
adding: tocompress/index.html (stored 0%)
adding: tocompress/Abc (stored 0%)
adding: tocompress/google2.html (deflated 56%)
adding: tocompress/dot2.txt (stored 0%)
adding: tocompress/secuential.txt (stored 0%)
adding: tocompress/index.html.1 (deflated 56%)
adding: tocompress/file.txt (stored 0%)
adding: tocompress/datos1 (stored 0%)
adding: tocompress/2021-02-11-Introduccion-a-Python.ipynb (deflated 85%)
adding: tocompress/datos123 (stored 0%)
	
< > Input
Python
!ls -lh
Copied
>_ Output
			
total 792K
-rw-rw-r-- 1 wallabot wallabot 280K dic 6 00:28 2021-02-11-Introduccion-a-Python.ipynb
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 Abc
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos1
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos123
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot2.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 file.txt
-rw-rw-r-- 1 wallabot wallabot 15K dic 6 01:49 google2.html
-rw-rw-r-- 1 wallabot wallabot 15K dic 6 01:48 google.html
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 index.html
-rw-rw-r-- 1 wallabot wallabot 15K dic 6 01:49 index.html.1
-rw-rw-r-- 1 wallabot wallabot 182 dic 6 01:06 lista.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 01:08 secuential.txt
drwxrwxr-x 2 wallabot wallabot 4,0K dic 6 01:52 tocompress
-rw-rw-r-- 1 wallabot wallabot 340K dic 6 01:53 tocompress.tar
-rw-rw-r-- 1 wallabot wallabot 52K dic 6 01:53 tocompress.tar.gz
-rw-rw-r-- 1 wallabot wallabot 64K dic 6 01:53 tocompress.zip

Para descomprimir, usa-se o comando unzip seguido do nome do arquivo que quero descomprimir. Primeiro, apagamos a pasta tocompress

	
< > Input
Python
!rm -r tocompress
Copied
	
< > Input
Python
!unzip tocompress.zip
Copied
>_ Output
			
Archive: tocompress.zip
creating: tocompress/
inflating: tocompress/lista.txt
extracting: tocompress/dot.txt
inflating: tocompress/google.html
extracting: tocompress/index.html
extracting: tocompress/Abc
inflating: tocompress/google2.html
extracting: tocompress/dot2.txt
extracting: tocompress/secuential.txt
inflating: tocompress/index.html.1
extracting: tocompress/file.txt
extracting: tocompress/datos1
inflating: tocompress/2021-02-11-Introduccion-a-Python.ipynb
extracting: tocompress/datos123
	
< > Input
Python
!ls -lh
Copied
>_ Output
			
total 792K
-rw-rw-r-- 1 wallabot wallabot 280K dic 6 00:28 2021-02-11-Introduccion-a-Python.ipynb
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 Abc
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos1
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 datos123
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot2.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 dot.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 file.txt
-rw-rw-r-- 1 wallabot wallabot 15K dic 6 01:49 google2.html
-rw-rw-r-- 1 wallabot wallabot 15K dic 6 01:48 google.html
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 00:56 index.html
-rw-rw-r-- 1 wallabot wallabot 15K dic 6 01:49 index.html.1
-rw-rw-r-- 1 wallabot wallabot 182 dic 6 01:06 lista.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 01:08 secuential.txt
drwxrwxr-x 2 wallabot wallabot 4,0K dic 6 01:52 tocompress
-rw-rw-r-- 1 wallabot wallabot 340K dic 6 01:53 tocompress.tar
-rw-rw-r-- 1 wallabot wallabot 52K dic 6 01:53 tocompress.tar.gz
-rw-rw-r-- 1 wallabot wallabot 64K dic 6 01:53 tocompress.zip

Processos em background e foregroundlink image 77

Pausar um processo e levá-lo para o background com CTRL+Zlink image 78

Quando executamos um processo no terminal, ele pode não parar de ser executado e podemos querer continuar usando o terminal; para resolver isso, podemos levar o processo para o background pressionando CTRL+Z

Por exemplo, eu posso fazer um ping para mim mesmo, sem especificar o número de tentativas, então isso estará sendo executado até que eu pare o processo pressionando CTRL+C

	
< > Input
Python
!ping localhost
Copied
>_ Output
			
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.025 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.027 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.024 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.024 ms
64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.027 ms
64 bytes from localhost (127.0.0.1): icmp_seq=6 ttl=64 time=0.036 ms
^C
--- localhost ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5127ms
rtt min/avg/max/mdev = 0.024/0.027/0.036/0.004 ms

No entanto, se o que queremos é pausar o processo por um momento para poder continuar usando o terminal, é necessário pressionar Ctrl+Z

	
< > Input
Python
!ping localhost
Copied
>_ Output
			
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.028 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.020 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.017 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.025 ms
64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.021 ms
64 bytes from localhost (127.0.0.1): icmp_seq=6 ttl=64 time=0.055 ms
^Z
[1]+ Detenido ping localhost

Como indicado, o processo foi interrompido; ele não está em execução enquanto o levo para segundo plano

Ver os processos em background com jobslink image 79

Para ver quais processos estão em segundo plano, temos dois comandos; por um lado, podemos usar jobs

	
< > Input
Python
!jobs
Copied
>_ Output
			
jobs
[1]+ Detenido ping localhost

Este comando nos fornece o processo e o número do job. Este número será o que deveremos usar para levar o processo para o foreground

Ver os processos em background com pslink image 80

Outro comando que podemos usar é ps (processes)

	
< > Input
Python
!ps
Copied
>_ Output
			
PID TTY TIME CMD
16232 pts/3 00:00:00 bash
17070 pts/3 00:00:00 ping
18376 pts/3 00:00:00 ps

Este comando não apenas nos fornece as informações dos processos que estão sendo executados em background, mas de todos os processos que estão sendo executados no terminal.

É importante ressaltar que, se abrirmos um novo terminal e usarmos qualquer um desses comandos, ele não nos dará a informação do ping, já que o executamos em outro terminal

	
< > Input
Python
!ps
Copied
>_ Output
			
PID TTY TIME CMD
18993 pts/2 00:00:00 bash
19290 pts/2 00:00:00 ps

Como vemos jobs não devolve nada porque neste terminal não há nenhum processo em segundo plano e ps só nos devolve a informação do bash (a própria terminal) e o comando ps lançado

Levar um processo do background para o foregroundlink image 81

Para trazer um processo para o foreground, é preciso usar o comando fg; se quiser trazer o último que foi colocado em background, basta digitar fg. Caso contrário, é necessário indicar o número do job.

Vamos voltar a ver os processos que tínhamos em segundo plano

	
< > Input
Python
!jobs
Copied
>_ Output
			
[1]+ Detenido ping localhost

Podemos trazer este processo para o foreground apenas escrevendo fg ou indicando o número do job com fg %1

	
< > Input
Python
!fg %1
Copied
>_ Output
			
ping localhost
64 bytes from localhost (127.0.0.1): icmp_seq=7 ttl=64 time=0.032 ms
64 bytes from localhost (127.0.0.1): icmp_seq=8 ttl=64 time=0.036 ms
64 bytes from localhost (127.0.0.1): icmp_seq=9 ttl=64 time=0.045 ms
64 bytes from localhost (127.0.0.1): icmp_seq=10 ttl=64 time=0.035 ms
64 bytes from localhost (127.0.0.1): icmp_seq=11 ttl=64 time=0.031 ms

Executar um processo diretamente em segundo planolink image 82

Vamos lançar novamente o navegador Firefox agora, digitando firefox no terminal e pressionando CTRL+Z para levá-lo ao background

	
< > Input
Python
!firefox
Copied
>_ Output
			
[GFX1-]: glxtest: VA-API test failed: failed to initialise VAAPI connection.
[2022-11-29T06:16:17Z ERROR glean_core::metrics::ping] Invalid reason code startup for ping background-update
^Z
[1]+ Detenido firefox

Como vemos, ele indica que o processo foi interrompido, de modo que, se agora quisermos navegar pelo Firefox, não poderemos, pois ele está interrompido.

Para poder iniciar o Firefox e deixá-lo em segundo plano para que não bloqueie o terminal, é preciso escrever um & no final do comando

	
< > Input
Python
!firefox &amp;
Copied
>_ Output
			
[1] 23663
$ [GFX1-]: glxtest: VA-API test failed: failed to initialise VAAPI connection.
[2022-11-29T06:19:40Z ERROR glean_core::metrics::ping] Invalid reason code startup for ping background-update
$

Agora iniciamos o Firefox, ele nos diz seu número de job e fica em execução em segundo plano.

De fato, se agora olharmos para os processos, podemos ver que o estado do Firefox é *Executando*

	
< > Input
Python
!jobs
Copied
>_ Output
			
[1]+ Ejecutando firefox &amp;

Encerrar um processo que está em segundo planolink image 83

Como temos o Firefox em execução em segundo plano, se quisermos que ele termine, temos que usar kill e o número do job do processo. Vamos usar jobs para ver o número do job do Firefox

	
< > Input
Python
!jobs
Copied
>_ Output
			
[1]+ Ejecutando firefox &amp;

Seu número de trabalho é 1, portanto usamos esse número para encerrar o processo.

	
< > Input
Python
!kill %1
Copied
>_ Output
			

Não nos responde nada, mas se voltarmos a usar jobs para ver os processos em background

	
< > Input
Python
!jobs
Copied
>_ Output
			
[1]+ Terminado firefox

Vemos que nos diz que o Firefox terminou; se voltarmos a executar jobs, já não aparecerá nada

	
< > Input
Python
!jobs
Copied
>_ Output
			

Processos em background independentes do terminallink image 84

Até agora vimos como executar processos em segundo plano dependentes do terminal, isso significa que, se enviarmos para o segundo plano um processo e fecharmos o terminal, ele enviará uma mensagem de encerramento a todos os processos que estão em seu segundo plano e eles terminarão

Mas há vezes que nos interessa que o processo fique em segundo plano, poder fechar o terminal, abrir outro e recuperar esse processo, para isso usaremos tmux, que é um multiplexador de terminais.

É possível que venha instalada, por isso, para instalá-la, você deve inserir o seguinte

sudo apt install tmux

Uma vez instalada, podemos criar uma nova sessão de tmux por meio do tmux new -s <name>

tmux new -s session1

Isso nos abrirá um novo terminal, que na realidade é uma sessão de tmux

Dentro dela podemos lançar um processo, por exemplo um ping para nós mesmos

	
< > Input
Python
!ping localhost
Copied
>_ Output
			
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.036 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.019 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.031 ms

Podemos fechar esse terminal

Se abrirmos uma nova, podemos ver todas as sessões de tmux abertas com o comando tmux ls

	
< > Input
Python
!tmux ls
Copied
>_ Output
			
session1: 1 windows (created Tue Nov 29 08:15:22 2022)

E podemos entrar em uma sessão por meio do comando tmux, seguido de a (attach), -t (tag) e o nome da sessão

	
< > Input
Python
!tmux a -t session1
Copied
>_ Output
			
64 bytes from localhost (127.0.0.1): icmp_seq=146 ttl=64 time=0.025 ms
64 bytes from localhost (127.0.0.1): icmp_seq=147 ttl=64 time=0.022 ms
64 bytes from localhost (127.0.0.1): icmp_seq=148 ttl=64 time=0.026 ms
64 bytes from localhost (127.0.0.1): icmp_seq=149 ttl=64 time=0.013 ms
64 bytes from localhost (127.0.0.1): icmp_seq=150 ttl=64 time=0.027 ms
64 bytes from localhost (127.0.0.1): icmp_seq=151 ttl=64 time=0.019 ms

Como vemos, recuperamos o ping de antes

Quando estamos dentro de uma sessão, podemos sair dela (encerrando-a) escrevendo CTRL+D ou escrevendo exit

Gestão de processoslink image 85

Para lidar com os processos do nosso sistema, temos várias opções

Gerenciador de processos pslink image 86

Como vimos antes, ps nos mostra os processos que estão sendo executados em nosso terminal. Por exemplo, executamos um processo em segundo plano e vemos os processos com ps

	
< > Input
Python
!firefox &amp;
Copied
>_ Output
			
[1] 50555

Vemos agora os processos

	
< > Input
Python
!ps
Copied
>_ Output
			
PID TTY TIME CMD
36660 pts/3 00:00:00 bash
50555 pts/3 00:00:02 firefox
50613 pts/3 00:00:00 Socket Process
50635 pts/3 00:00:00 Privileged Cont
50683 pts/3 00:00:00 WebExtensions
50741 pts/3 00:00:00 Web Content
50743 pts/3 00:00:00 Web Content
50748 pts/3 00:00:00 Web Content
50840 pts/3 00:00:00 ps

Uma vez que saibamos seu PID, podemos matar o processo

	
< > Input
Python
!kill 50555
Copied
>_ Output
			

Vemos agora os processos

	
< > Input
Python
!ps
Copied
>_ Output
			
PID TTY TIME CMD
36660 pts/3 00:00:00 bash
51132 pts/3 00:00:00 ps

Mas, como dissemos, o problema do ps é que ele só mostra os processos do seu terminal

Para que ele nos mostre todos os processos do sistema, temos que adicionar aux

	
< > Input
Python
terminal("ps aux", max_lines_output=10)
Copied
>_ Output
			
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.2 0.0 169936 13172 ? Ss 23:06 0:01 /sbin/init splash
root 2 0.0 0.0 0 0 ? S 23:06 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? I&lt; 23:06 0:00 [rcu_gp]
root 4 0.0 0.0 0 0 ? I&lt; 23:06 0:00 [rcu_par_gp]
root 5 0.0 0.0 0 0 ? I&lt; 23:06 0:00 [netns]
root 7 0.0 0.0 0 0 ? I&lt; 23:06 0:00 [kworker/0:0H-events_highpri]
root 9 0.0 0.0 0 0 ? I&lt; 23:06 0:00 [kworker/0:1H-events_highpri]
root 10 0.0 0.0 0 0 ? I&lt; 23:06 0:00 [mm_percpu_wq]
root 11 0.0 0.0 0 0 ? S 23:06 0:00 [rcu_tasks_rude_]
...
wallabot 11094 0.0 0.2 1184730916 65900 ? Sl 23:19 0:00 /opt/google/chrome/chrome --type=renderer --crashpad-handler-pid=5080 --enable-crash-reporter=, --change-stack-guard-on-fork=enable --lang=es --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=76 --time-ticks-at-unix-epoch=-1670018798736448 --launch-time-ticks=781545948 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=0,i,18391862866948577032,30807856093711604,131072
wallabot 11428 0.3 0.2 38136100 75812 ? Sl 23:21 0:00 /usr/share/code/code --ms-enable-electron-run-as-node /usr/share/code/resources/app/extensions/markdown-language-features/server/dist/node/main --node-ipc --clientProcessId=8508
root 11508 0.0 0.0 0 0 ? I 23:21 0:00 [kworker/4:1-events]
wallabot 11683 0.0 0.0 14192 3380 ? R 23:22 0:00 ps aux

Agora, se o que eu quero é buscar apenas os processos que estejam executando meu usuário, posso fazer isso criando um pipe e buscando com grep

	
< > Input
Python
!ps aux | grep wallabot
Copied
>_ Output
			
avahi 802 0.0 0.0 8536 3912 ? Ss 23:06 0:00 avahi-daemon: running [wallabot.local]
wallabot 1153 0.0 0.0 19856 10624 ? Ss 23:06 0:00 /lib/systemd/systemd --user
wallabot 1154 0.0 0.0 170004 3680 ? S 23:06 0:00 (sd-pam)
wallabot 1159 0.1 0.0 2569384 22808 ? S&lt;sl 23:06 0:01 /usr/bin/pulseaudio --daemonize=no --log-target=journal
wallabot 1161 0.1 0.1 591424 37248 ? SNsl 23:06 0:02 /usr/libexec/tracker-miner-fs
wallabot 1164 0.0 0.0 390744 8664 ? SLl 23:06 0:00 /usr/bin/gnome-keyring-daemon --daemonize --login
wallabot 1168 0.0 0.0 166804 6616 tty2 Ssl+ 23:06 0:00 /usr/lib/gdm3/gdm-x-session --run-script env GNOME_SHELL_SESSION_MODE=ubuntu /usr/bin/gnome-session --systemd --session=ubuntu
wallabot 1173 0.0 0.0 8904 6012 ? Ss 23:06 0:00 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
wallabot 1181 0.0 0.0 242628 7884 ? Ssl 23:06 0:00 /usr/libexec/gvfsd
wallabot 1196 0.0 0.0 378348 5544 ? Sl 23:06 0:00 /usr/libexec/gvfsd-fuse /run/user/1000/gvfs -f -o big_writes
wallabot 1203 0.0 0.0 316896 9540 ? Ssl 23:06 0:00 /usr/libexec/gvfs-udisks2-volume-monitor
wallabot 1209 0.0 0.0 319540 8920 ? Ssl 23:06 0:00 /usr/libexec/gvfs-afc-volume-monitor
wallabot 1215 0.0 0.0 238612 5476 ? Ssl 23:06 0:00 /usr/libexec/gvfs-mtp-volume-monitor
wallabot 1220 0.0 0.0 239456 6988 ? Ssl 23:06 0:00 /usr/libexec/gvfs-goa-volume-monitor
wallabot 1224 0.0 0.2 707176 69244 ? SLl 23:06 0:00 /usr/libexec/goa-daemon
wallabot 1231 0.0 0.0 317692 9068 ? Sl 23:06 0:00 /usr/libexec/goa-identity-service
wallabot 1237 0.0 0.0 240888 6244 ? Ssl 23:06 0:00 /usr/libexec/gvfs-gphoto2-volume-monitor
wallabot 1308 0.0 0.0 190872 13688 tty2 Sl+ 23:06 0:00 /usr/libexec/gnome-session-binary --systemd --systemd --session=ubuntu
wallabot 1375 0.0 0.0 6040 452 ? Ss 23:06 0:00 /usr/bin/ssh-agent /usr/bin/im-launch env GNOME_SHELL_SESSION_MODE=ubuntu /usr/bin/gnome-session --systemd --session=ubuntu
wallabot 1394 0.0 0.0 305428 6572 ? Ssl 23:06 0:00 /usr/libexec/at-spi-bus-launcher
...
wallabot 8911 0.0 0.2 38136100 70604 ? Sl 23:10 0:00 /usr/share/code/code --ms-enable-electron-run-as-node /usr/share/code/resources/app/extensions/json-language-features/server/dist/node/jsonServerMain --node-ipc --clientProcessId=8508
wallabot 8932 0.0 0.0 13648 5412 pts/0 Ss+ 23:10 0:00 /usr/bin/bash --init-file /usr/share/code/resources/app/out/vs/workbench/contrib/terminal/browser/media/shellIntegration-bash.sh
wallabot 9112 0.0 0.1 816596 50392 ? Ssl 23:10 0:00 /usr/libexec/gnome-terminal-server
wallabot 9120 0.0 0.0 13628 5212 pts/1 Ss+ 23:10 0:00 bash
wallabot 10927 0.0 0.3 1184807108 117996 ? Sl 23:19 0:00 /opt/google/chrome/chrome --type=renderer --crashpad-handler-pid=5080 --enable-crash-reporter=, --change-stack-guard-on-fork=enable --lang=es --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=72 --time-ticks-at-unix-epoch=-1670018798736448 --launch-time-ticks=743183717 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=0,i,18391862866948577032,30807856093711604,131072
wallabot 11428 0.1 0.2 38136100 74884 ? Sl 23:21 0:00 /usr/share/code/code --ms-enable-electron-run-as-node /usr/share/code/resources/app/extensions/markdown-language-features/server/dist/node/main --node-ipc --clientProcessId=8508
wallabot 12009 0.0 0.2 1184730916 65832 ? Sl 23:24 0:00 /opt/google/chrome/chrome --type=renderer --crashpad-handler-pid=5080 --enable-crash-reporter=, --change-stack-guard-on-fork=enable --lang=es --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=80 --time-ticks-at-unix-epoch=-1670018798736448 --launch-time-ticks=1081580044 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=0,i,18391862866948577032,30807856093711604,131072
wallabot 12109 0.0 0.0 2616 596 pts/2 Ss+ 23:25 0:00 /usr/bin/sh -c ps aux | grep wallabot
wallabot 12110 0.0 0.0 14192 3560 pts/2 R+ 23:25 0:00 ps aux
wallabot 12111 0.0 0.0 11668 660 pts/2 S+ 23:25 0:00 grep wallabot

Gerenciador de processos toplink image 87

Com top podemos ver todos os processos do sistema operativo. Mostrará a informação com less, por isso, tal como foi explicado antes, quando se queira parar top, introduzindo q irá parar

	
< > Input
Python
!top
Copied
>_ Output
			
top - 09:31:32 up 3:21, 1 user, load average: 2,42, 2,79, 2,48
Tareas: 382 total, 1 ejecutar, 381 hibernar, 0 detener, 0 zombie
%Cpu(s): 14,2 usuario, 1,5 sist, 0,0 adecuado, 84,3 inact, 0,0 en espera, 0,
MiB Mem : 32006,4 total, 20281,8 libre, 6229,0 usado, 5495,6 búfer/caché
MiB Intercambio: 2048,0 total, 2048,0 libre, 0,0 usado. 24979,1 dispon
PID USUARIO PR NI VIRT RES SHR S %CPU %MEM HORA+ ORDEN
10192 wallabot 20 0 3347636 388848 84140 S 137,5 1,2 282:24.59 python
44161 wallabot 20 0 30,2g 217208 100148 S 12,5 0,7 0:40.92 spotify
76 root 20 0 0 0 0 S 6,2 0,0 0:00.12 ksoftir+
1105 root -51 0 0 0 0 S 6,2 0,0 2:54.29 irq/125+
43990 wallabot 20 0 3998836 246260 145800 S 6,2 0,8 0:53.69 spotify
44101 wallabot 20 0 1995108 130316 89848 S 6,2 0,4 0:08.34 spotify
51510 wallabot 20 0 14876 4088 3288 R 6,2 0,0 0:00.01 top
1 root 20 0 169736 13188 8380 S 0,0 0,0 0:01.51 systemd
2 root 20 0 0 0 0 S 0,0 0,0 0:00.00 kthreadd
3 root 0 -20 0 0 0 I 0,0 0,0 0:00.00 rcu_gp
4 root 0 -20 0 0 0 I 0,0 0,0 0:00.00 rcu_par+
5 root 0 -20 0 0 0 I 0,0 0,0 0:00.00 netns
7 root 0 -20 0 0 0 I 0,0 0,0 0:00.00 kworker+
9 root 0 -20 0 0 0 I 0,0 0,0 0:00.03 kworker+
10 root 0 -20 0 0 0 I 0,0 0,0 0:00.00 mm_perc+
11 root 20 0 0 0 0 S 0,0 0,0 0:00.00 rcu_tas+
12 root 20 0 0 0 0 S 0,0 0,0 0:00.00 rcu_tas+

Como se pode ver, o PID 44161 é o Spotify, que estou usando agora para reproduzir música, mas com ps não o tínhamos visto

Assim como antes, se quisermos matar um processo devemos introduzir kill e o seu PID

O bom do top é que ele nos oferece muito mais utilidades; se pressionarmos h, ele mostrará a ajuda

	
< > Input
Python
!h
Copied
>_ Output
			
Help for Interactive Commands - procps-ng 3.3.16
Window 1:Def: Cumulative mode Apagado. System: Delay 3,0 secs; Secure mode Apag
Z,B,E,e Global: 'Z' colors; 'B' bold; 'E'/'e' summary/task memory scale
l,t,m Toggle Summary: 'l' load avg; 't' task/cpu stats; 'm' memory info
0,1,2,3,I Toggle: '0' zeros; '1/2/3' cpus or numa node views; 'I' Irix mode
f,F,X Fields: 'f'/'F' add/remove/order/sort; 'X' increase fixed-width
L,&amp;,&lt;,&gt; . Locate: 'L'/'&amp;' find/again; Move sort column: '&lt;'/'&gt;' left/right
R,H,J,C . Toggle: 'R' Sort; 'H' Threads; 'J' Num justify; 'C' Coordinates
c,i,S,j . Toggle: 'c' Cmd name/line; 'i' Idle; 'S' Time; 'j' Str justify
x,y . Toggle highlights: 'x' sort field; 'y' running tasks
z,b . Toggle: 'z' color/mono; 'b' bold/reverse (only if 'x' or 'y')
u,U,o,O . Filter by: 'u'/'U' effective/any user; 'o'/'O' other criteria
n,#,^O . Set: 'n'/'#' max tasks displayed; Show: Ctrl+'O' other filter(s)
V,v . Toggle: 'V' forest view; 'v' hide/show forest view children
k,r Gestiona tareas: «k» detener; «r» reiniciar
d o s Establece intervalo de actualización
W,Y Write configuration file 'W'; Inspect other output 'Y'
q Quit
( commands shown with '.' require a visible task display window )
Press 'h' or '?' for help with Windows,
Type 'q' or &lt;Esc&gt; to continue

Para sair, pressione ESC ou q

Como mostrado na ajuda, se introduzirmos u podemos filtrar por usuário, introduzimos meu usuário (wallabot) e posso ver apenas meus processos

	
< > Input
Python
!u
Copied
>_ Output
			
top - 09:35:57 up 3:25, 1 user, load average: 1,02, 2,27, 2,39
Tareas: 378 total, 1 ejecutar, 377 hibernar, 0 detener, 0 zombie
%Cpu(s): 13,4 usuario, 0,4 sist, 0,0 adecuado, 86,1 inact, 0,1 en espera, 0,
MiB Mem : 32006,4 total, 20288,0 libre, 6212,0 usado, 5506,4 búfer/caché
MiB Intercambio: 2048,0 total, 2048,0 libre, 0,0 usado. 24989,1 dispon
PID USUARIO PR NI VIRT RES SHR S %CPU %MEM HORA+ ORDEN
10192 wallabot 20 0 3347636 388848 84140 S 148,2 1,2 288:46.50 python
43990 wallabot 20 0 3998836 246552 146092 S 2,7 0,8 0:59.55 spotify
1384 wallabot 20 0 4909848 453700 133164 S 1,7 1,4 11:14.02 gnome-s+
1119 wallabot 9 -11 3093876 24504 17836 S 1,3 0,1 0:48.99 pulseau+
32462 wallabot 20 0 1134,0g 643412 128632 S 1,3 2,0 7:39.91 chrome
44161 wallabot 20 0 30,2g 217112 100488 S 1,3 0,7 0:44.87 spotify
10135 wallabot 20 0 826220 58164 41648 S 1,0 0,2 0:14.56 gnome-t+
6635 wallabot 20 0 33,0g 647936 436252 S 0,3 2,0 4:01.80 chrome
6679 wallabot 20 0 32,4g 125564 94016 S 0,3 0,4 0:52.19 chrome
8010 wallabot 20 0 1130,9g 232800 116092 S 0,3 0,7 0:13.70 chrome
44101 wallabot 20 0 1995108 130444 89916 S 0,3 0,4 0:09.19 spotify
1113 wallabot 20 0 19880 10528 8096 S 0,0 0,0 0:00.38 systemd
1114 wallabot 20 0 169792 3636 12 S 0,0 0,0 0:00.00 (sd-pam)
1121 wallabot 39 19 591436 37256 16676 S 0,0 0,1 0:03.19 tracker+
1124 wallabot 20 0 390740 8688 7416 S 0,0 0,0 0:00.45 gnome-k+
1128 wallabot 20 0 166804 6596 5956 S 0,0 0,0 0:00.00 gdm-x-s+
1134 wallabot 20 0 9152 6144 3796 S 0,0 0,0 0:01.81 dbus-da+

Outra forma de ver isso para poder filtrar por usuário seria fazer um pipeline e usar grep

	
< > Input
Python
!top | grep wallabot
Copied
>_ Output
			
1440 wallabot 20 0 4684708 505432 118024 S 6,7 1,5 2:05.92 gnome-s+
25326 wallabot 20 0 1133,0g 527912 123732 S 1,7 1,6 1:31.73 chrome
1440 wallabot 20 0 4684708 505476 118024 S 1,3 1,5 2:05.96 gnome-s+
6199 wallabot 20 0 1131,0g 266068 116164 S 0,3 0,8 0:15.23 chrome
17606 wallabot 20 0 818228 52096 39488 S 0,3 0,2 0:02.59 gnome-t+
34284 wallabot 20 0 14876 4376 3308 R 0,3 0,0 0:00.02 top

Gerenciador de processos htoplink image 88

É parecido ao top, mas mais potente

Provavelmente você não o tem instalado, então, para instalá-lo, introduza o comando

sudo apt install htop

o

sudo snap install htop

Gerenciador de processos glanceslink image 89

É parecido a top, mas mais potente

Provavelmente você não o tenha instalado, então para instalá-lo, introduza o comando

sudo apt install glances

---

➡️ **Continua na Parte 3: administração do sistema**, onde você gerenciará recursos, pacotes, usuários e segurança como um profissional.

Continuar lendo

Últimos posts -->

Você viu esses projetos?

Gymnasia

Gymnasia Gymnasia
React Native
Expo
TypeScript
FastAPI
Next.js
OpenAI
Anthropic

Aplicativo móvel de treino pessoal com assistente de IA, biblioteca de exercícios, acompanhamento de rotinas, dieta e medidas corporais

Horeca chatbot

Horeca chatbot Horeca chatbot
Python
LangChain
PostgreSQL
PGVector
React
Kubernetes
Docker
GitHub Actions

Chatbot conversacional para cozinheiros de hotéis e restaurantes. Um cozinheiro, gerente de cozinha ou serviço de quarto de um hotel ou restaurante pode falar com o chatbot para obter informações sobre receitas e menus. Mas também implementa agentes, com os quais pode editar ou criar novas receitas ou menus

Naviground

Naviground Naviground
Ver todos os projetos -->
>_ Disponível para projetos

Tem um projeto com IA?

Vamos conversar.

maximofn@gmail.com

Especialista em Machine Learning e Inteligência Artificial. Desenvolvo soluções com IA generativa, agentes inteligentes e modelos personalizados.

Quer assistir alguma palestra?

Últimas palestras -->

Quer melhorar com essas dicas?

Últimos tips -->

Use isso localmente

Os espaços do Hugging Face nos permitem executar modelos com demos muito simples, mas e se a demo quebrar? Ou se o usuário a deletar? Por isso, criei contêineres docker com alguns espaços interessantes, para poder usá-los localmente, aconteça o que acontecer. Na verdade, se você clicar em qualquer botão de visualização de projeto, ele pode levá-lo a um espaço que não funciona.

Flow edit

Flow edit Flow edit

Edite imagens com este modelo de Flow. Baseado em SD3 ou FLUX, você pode editar qualquer imagem e gerar novas

FLUX.1-RealismLora

FLUX.1-RealismLora FLUX.1-RealismLora
Ver todos os contêineres -->
>_ Disponível para projetos

Tem um projeto com IA?

Vamos conversar.

maximofn@gmail.com

Especialista em Machine Learning e Inteligência Artificial. Desenvolvo soluções com IA generativa, agentes inteligentes e modelos personalizados.

Você quer treinar seu modelo com esses datasets?

short-jokes-dataset

HuggingFace

Dataset com piadas em inglês

Uso: Fine-tuning de modelos de geração de texto humorístico

231K linhas 2 colunas 45 MB
Ver no HuggingFace →

opus100

HuggingFace

Dataset com traduções de inglês para espanhol

Uso: Treinamento de modelos de tradução inglês-espanhol

1M linhas 2 colunas 210 MB
Ver no HuggingFace →

netflix_titles

HuggingFace

Dataset com filmes e séries da Netflix

Uso: Análise de catálogo Netflix e sistemas de recomendação

8.8K linhas 12 colunas 3.5 MB
Ver no HuggingFace →
Ver mais datasets -->