Curso: Terminal de Linux. N06. cat, echo, arch, df, lscpu, uname, clear
hive-154226·@rafaelaquino·
0.000 HBDCurso: Terminal de Linux. N06. cat, echo, arch, df, lscpu, uname, clear
Cordiales saludos <center>  </center> >Comandos que trataremos en esta publicación: **cat, echo, arch, df, lscpu, uname, clear** #### Comando cat (otras opciones) Con **cat** podemos crear un nuevo archivo introduciendo el texto directamente desde la terminal. ~~~ $ cat > file.txt Hola mundo! $ cat file.txt Hola mundo! $ ~~~ También podemos colocar una bandera u opción para que enumere las lineas de nuestro archivo de texto ~~~ $ cat -n file.txt 1 Hola mundo! $ ~~~ Con cat podemos mostrar mas de una archivo, en este caso **$ cat texto1.txt texto2.txt** nos muestra el contenido de los dos archivos: texto1.txt y texto2.txt. ~~~ $ echo "Hola" > texto1.txt $ echo "Hola2" > texto2.txt $ ls texto1.txt texto2.txt # Mostrando dos archivos con cat $ cat texto1.txt texto2.txt Hola Hola2 ~~~ Con **cat** podemos redireccionar el contenido de varios archivos a uno nuevo (texto3.txt) ~~~ cat texto1.txt texto2.txt > texto3.txt $ cat texto3.txt Hola Hola2 $ cat texto1.txt Hola $ cat texto2.txt Hola2 $ cat texto3.txt Hola Hola2 ~~~ #### Comando echo (Otras opciones) Podemos usar **echo** para realizar operaciones matemáticas básicas. ~~~ $ echo $((2+3)) 5 $ echo $((20 + 3)) 23 $ echo $((20 - 3)) 17 $ echo $((20 * 3)) 60 #División entera $ echo $((20 / 3)) 6 # Módulo o resto $ echo $((20 % 3)) 2 ~~~ #### Sustitución de comandos Con echo podemos ejecutar otros comandos con la sintaxis **echo$(COMANDO)**. ~~~ $ echo $(date) Mon Feb 6 10:01:24 -05 2023 $ echo $(ls) Lorem01.txt README.md comandos.txt comandos_1.txt comandos_2.txt comandos_2.txt.save comandos_3.txt documento.txt documentos.txt ejercicio.txt ejercicio2.txt git_repositorio.txt hola.py holamundo.txt holamundo2.txt lorem.txt nano.save salomon.txt saludo.sh trabajo ~~~ ~~~ $ echo $(cal) February 2023 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 $ echo "$(cal)" February 2023 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 ~~~ #### Arquitectura de nuestro equipo Con **arch** y **uname -m** podemos ver la arquitectura de nuestro equipo. ~~~ $ arch x86_64 $ uname -m x86_64 ~~~ #### Unidades de almacenamiento en nuestro equipo Para ver todas las unidades de almacenamiento de nuestr oequipo podemos usar el comando **df** ~~~ # Desde WSL $ df -h Filesystem Size Used Avail Use% Mounted on none 1.9G 4.0K 1.9G 1% /mnt/wsl drivers 233G 198G 35G 85% /usr/lib/wsl/drivers none 1.9G 0 1.9G 0% /usr/lib/wsl/lib /dev/sdc 251G 9.6G 229G 5% / none 1.9G 76K 1.9G 1% /mnt/wslg rootfs 1.9G 1.9M 1.9G 1% /init none 1.9G 0 1.9G 0% /dev none 1.9G 0 1.9G 0% /run none 1.9G 0 1.9G 0% /run/lock none 1.9G 0 1.9G 0% /run/shm none 1.9G 0 1.9G 0% /run/user tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup none 1.9G 72K 1.9G 1% /mnt/wslg/versions.txt none 1.9G 72K 1.9G 1% /mnt/wslg/doc drvfs 233G 198G 35G 85% /mnt/c drvfs 5.0G 19M 5.0G 1% /mnt/d drvfs 224G 172G 53G 77% /mnt/e $ #Desde Ubuntu rafael@HP:~$ df -h S.ficheros Tamaño Usados Disp Uso% Montado en tmpfs 784M 2,1M 782M 1% /run /dev/nvme0n1p2 137G 12G 119G 9% / tmpfs 3,9G 19M 3,9G 1% /dev/shm tmpfs 5,0M 4,0K 5,0M 1% /run/lock /dev/nvme0n1p1 570M 6,1M 564M 2% /boot/efi /dev/nvme0n1p3 301G 45G 242G 16% /home tmpfs 784M 4,7M 779M 1% /run/user/1000 /dev/sdb1 224G 172G 53G 77% /media/rafael/Rafael_Aquino_SSD /dev/sda2 233G 193G 41G 83% /media/rafael/Windows ~~~ #### Información de nuestro microprocesador Con **lscpu** podemos tener acceso a toda la información de nuestro microprocesador. ~~~ $ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian Address sizes: 39 bits physical, 48 bits virtual CPU(s): 4 On-line CPU(s) list: 0-3 Thread(s) per core: 1 Core(s) per socket: 4 Socket(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 94 Model name: Intel(R) Core(TM) i5-6500T CPU @ 2.50GHz Stepping: 3 CPU MHz: 2495.997 BogoMIPS: 4991.99 Hypervisor vendor: Microsoft Virtualization type: full L1d cache: 128 KiB L1i cache: 128 KiB L2 cache: 1 MiB L3 cache: 6 MiB ~~~ #### Versión del kernel Para ver la versión del kernel de nuestro linux usemos **uname -r**. ~~~ # En WSL $ uname -r 5.15.79.1-microsoft-standard-WSL2 #En Ubuntu rafael@HP:~$ uname -r 5.15.0-58-generic ~~~ ### Para limpiar la pantalla Usemos **clear** para limpiar la pantalla de nuestra terminal. ~~~ $clear ~~~ <center>  </center> [Módulo](https://es.wikipedia.org/wiki/Operaci%C3%B3n_m%C3%B3dulo) [kernel](https://es.wikipedia.org/wiki/N%C3%BAcleo_(inform%C3%A1tica)) Todos a practicar, incluyéndome! Nos vemos en la próxima publicación... [Mi Twitter](https://twitter.com/Rafa_elaquino) [Mi facebook](https://www.facebook.com/rafael.aquino.5815)
👍 amaponian, deadleaf, toronyor, sofiaquino98, escuadron201, shadowmyst, rickyuribe, paula1411, criptocuates, aurodivys, viper160891, lemouth, steemstem-trig, steemstem, dna-replication, minnowbooster, howo, aboutcoolscience, roelandp, stemsocial, alexander.alexis, walterprofe, lamouthe, metabs, curie, edb, dhimmel, sustainablyyours, abigail-dantes, de-stem, deholt, motherofalegend, nattybongo, pboulet, stem.witness, techslut, mobbs, tsoldovieri, kenadis, anikekirsten, intrepidphotos, francostem, temitayo-pelumi, crowdwitness, noelyss, valth, oluwatobiloba, samminator, joeyarnoldvn, enzor, postpromoter, sco, fragmentarion, geopolis, alexdory, zonguin, monsterjamgold, precarious, doctor-cog-diss, justyy, jasedmf, djlethalskillz, meno, arunbiju969, jayna, laxam, quentinvb, revo, sorin.cristescu, thecryptodrive, tobias-g, robmolecule, citizendog, steemean, tfeldman, chipdip, iansart, rocky1, superlotto, braaiboy, we-are-one, quinnertronics, thelordsharvest, steveconnor, rtron86, bflanagin, takowi, utube, investingpennies, movingman, armandosodano, mayorkeys, sunsea, cloh76, punchline, steemstorage, communitybank, sportscontest, fantasycrypto, cakemonster, stayoutoftherz, federacion45, arunava, steemwizards, cliffagreen, greenforever, fredkese, greddyforce, empath, irgendwo, detlev, brianoflondon, the-burn, podping, mugueto2022, gunthertopp, meritocracy, aries90, drricksanchez, djennyfloro, kristall97, cnfund, neumannsalva, minas-glory, zyx066, fineartnow, aicu, gohive, bitrocker2020, theskmeister, kylealex, therealwolf, merlin7, we-are-palcoin, bscrypto, dcrops, traderhive, smartsteem, therising, diabonua, cheese4ead, steemcryptosicko, tinyhousecryptos, darthsauron, yixn, neneandy, cleanplanet, thelittlebank, sarashew, the-grandmaster, dynamicrypto, cleanyourcity, metroair, yann0975, aabcent, mcsvi, meanbees, enrico2gameplays, ibt-survival, elevator09, sanderjansenart, atheistrepublic, dondido, lordvader, jerrybanfield, juecoree, stem-espanol, lorenzor, iamphysical, azulear, miguelangel2801, tomastonyperez, josedelacruz, erickyoussif, andrick, fran.frey, giulyfarci52, wilmer14molina, analealsuarez, elvigia, uche-nna, psicoluigi, capp, mammasitta, aaronkroeblinger, dandays, vaultec, nfttunz, eric-boucher, robertbira, nicole-st, jonny90, flatman, qualitator, beyond.vision, ennyta, endopediatria, stea90, gamersclassified,