Cordiales saludos

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

Todos a practicar, incluyéndome! Nos vemos en la próxima publicación...
Comments (2)
https://twitter.com/1038814762719739904/status/1622979357839970311 The rewards earned on this comment will go directly to the people sharing the post on Twitter as long as they are registered with @poshtoken. Sign up at https://hiveposh.com.
Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!
Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).
You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support.