🐧#ViernesDeEscritorio. Automatizando la actualización de Linux Mint con scripts.💻ESP/EN

@osomar357 · 2025-09-05 21:42 · Linux&SoftwareLibre

Captura de pantalla.



Automatizando la actualización de Linux Mint con scripts

Automating Linux Mint upgrade with scripts

Saludos, comunidad, mis mejores deseos para todos. Como todos mis lectores saben, soy usuario de Linux Mint y de Debian, pero ahora estoy usando Linux Mint 22.1 Xia, de 64 Bits, con escritorio Mate 1.26.2, que es un escritorio que me gusta mucho y me trae grandes recuerdos de cuando inicié en Linux en el año 2000.

Yo siempre recomiendo Linux Mint para las personas que están migrando de Windows a Linux, y eso se debe a que es un sistema muy estable, muy amigable y de fácil uso.

Pero también tiene herramientas como los “scripts de Bash” que nos permiten profundizar más en la experiencia de ser usuarios de Linux, y nos permiten automatizar ciertas tareas que nos permiten ahorrar tiempo, evitar errores y hacer que el sistema trabaje por nosotros.

La idea de este artículo es explicar qué es un script, qué es Bash, cómo funciona y dejar un script, bien explicado y automatizado, de modo que el usuario y el lector de este post lo pueda adaptar a sus necesidades.

Greetings, community, my best wishes to all. As all my readers know, I am a Linux Mint and Debian user, but now I am using Linux Mint 22.1 Xia, 64-bit, with Mate desktop 1.26.2, which is a desktop that I really like and brings back great memories of when I started on Linux in 2000.

I always recommend Linux Mint for people who are migrating from Windows to Linux, and that's because it's a very stable, very friendly and easy-to-use system.

But it also has tools such as “Bash scripts" that allow us to delve deeper into the experience of being Linux users, and allow us to automate certain tasks that allow us to save time, avoid errors and make the system work for us.

The idea of this article is to explain what a script is, what Bash is, how it works and leave a script, well explained and automated, so that the user and the reader of this post can adapt it to their needs.


Captura de pantalla. / Screenshot.


¿Qué es un script y qué es Bash?

What is a script and what is Bash?

Un script es un conjunto de comandos utilizados para realizar tareas en un lenguaje de programación. En nuestro caso, lo podemos definir de manera mucho más sencilla: “como un archivo de texto, donde colocamos los comandos que normalmente colocamos manualmente en la terminal, con la intención de que se realicen de manera automática”. (Definición personal)

El lenguaje más común para realizar los scripts es el Bash, que significa: Bourne Again Shell, que es el intérprete de comandos predeterminado en casi todas las distribuciones de Linux.

A script is a set of commands used to perform tasks in a programming language. In our case, we can define it much more simply: "as a text file, where we place the commands that we normally place manually in the terminal, with the intention that they are performed automatically”. (Personal definition)

The most common scripting language is Bash, which stands for: Bourne Again Shell, which is the default command interpreter in almost all Linux distributions.



La ventaja y las razones para usar los scripts:

The advantage and reasons for using scripts:

  1. Nos permite automatizar las tareas repetitivas y nos ahorra tiempo.

  2. Cuando uno hace un script, los comandos se realizan de forma automática y se evitan errores.

  3. El usuario puede crear los scripts que necesita para realizar las tareas que ejecuta normalmente, lo que le permite personalizar su trabajo.

  4. Al realizar los scripts, los usuarios de Linux aprendemos y conocemos cómo funciona realmente el sistema.

  1. It allows us to automate repetitive tasks and saves us time.

  2. When one makes a script, the commands are performed automatically and errors are avoided.

  3. The user can create the scripts he needs to perform the tasks he normally executes, allowing him to customize his work.

  4. By performing the scripts, Linux users learn and get to know how the system really works.



¿Cómo se crean los scripts?

How are the scripts created?

  1. Lo primero que tenemos que hacer es tener un editor de texto. En este punto es importante explicar que todas las distribuciones de Linux traen un editor de texto integrado; en mi caso, en Linux Mint con escritorio Mate, en el sistema viene el editor de texto “xed”. Pero dentro de la terminal, tenemos los editores de texto “Nano” y “Vim”, pero normalmente se usa el “Nano” desde la terminal.

  1. The first thing we need to do is to have a text editor. At this point it is important to explain that all Linux distributions have an integrated text editor; in my case, in Linux Mint with Mate desktop, the “xed” text editor is included in the system. But inside the terminal, we have the text editors "Nano" and "Vim“, but usually the ”Nano" is used from the terminal.


Captura de pantalla. / Screenshot.


2- Vamos a abrir nano para hacer un script que llamaremos: actualiza_sistema.sh.

2- Let's open nano to make a script that we will call: actualiza_sistema.sh .

  • Abrimos la terminal; esto lo podemos hacer de forma gráfica o a través de los atajos del teclado apretando las teclas: Ctrl+Alt+T

  • We open the terminal; we can do this graphically or through the keyboard shortcuts by pressing the keys: Ctrl+Alt+T


Captura de pantalla. / Screenshot.


  • To open nano to make the script, we will use the following command: nano actualiza_sistema.sh

Donde sucede lo siguiente: a) nano: abre el editor de texto. b) actualiza_sistema.sh: es el nombre del archivo que se va a crear. c) Se coloca la terminación “.sh” en el nombre, para indicar que el archivo es un shell script.

Where the following happens: a) nano: opens the text editor. (b) actualiza_sistema.sh : is the name of the file to be created. c) The ending “.sh” is placed in the name, to indicate that the file is a shell script.


Captura de pantalla. / Screenshot.


  • Una vez abierto nano con el nombre del archivo, ingresamos los comandos a ejecutar y los comentarios que vamos a colocar para saber qué hace el script.

  • Once nano is opened with the name of the file, we enter the commands to be executed and the comments that we are going to place to know what the script does.

Ahora explicaremos el contenido del script:

a) Primero vamos a colocar en nano: #!/bin/bash Esto indica que el archivo será ejecutado con Bash. Acá es importante informar que cuando uno coloca el signo (#) al comenzar una línea en un script, Bash toma esa línea como si fuese un comentario interno y por lo tanto no la ejecuta.

b) echo "=== Iniciando actualización del sistema ≡" El comando “echo” muestra un comentario que se ve en la terminal cuando se ejecuta el script. Funciona así: “echo” es el comando que indica el comentario y lo que está entre las "…". Es el mensaje que se lee.

c) El comando sudo apt update; se usa para descargar la lista de paquetes más recientes que esté disponible.

d) El comando sudo apt upgrade -y se usa para instalar las actualizaciones, y la flag (-y) se usa para que se ejecute la aprobación de la instalación de manera automática, sin necesidad de que el usuario apruebe apretando la letra (s).

e) El comando sudo apt autoremove -y: se usa para eliminar los paquetes que ya no son necesarios y las dependencias huérfanas.

Now we will explain the content of the script:

a) First let's place in nano: #!/bin/bash This indicates that the file will be executed with Bash. Here it is important to inform that when one places the sign (#) at the beginning of a line in a script, Bash takes that line as if it were an internal comment and therefore does not execute it.

b) echo "=== Starting system update ≡" The "echo" command displays a comment that is seen in the terminal when the script is executed. It works like this: "echo" is the command that indicates the comment and what is between the "...". This is the message that is being read.

c) The sudo apt update command; it is used to download the most recent package list that is available.

d) The sudo apt upgrade -y command is used to install the updates, and the flag (-y) is used to execute the approval of the installation automatically, without the need for the user to approve by pressing the letter (s).

e) The sudo apt autoremove -y command: is used to remove packages that are no longer needed and orphaned dependencies.


Captura de pantalla. / Screenshot.


Cierre del archivo

Closing the file

  • Una vez que tenemos el script escrito, le vamos a dar a la combinación de teclas: Ctrl + X para cerrar; después le vamos a dar a la tecla “S” para guardar y, finalmente, a la tecla “Enter” para salir.

  • Once we have the script written, we are going to give the key combination: Ctrl + X to close; then we are going to give the “S” key to save and, finally, the “Enter” key to exit.


Captura de pantalla. / Screenshot.

Permisos de ejecución

Execution permits

  1. Después de guardar los scripts, vamos a darle permiso de ejecución, y para hacerlo vamos a la terminal, ponemos el siguiente comando:

    chmod +x actualiza_sistema.sh

    y le damos a la tecla “Enter”.

  1. After saving the scripts, we are going to give it execution permission, and to do so we go to the terminal, put the following command:

    chmod +x actualiza_sistema.sh

    and hit the “Enter” key.

Captura de pantalla. / Screenshot.


Probando el script

Testing the script

  1. Ejecutamos el script para revisar su funcionamiento, y para hacerlo colocamos el siguiente comando en la terminal: ./actualiza_sistema.sh Nos va a pedir nuestra clave root, la colocamos y arranca el script.

  1. We execute the script to check its operation, and to do so we place the following command in the terminal: ./actualiza_sistema.sh It's going to ask us for our root key, we put it in and the script starts.


Captura de pantalla. / Screenshot.


Automatizar el script

Automating the script

  1. Después de que comprobamos que este script funciona bien, lo vamos a automatizar para que se ejecute solo el día y la hora que nosotros deseemos.

En mi caso, lo voy a colocar para que se ejecute de manera automática todos los días lunes a las dos de la tarde.

Vamos con un paso a paso explicado a detalle.

a) Abrimos una terminal y colocamos el comando: crontab -e Este comando abre el planificador de tareas. Ver la imagen.

Esta última línea nos interesa ya que es el formato que usaremos: m h dom mon dow command Significa lo siguiente:

m = minutos (de 0 a 59) h = hora (militar desde 1 a la 24) dom = día del mes (cubre del 1 al 31) mon = mes (cubre del 1 al 12) dow= día de la semana (cubre del 1 al 7. El 1 es el día lunes el 7 el domingo) command = comando a ejecutar.

Creamos la línea de comando. m = 0 (significa cero minutos). h = 14 (significa 2 de la tarde). dom = (significa cualquier día) mom = (significa cualquier mes) dow = 1 (significa día lunes) command= /home/osomar357/Scripts/actualiza_sistema.sh (significa que el comando debe ejecutar el script actualiza_sistema.sh, que está en la carpeta /home del usuario: osomar357).

La línea de comando completa quedaría así: 0 14 * * 1 /home/osomar357/Scripts/actualiza_sistema.sh

  1. After we verify that this script works well, we are going to automate it so that it runs only on the day and time that we want.

In my case, I'm going to set it to run automatically every Monday at two in the afternoon.

Let's go with a step by step explained in detail.

a) Open a terminal and place the command: crontab -e This command opens the task planner. See the image.

This last line interests us because it is the format we will use: m h dom mon dow command It means the following:

m = minutes (from 0 to 59) h = time (military from 1st to 24th) sun = day of the month (covers 1st to 31st) mon = month (covers 1 to 12) dow = day of the week (covers 1 to 7. The 1st is the day Monday the 7th on Sunday) command = command to execute.

We create the command line. m = 0 (means zero minutes). h = 14 (it means 2 in the afternoon). dom = (means any day) mom = (means any month) dow = 1 (it means Monday day) command= /home/osomar357/Scripts/actualiza_sistema.sh (it means that the command must execute the s

#hive-116823 #viernesdeescritorio #stem #stemsocial #linux #opensource #waivio #archon #tribes #bbh
Payout: 5.454 HBD
Votes: 371
More interactions (upvote, reblog, reply) coming soon.
Eco Bank Development

A sustainable digital wallet and profile platform.

© 2025 Eco Bank Development. All rights reserved.

Sustainable Secure