GNU/Linux >> Tutoriales Linux >  >> Debian

Curso de Ubuntu GRATUITO de 4 horas para principiantes

Es un curso de capacitación de Linux Ubuntu de 4 horas en total publicado en nuestro canal de YouTube con el nombre de Curso GRATUITO de 4 horas de Ubuntu para principiantes.

1. ¿Qué es Linux?

Linux es un sistema operativo muy conocido. En 1991, Linux fue creado por un estudiante universitario llamado Linux Torvalds. Toda la arquitectura del software está cubierta con Linux, ya que ayuda a la comunicación entre el programa informático y el hardware del sistema y también gestiona las solicitudes entre ellos. Linux es un software de código abierto. Se distingue de otros sistemas operativos de muchas maneras. Las personas con habilidades profesionales relacionadas con la programación también pueden editar su código, ya que está disponible gratuitamente para todos. Torvalds pretendía nombrar su creación como 'freaks ', pero el administrador solía distribuir el código por el nombre de pila de su creador y Unix, por lo que ese nombre se mantuvo.

2. Distribución Linux

La distribución de Linux es un tipo de sistema operativo que comprende un sistema de administración de paquetes completo con un kernel de Linux. Se puede acceder fácilmente a la distribución de Linux descargando cualquier distribución de Linux.

Un ejemplo particular de distribución de Linux incluye un kernel, diferentes bibliotecas, herramientas GNU, un entorno de escritorio completo y documentación de software adicional. El ejemplo de McDonald's es mejor para entender el concepto de distribución de Linux. McDonald's tiene múltiples franquicias en el mundo, pero los servicios y la calidad son los mismos. De igual forma, puedes descargar el sistema operativo de Linux desde otras distribuciones desde Red Hat, Debian, Ubuntu, o desde Slackware donde más o todos los comandos en la terminal serían los mismos. El ejemplo de McDonald's encaja aquí. Se puede decir que cada franquicia de McDonald's es como una distribución. Entonces, los ejemplos de distribuciones de Linux son Red Hat, Slackware, Debian y Ubuntu, etc.

3. Guía de instalación

Este tema le brindará una forma completa de instalar Ubuntu en su sistema. Siga los pasos que se indican a continuación para una instalación sin problemas de Ubuntu:

Paso 1 :Abra su navegador favorito y luego vaya a https://ubuntu.com/ y haga clic en Descargar Sección.

Paso 2 :Desde la Descarga Apartado, tienes que descargar el Ubuntu Desktop LTS .



Paso 3 :Haga clic para descargar el archivo de escritorio de Ubuntu; después de hacer clic aquí, recibirá un mensaje de agradecimiento que dice Gracias por descargar Ubuntu Desktop .



Paso 4 :Como está en Windows, debe hacer que su USB sea de arranque porque transferir directamente este sistema operativo descargado a su USN no lo hará de arranque.

Paso 5 :Puedes usar el Power ISO herramienta para este fin. Simplemente haga clic en este enlace para descargar la herramienta Power ISO https://www.poyouriso.com/download.php



Paso 6 :Use Power ISO para transferir el sistema operativo Ubuntu al USB. Hará esto mientras hace que el USB sea de arranque.

Paso 7 :reinicie su sistema y vaya al menú de inicio de su sistema presionando F11 o F12 y configure su sistema operativo desde allí.

Paso 8 :Guarde la configuración y luego reinicie su sistema nuevamente para dar la bienvenida a Ubuntu en su sistema.

4. Línea de comandos y terminal

La primera pregunta que puede surgir en su mente es, ¿por qué aprender la línea de comando? La cosa es que no puedes hacer todo con GUI; las cosas que no puede manejar con GUI se ejecutan sin problemas usando la línea de comando. En segundo lugar, puede hacerlo más rápido utilizando la línea de comandos en comparación con la GUI.

A continuación, hablará de dos cosas:Shell y Terminal. El sistema se comunica con el sistema operativo mediante el shell. Cualquier comando que escriba, el shell lo ejecutará, se comunicará con el sistema operativo y le dará un comando al sistema operativo para que haga algo que le pidió que hiciera. Luego le proporcionará los resultados. La terminal es la ventana que tomará ese comando y mostrará los resultados en sí misma. Es una herramienta que te ayuda a interactuar con el shell, y el shell te ayuda a interactuar con el sistema operativo.

Todos los comandos son los mismos para diferentes sistemas basados ​​en Linux. Si desea abrir la terminal, puede ir a buscar 'terminal ' manualmente usando la barra de búsqueda.



Hay una forma alternativa de abrir la terminal presionando 'CTRL+ALT+T '.

5. El sistema de archivos de Linux

Linux tiene una estructura de archivos basada en jerarquías. Existe en forma de árbol, y todos los archivos y otros directorios están involucrados en esta estructura. En Windows, tiene 'Carpetas'. Mientras que Linux tiene 'raíz ' como su directorio básico, y en este directorio residen todos los archivos y carpetas. Puede ver su carpeta raíz en su sistema abriendo el sistema de archivos, como se muestra a continuación. Tiene todos los archivos y carpetas debajo de él. La carpeta raíz es la carpeta principal; luego tiene subcarpetas como bin, boot, dev, etc. Si hace clic en cualquiera de estas carpetas, le mostrará diferentes directorios que residen en él, lo que demuestra que Linux tiene una estructura jerárquica.

6. Algunos comandos de ejemplo

En este tema, analizará algunos comandos de ejemplo de Linux que pueden ayudar a comprenderlo.

Presiona CTRL+ALT+T para abrir la terminal.



El primer comando es sobre el sistema de directorio de archivos de Linux. Linux tiene un sistema similar a un árbol y, por ejemplo, si desea saltar a la carpeta que está en algún lugar profundo, debe revisar cada carpeta que está vinculada a su padre. El primer comando es 'comando pwd '. pwd representa el directorio de trabajo actual . Escriba 'pwd' en su terminal y le permitirá saber el directorio actual/presente en el que está trabajando. Los resultados lo llevarán al directorio raíz o de inicio.

$ por persona



El siguiente comando a discutir es 'comando cd '. cd significa 'cambiar directorio '. Este comando se utiliza para cambiar el directorio de trabajo actual. Supongamos que desea pasar del directorio actual al escritorio. Para ello, escriba el comando que se indica a continuación en su terminal.

$ cd Escritorio



Para volver al directorio de donde vino, escriba ‘cd ..’ y presione enter.

El siguiente comando que vas a estudiar es 'comando ls'. Como se encuentra actualmente en su directorio raíz, escriba 'ls' en su terminal para obtener una lista de todas las carpetas que residen dentro del directorio raíz.

$ ls

7. Enlaces duros y enlaces blandos

En primer lugar, analicemos qué son los enlaces. Los enlaces son una forma simple pero útil de crear un acceso directo a cualquier directorio original. Los enlaces se pueden usar de muchas maneras para diferentes propósitos, como vincular bibliotecas, crear una ruta adecuada a un directorio y garantizar que los archivos estén presentes en ubicaciones constantes o no. Estos enlaces se utilizan para mantener varias copias de un solo archivo en diferentes ubicaciones. Así que estos son los cuatro usos posibles. En estos casos, los enlaces son en cierto modo atajos, pero no exactamente.

Tenemos mucho más que aprender acerca de los enlaces en lugar de simplemente crear un acceso directo a otra ubicación. Este acceso directo creado funciona como un puntero hacia la ubicación del archivo original. En el caso de Windows, cuando creas un acceso directo a cualquier carpeta y la abres. Se refiere automáticamente a la ubicación donde se creó. Existen dos tipos de enlace:enlaces blandos y enlaces duros. Los enlaces duros se utilizan para vincular archivos, no los directorios. No se pueden hacer referencia a archivos que no sean el disco de trabajo actual. Se refiere a los mismos inodos que la fuente. Estos enlaces son útiles incluso después de eliminar el archivo original. Los enlaces suaves, que también se conocen como enlaces simbólicos, se utilizan para hacer referencia a un archivo que puede estar en el mismo disco o en uno diferente y para vincular directorios. Después de la eliminación del archivo original, existe un enlace suave como un enlace utilizable roto.

Ahora vamos a crear un enlace duro. Por ejemplo, crea un archivo de texto dentro de la carpeta Documento.



Escriba algún contenido en este archivo y guárdelo como 'fileWrite' y abra la terminal desde esta ubicación.

Escriba el comando 'ls' en la terminal para ver los archivos y carpetas actuales en el directorio de trabajo.

$ ls

Esto es linuxhint.com



$ ls



En este comando 'ln', debe especificar el nombre del archivo para el que va a crear un vínculo físico y luego escribir el nombre que se le dará al archivo del vínculo físico.

$ ln fileEscribir enlace duro

Por otra parte, use el comando 'la' para verificar la existencia del enlace duro. Puede abrir este archivo para verificar si tiene el contenido del archivo original o no.

$ la





Entonces, a continuación, va a crear un enlace suave para un directorio, digamos para Documentos. Abra la terminal desde el directorio de inicio y ejecute el siguiente comando usando la terminal

$ ln -s Enlace suave Documentos

Por otra parte, use el comando 'ls' para verificar si el enlace suave se crea o no. Para su confirmación, abra el archivo y verifique el contenido del archivo.

$ ls





8. Archivo de lista 'ls'

En este tema, aprenderá a listar archivos usando el comando 'ls'. Usando el 'comando pwd Primero, verifique su directorio de trabajo actual o actual. Ahora, si desea saber qué hay dentro de este directorio, simplemente escriba 'ls' para ver una lista de archivos dentro de él.

$ pwd $ ls



Ahora, si desea verificar qué hay dentro de la carpeta Documentos, simplemente use el comando cd para tener acceso a este directorio y luego escriba 'ls' en la terminal.

$ cd Escritorio
$ ls



Hay otros métodos para ver la lista de archivos, y este método también le dará información sobre los archivos. Para esto, lo que debe hacer es escribir 'ls -l' en la terminal, y le mostrará un formato largo de los archivos que contiene la fecha y la hora de creación del archivo, los permisos del archivo con el nombre del archivo y el tamaño del archivo.

$ ls-l



También puede ver archivos ocultos en cualquier directorio. En este caso, si desea ver la lista de archivos ocultos en el directorio Documentos, escriba 'ls -a' en la terminal y presione enter. Los archivos ocultos tienen el comienzo de su nombre de archivo con '.', que es su indicación como un archivo oculto.

$ ls-a



También puede ver los archivos en la lista larga y los archivos ocultos combinan el formato. Para este propósito, puede usar el comando 'ls -al', y le dará los siguientes resultados.

$ ls-al



Use el comando 'ls -Sl' para mostrar una lista de archivos ordenados. Esta lista está ordenada según el orden descendente de su tamaño. Como en la salida, puede ver que el primer archivo tiene el tamaño de archivo más grande entre todos los demás archivos. Si dos archivos tienen el mismo tamaño, este comando los ordenará según sus nombres.

$ ls-Sl



Puede copiar esta información relacionada con los archivos que se muestran actualmente en el terminal escribiendo 'ls -lS> out.txt', out.txt es el nuevo archivo que contendrá el contenido actual en el Terminal. Ejecute este comando, compruebe el contenido del archivo out.txt abriéndolo.

$ ls -lS> salida.txt $ ls





Puede usar el comando 'man ls' para ver la descripción completa de los comandos relacionados con 'ls' y puede aplicar esos comandos para ver sus resultados en perspectiva.

$ hombre ls



9. Permisos de archivo

En este tema, analizará los privilegios de usuario o el permiso de archivo. Use el comando 'ls -l' para ver la larga lista de archivos. Aquí el formato ‘-rw-rw-r– ' se divide en tres categorías. La primera parte representa los privilegios del propietario , el segundo representa los privilegios de grupo , y el tercero es para el público .

$ ls-l



En este formato, r significa lectura, w significa escritura, d directorio y x ejecución. En este formato ‘-rw-rw-r–’, el propietario tiene los permisos de lectura y escritura; el grupo también tiene permisos de lectura y escritura, mientras que el público solo tiene permiso para leer el archivo. El permiso de estas secciones se puede cambiar usando la terminal. Para eso, puede recordar esto de que aquí usará 'u' para un usuario, 'g' para el grupo y 'o' para el público. Por ejemplo, tiene los siguientes permisos de archivo '-rw-rw-r– ' para el archivo1.txt y desea cambiar los permisos para el grupo público. Para agregar los privilegios de escritura para el grupo público, use el siguiente comando

$ chmod o+w archivo1.txt

Y presiona enter. Después de eso, vea la larga lista de archivos para confirmar los cambios.

$ ls-l



Para recuperar el privilegio de escritura otorgado al grupo público del archivo1.txt, escriba

$ chmod o-w archivo1.txt

Y luego 'ls -l' para ver los cambios.

$ ls-l



Para hacer esto para todas las porciones a la vez (si está usando este propósito educativo), antes que nada, debe saber estos números, que se van a usar en los comandos.

4 ='leer'
2 ='escribir'
1 ='ejecutar'
0 =sin permiso'

En este comando 'chmod 754 file1.txt', 7 se ocupa de los permisos del propietario, 5 se ocupa de los permisos del grupo, 4 se ocupa del público u otros usuarios. 4 muestra que el público tiene permiso para leer, 5 que es (4+1) significa que los otros grupos tienen permiso para leer y ejecutar, y 7 significa (4+2+1) que el propietario tiene todos los permisos.

10. Variables de entorno

Antes de pasar directamente a este tema, necesita saber qué es una variable.

Se considera como una ubicación de memoria que se utiliza además para almacenar un valor. El valor almacenado se utiliza para diferentes motivos. Se puede editar, mostrar y se puede volver a guardar después de eliminarlo.

Las variables de entorno tienen valores dinámicos que afectan el proceso de un programa en una computadora. Existen en todos los sistemas informáticos y sus tipos pueden variar. Puede crear, guardar, editar y eliminar estas variables. La variable de entorno da información sobre el comportamiento del sistema. Puede verificar las variables de entorno en su sistema. Abre la terminal presionando CTRL+ALT+T y escribe 'echo $PATH'

$ eco $ RUTA



Dará la ruta de una variable de entorno, como se muestra a continuación. Tenga en cuenta que en este comando 'echo $PATH', PATH distingue entre mayúsculas y minúsculas.

Para verificar el nombre de la variable de entorno del usuario, escriba 'echo $USER' y presione enter.

$ echo $USUARIO



Para verificar la variable del directorio de inicio, use el comando que se proporciona a continuación

$ echo $INICIO



De estas diferentes maneras, puede ver los valores almacenados en variables de entorno específicas. Para obtener una lista de variables que existen en su sistema, escriba 'env' y presione enter.

$ env



Le dará los siguientes resultados.


Los comandos escritos a continuación se utilizan con el propósito de crear y asignar valor a una variable.

$ NuevaVariable=abc123
$ echo $NuevaVariable



Si desea eliminar el valor de esta nueva variable, utilice el comando unset

$ unset NuevaVariable

Y luego repetirlo para ver los resultados

$ echo $NuevaVariable

11. Edición de archivos

Abra la terminal presionando CTRL+ALT+T, y luego enumere los archivos usando el comando 'ls'.

$ ls



Mostrará los nombres de archivo presentes en el directorio de trabajo actual. Por ejemplo, desea crear un archivo y luego editarlo usando la terminal, no manualmente. Para ello, escriba el contenido del archivo y escriba el nombre de archivo que desea dar.

$ echo ‘Este es un archivo”> linuxhint.txt y luego use el comando ‘ls’ para ver la lista de archivos.

$ echo ‘Este es un archivo”> linuxhint.txt $ ls



Use el siguiente comando para ver el contenido del archivo.

$ gato linuxhint.txt



Para editar el archivo usando la terminal, escriba el siguiente comando

$ nano linuxhint.txt



“Este es un archivo”
Esta es una sugerencia de Linux
Visite nuestro canal, que también se llama linuxhint



Escriba el contenido que desea agregar a este archivo y presione CTRL+O para escribirlo en el archivo y luego presione enter.

Presiona CTRL+X para salir.

También puede ver el contenido del archivo para verificar el texto editado en él.

$ gato linuxhint.txt

12. Pseudo sistema de archivos (dev proc sys)

Abre la terminal y escribe 'ls /dev', y presiona enter. Este comando le dará la lista de dispositivos que tiene el sistema. Estos no son dispositivos físicos, pero el núcleo ha hecho algunas entradas.

$ ls /desv



3
Si desea acceder al dispositivo en sí, debe recorrer el árbol de dispositivos, que es el resultado del comando anterior.
Escriba 'ls /proc' y presiona enter.

$ ls /proc





Los números aquí representan los identificadores de los procesos en ejecución. El número '1' es el primer proceso del sistema, que es 'proceso de inicio'. Use la ID del proceso para verificar su estado en su sistema. Por ejemplo, si desea verificar el estado del proceso 1, escriba 'cd /proc/1' y luego escriba 'ls' y ejecútelo.

$ cd /proc/1



Sal de ese camino usando ‘cd ..’

$cd..



A continuación, hablaremos de 'sys'. escribe el siguiente comando en tu terminal

$ cd /sys $ ls

Ahora puede ver todos los directorios importantes. Aquí es donde no puede obtener muchas configuraciones que existen dentro del kernel o sistema operativo. Puede ingresar al kernel y enumerar sus archivos también.

$ cd núcleo $ ls

Ahora puede ver una lista de banderas, procesos.



Puede ver el contenido de cualquiera de estos archivos utilizando el comando cat con 'sudo', ya que requerirá el permiso del administrador.

Introduzca su contraseña.



Aquí 0 indica que la bandera está por defecto. Establecer la bandera puede cambiar drásticamente el comportamiento del sistema.

13. Buscar archivos

El propósito de este tema es que aprenda a buscar y encontrar archivos a través de la terminal. En primer lugar, abra la terminal y use el comando 'ls', y luego, para buscar un archivo desde aquí, puede escribir

$ encontrar . archivo1.txt





puede ver el resultado del comando con todos los archivos que tienen '.' y 'archivo1'.

Para encontrar especialmente el archivo, escriba el comando.

$ sudo encontrar. -nombre “archivo1.txt”



Hay otro método para hacer esto usando el comando 'localizar'. Este comando localizará y encontrará todo lo que coincida con su palabra clave.

Si la ventana del terminal muestra un error para el comando, primero instale 'mlocate' en su sistema y luego intente este comando nuevamente.

$ sudo apt-get install mlocate

$ localizar fa

Imprimirá toda la información que contenga "fa".



14. Archivos de puntos

Los archivos de puntos son aquellos archivos que están ocultos en el sistema de archivos normal. En primer lugar, para ver una lista combinada de archivos, escriba el siguiente comando en la terminal.

$ ls-al



Aquí, puede ver que un punto representa el nombre de usuario y dos puntos representan la carpeta raíz.

Usar el comando 'ls .' dará como resultado una lista de archivos o el contenido presente en el directorio actual

$ls.





'ls ..' mostrará la carpeta de arriba, que es esencialmente el nombre de usuario en este caso.

$ls..



Para saltar al contenido de algún archivo reenviado, utilice el comando que se proporciona a continuación.

$ gato ../../etc/contraseña

Mostrará todo el contenido de este archivo passwd de etc., directamente usando puntos dobles.



15. Compresión y Descompresión

Para comprimir un archivo desde cualquier ubicación, el paso 1 es abrir la terminal desde esa ubicación o simplemente abrir la terminal y usar el comando 'cd' para convertir ese directorio en el directorio de trabajo actual.

Para comprimir cualquier archivo, escriba 'gzip filename'. En este ejemplo, comprimió un archivo llamado 'file1.txt', que está presente en el escritorio.

$ gzip archivo1.txt

Ejecute el comando para ver los resultados.



Para descomprimir este archivo, simplemente escriba el comando 'gunzip' con el nombre de archivo y la extensión '.gz' ya que es un archivo comprimido.

$ gunzip archivo1.txt.gz

Y ahora ejecuta el comando.



También puede comprimir varios archivos a la vez en una sola carpeta.

$ tar cvf compressfile.tar file1.txt newfile.txt

Aquí, c es para crear, v es para mostrar y f es para opciones de archivo. Estos comandos funcionarán de esta manera:primero, creará una carpeta comprimida, que se denomina 'compressfile' en este automóvil. En segundo lugar, agregará 'file1.txt' y 'newfile.txt' en esta carpeta.





Ejecute el comando y luego verifique compressfile.tar para ver si el archivo existe allí o no.

$ ls-l



Para descomprimir el archivo, escriba el siguiente comando en la terminal

$ tar xvf compressfile.tar

16. Comando táctil en Linux

Para crear un nuevo archivo usando la terminal, se usa un comando táctil. También se utiliza para cambiar la marca de tiempo de un archivo. Primero, escriba el comando 'ls; le dará una lista de archivos que están presentes en el directorio de trabajo actual. Desde aquí, puede ver fácilmente las marcas de tiempo de los archivos.

Primero creemos un archivo y llámelo 'bingo'

$ tocar bingo

Y luego vea la lista de archivos para confirmar su existencia.

$ ls



Y ahora, vea una larga lista de archivos para ver la marca de tiempo.

$ ls-l



Supongamos que desea cambiar la marca de tiempo de un archivo llamado "archivo1.txt". Para eso, escriba el comando táctil y defina su nombre de archivo con él.

$ toque archivo1.txt $ ls -l



Ahora, si tiene algún archivo existente llamado "archivo1.txt", este comando solo cambiará la marca de tiempo de este cambio y tendrá el mismo contenido.

17. Crear y eliminar Directorios

En este tema, aprenderá cómo puede crear y eliminar directorios en Linux. También puede llamar a esos directorios "carpetas". Ve al escritorio y abre la terminal. Escriba el siguiente comando para obtener la lista de archivos.

$ ls



Ahora cree una carpeta aquí. Para esto, puede usar el comando 'mkdir', que es el comando de creación de directorio y escribir el nombre de la carpeta con él.

$ mkdir carpeta nueva

Ejecute el comando y vuelva a enumerar los archivos para comprobar si el comando funcionó o no.

$ ls



También puede eliminar esta carpeta. Para eso, debe escribir un comando que le diga al shell que se comunique con el sistema operativo para eliminar la carpeta pero no los archivos que contiene.

$ rm -r nueva carpeta

Y luego verifique su eliminación usando el comando 'ls'.

$ ls

18. Copie, pegue, mueva y cambie el nombre de archivos en Linux

Para ejecutar todas las funciones mencionadas en este tema, en primer lugar, debe crear un archivo separado. Abre la terminal desde el escritorio.

Escriba el comando para crear un archivo.

$ tocar bingwindowslinux

Y escriba algo de contenido en él y guarde el archivo.

$ ls

esto es solo linux



Después de eso, abra la terminal nuevamente. Para copiar el contenido de este 'bingowindowslinux' a otro archivo, use el comando 'cp' con el primer nombre de archivo del que se va a copiar el contenido a otro archivo.

$ cp copia bingowindowslinux

Y luego ver la lista de archivos.

$ ls



Ahora abra el archivo 'copiar' para ver si ha copiado el contenido del archivo de 'bingowindowslinux' en sí mismo.



Para cambiar el nombre de este archivo, use el comando mover. El comando 'mover' se usa para mover el archivo de un directorio a otro, pero si opera este comando en el mismo directorio, cambiará el nombre del archivo.

$ mv copiar no copiar

Abra este archivo renombrado para ver su contenido.





Si desea cambiar la ubicación de este archivo, puede usar el comando 'mover' nuevamente definiendo la ubicación donde desea mover el archivo.

Para mover el archivo 'notcopy' al directorio raíz'~', simplemente escriba

$ mv no copiar ~

Luego ‘ls ~’ para ver los archivos del directorio raíz.

$ ls ~



19. Nombre de archivo y espacios en Linux

En primer lugar, vea los archivos en su escritorio con el comando $ ls. Si desea crear un archivo con un nombre de archivo con espacio, existe alguna modificación en el comando táctil simple.

Ejecutar el comando 'tocar archivo nuevo' creará archivos separados, como se muestra a continuación.

Para crear un archivo que tenga espacios en el nombre del archivo, considere este formato:

$ toque el archivo de ubuntu

Ejecute el comando y enumere los archivos para ver los resultados.







Si desea crear un directorio con su nombre en espacios, simplemente escriba

$ mkdir nueva carpeta

Y ejecute el comando para ver los resultados.

20. Autocompletar en Linux

En este tema, hablará sobre el autocompletado en Linux. Vaya a su escritorio y abra la terminal desde allí.

Escribe ‘cd./D’ y presiona la pestaña

$ cd ./D



Este comando da como resultado tres posibilidades de autocompletado para la 'D'.

Luego escriba 'o' y presione la pestaña NO ENTRAR, y ahora verá la posibilidad de autocompletar para la palabra 'Do'.

$ cd ./Hacer

Luego presione 'c' y tabulador; automáticamente completará la palabra porque solo existe una posibilidad para esta opción.

$ cd./Doc







También puede usar esto para los comandos. La finalización automática en los comandos le permitirá las opciones de comandos para esa palabra específica.

Escriba 'a' y luego presione tabulador. Esta acción le dará los siguientes resultados

$ a



21. Atajos de teclado

En este tema, aprenderá acerca de diferentes métodos abreviados de teclado en Linux.
CTRL+Shift+n se usa para crear una nueva carpeta.
Shift+delete para eliminar un archivo
ALT+Inicio para ir al directorio de inicio
ALT+F4 Cierra la ventana
CTRL+ALT+T para abrir la terminal.
ALT+F2 para ingresar un solo comando
CTRL+D para eliminar una línea
CTRL+C para copiar y CTRL+V para pegar.

22. Historial de línea de comandos

Puede usar el comando 'historial' para ver el historial de la línea de comandos en Linux.

$ historia





Para volver a utilizar cualquiera de los comandos de esta lista, utilice el siguiente formato

$ !496





Borrará la ventana.
Probemos con otro comando

$ historia | menos







Dará como resultado algunos de los comandos y presione enter para ver más y más del total de comandos. Este comando solo almacenará los comandos '500' y, después de eso, comenzará a desaparecer.

23. Comandos de cabeza y cola

El comando Head se usa para obtener la primera parte de la parte superior del archivo, mientras que el comando Tail se usa para obtener la última parte de la parte inferior del archivo de texto, que tiene una longitud fija.

Abre la terminal usando CTRL+ALT+T y ve al directorio del escritorio.

$ cabeza archivoartículo

Ejecute el comando para ver los resultados.



Para leer las últimas líneas del documento, utilice el siguiente comando

$ archivo de colaartículo

Este comando recuperará la última parte del documento.





Puede leer dos archivos a la vez y también extraer la parte superior e inferior de los documentos.

$ head archivosdecir archivoartículo



$ archivo de colaarchivo de ensayoartículo

24. comando wc

En este tema, aprenderá sobre el comando 'wc'. El comando Wc nos informa sobre la cantidad de caracteres, palabras y líneas de un documento.

Así que prueba este comando en tu archivo 'fileessay'.

$ wc archivoensayo

Y echa un vistazo a los valores.



Aquí, 31 representa el número de palabras, 712 el número de líneas y 4908 el número de caracteres en este documento 'filessay'.

Puede cambiar el contenido del archivo y luego usar nuevamente este comando 'wc' para ver la diferencia visible.



También puede comprobar estos atributos por separado. Por ejemplo, para conocer la cantidad de caracteres en este archivo 'fileessay', escriba el siguiente comando en la terminal.

$ wc -c archivoensayo



Use '-l' para obtener el número de líneas y '-w' para el número de palabras en este comando.

$ wc -l ensayo de archivo $ wc -w ensayo de archivo



También puede obtener el número de caracteres de la línea más larga del archivo. En esto, en primer lugar, el comando verificará la línea más larga del documento y luego le mostrará la cantidad de caracteres que tiene actualmente.

$ wc -L archivoensayo

Ejecute el comando para ver el resultado de la consulta.

25. Fuentes de paquetes y actualización

En primer lugar, ¿necesita saber qué es un paquete? Un paquete se refiere a un archivo comprimido que contiene todos los archivos que vienen con una aplicación en particular. Las últimas distribuciones de Linux tienen repositorios estándar que incluyen mucho software que desea tener en su sistema Linux. Los administradores de paquetes incorporados administran todo el procedimiento de instalación. La integridad del sistema se mantiene al garantizar que el administrador de paquetes conozca el software instalado.

Podrá descargar el software del repositorio en los siguientes casos. La primera es que el paquete no se encuentra en el repositorio, la segunda es que alguien ha desarrollado un paquete y aún no se ha lanzado, y la última razón es que necesita instalar un paquete con dependencias personalizadas u opciones que esas dependencias no son generales

Cualquier paquete se puede instalar fácilmente usando el comando sudo. Sudo es para convertirse en usuario root o superusuario. Existen ciertas tareas que no puedes realizar sin ser el superusuario; actualizar el repositorio es uno de ellos. Escriba el siguiente comando para actualizar el repositorio a través de la terminal.

$ sudo apt-obtener actualización

Ingrese su contraseña para dar permiso y luego espere a que se complete este proceso.



26. Gestión de paquetes, Buscar, Instalar, Eliminar

'apt-cache' es el comando simple que se usa para buscar un paquete a través de la terminal.

$ apt-cache buscar yum



En este comando, buscará el paquete 'yum'. Entonces, este es un comando simple para buscar cualquier nombre de paquete que desee buscar. Este comando de búsqueda mostrará todo lo relacionado con yum.

$ sudo apt-get install yum



Para desinstalar este paquete yum, simplemente puede usar el siguiente comando

$ sudo apt-get remove yum

Para eliminar cualquier paquete con sus ajustes de configuración, se utiliza el comando de purga.

$ sudo apt-get purge yum

27. Registro

En Linux, los registros se almacenan en el directorio '/var/log'. Si desea ver los archivos de registro, use el siguiente comando.

$ ls /var/registro



From the output, you can see there exist various log files in your system, like some of them are related to authorization, security, and some are related to kernel, system boot, system log, etc.

To view the content inside of these files, you have to use the ‘cat’ command with the path of the log file. Example command execution is given below.

$ cat /var/log/auth.log







The output shows all the information related to the authorization and security things you have done today, all the files and sessions in which you used your root permissions and worked as a superuser.

28. Services

This topic is about services, okay, so you are going to discuss services in Linux. First, understand the basics of the services. Services in Linux are the background tasks that are waiting to be used. These background applications or sets of applications are the set of essential tasks running in the background, and you don’t even know. An example of typical services would be apache and MySQL.

Now let’s see how you can work with services on how you can start, stop, restart, and even check the status of it or check all the services that are running on your system. First of all, you will open up your terminal by pressing CTRL+ALT+T.

here you are going to write

$ service –status-all



It will tell you about all the services which are running in the background, and ‘+’ means that the service is up and running and it is active the ‘-’ means that the service is not active and it is not running, or maybe it is unrecognized.

Let’s explore the ‘Apache’ service. First of all, you are going to write ‘service’ and then the service name, which is essentially Apache, and then you write ‘status.’

$ service apache2 status



The green dot shows that it is running, and the white dot shows that it has been stopped.

Press ‘CTRL+c’ so that you can come out of it, and you can simply write your command in the terminal.

$ service apache2 start



$ service apache2 status

$ service apache2 restart





29. Processes

The process is a computer program in action and carryout the task of the operating systems. Now, what if you want to, you know, see, or check what are the processes that are like going on your system.

$ ps



Here you can see that you have a list of the processes which are like going on. The PID is nothing but a unique process ID that is given to the process, so it is ideal for defining and identifying a process or anything any entity by the ID number. TTY is the terminal from it is running, and time is the CPU time that it has taken to run the process or complete the process, and CMD is the basic name of the process.

Let’s run an example and see how you can check out the processes and run them. If you run a process named Xlogo, you hit enter, and you can see that this is a process it takes a lot of time here, and you cannot run anything right here.



To write anything, you have to press CTRL+C. It is visible that the Xlogo window is now gone.

To shift this process into the background, what you can do is that you can write

$ xlogo &

You can see that now this process is running in the background.

30. Utilities

Utilities are also known as commands in Linux.

Utilities are also known as commands; although there is no real differentiation between a command and a utility, there is still a difference between Linux shell commands and standard Linux commands. The utility is nothing but a tool to run a command. ‘ls’, ‘chmod’, ‘mdir’ are some of the utilities used in general.

31. Kernel Modules

Kernel modules are stored in the home directory or the root folder. These are the drivers that can be loaded and unloaded as well as needed or at the boot time. The kernel is the low-level aspect of your computer that sits between the user and hardware, and its job is to how to you know, talk to CPU to communicate with the memory and the communication with the devices. It takes all the information from the application and communication with the hardware, and it also takes all the information from the hardware, and it communicates with the application, so you can say that kernel is a bridge which takes the information from the application to the hardware and from the hardware to the application. For the kernel to communicate with the hardware, it needs to have some specific modules. It needs to have a module that can tell it how to do that, and those modules are available and built-in, and a few of them can be imported. They are externally available, and you can use them as you need them.

Use the following command to check the list of the available modules in your system.

$ lsmod





So here, you can see the name of the modules in the first row, and the second row is for a module, and the third one is just the comments or the information against each driver or each kernel module.

To uninstall a module named ‘lp’, you can write

$ sudo rmmod lp

32. Adding and changing users

This topic is about adding users and changing users. When you add a user, you will add it to a specific group, or you can also create a user as if you don’t want to add it to any group then the user will you will be created and it will generate its own like sort of a unique identity and a unique group sort of thing.

Open up our terminal, so before you add a user to the group, there are a couple of things that you need to know. You should know that in which group you are going to add the user. To know which groups exist on our system, you need to write this command

$ cat /etc/group

You can see that you have several groups available. Let’s say you want to add a user to this group, so l the user name you want to name the user as John.

$ sudo useradd -d /home/john -s /bin/bash -g colord -m john



As you created the users successfully, you can write

$ cat /etc/passwd





Here you can see that you have a user named John, and this 126 is the group ID of the group ‘colord’.

33. User group and user privileges

In this topic, you are going to learn how to create and delete a user as well as a group and also discuss the user privileges.

Open up the terminal and create a user with its unique group. You can add users individually as well.

$ sudo useradd -m johny

And now confirm the existence of this user by opening the content of the ‘passwd’ file

$ cat /etc/passwd







What if you want to create another specific group, and you want to add users to that so adding users to that is very simple, and it is discussed in the previous topic. Now write a command to create a unique group so that you can add any member to it.

$ sudo groupadd Linuxusers

Check the content of the group file

$ cat /etc/group





You can also delete the group by using the ‘groupdel’ command

$ sudo groupdel Linuxusers

And again, check the group file to confirm its deletion.

$ cat /etc/group



34. Using sudo

sudo stands for ‘superuser do '. The idea is that you cannot perform certain actions without being a superuser, and you can ask why is that so? You cannot perform any installation or changes in the root folder without being a superuser because your system needs to be saved so no other user can make any changes other than you. So you have to put in your password, and you need to make your system make sure that it’s you, and then you can make changes in the root folder; otherwise, whatever commands you would write, it would give you the error or the warning. Whenever you see that permission denied message, it means that you need to work as a superuser because these changes are going to affect your root folder.

Using the sudo command, you can update your system.

$ sudo apt-obtener actualización



You can create or delete a new directory and many more actions by becoming a superuser.

$ sudo mkdir newDirectory $ ls

35. Network UI

Openup the terminal and write here the first command, which is

$ sudo ip link



Press enter and see different network interfaces. The number one is this ‘lo’, which stands for Linux host, and others are the ethernet networks. You can see there is a MAC address, which tells us that it is the ether link. If you see here we have ‘UP’, it means that it is ready and available and it can be used so up just tells you that it is available. It doesn’t mean that it is being used; it means that it is available to use. ‘LOWER_UP’ shows that a link is established at the physical layer of the network.

We will also see you know the IP addresses and how do we check them.

$ sudo ip addr



To get the information about all of the commands related to ip link, type

$ man ip link





Try some of those commands for a better understanding of the topic.

36. DNS (incomplete)

$ hostnamectl set-hostname SERVER.EXAMPLE.COM
10.0.2.15
~$ sudo nano /etc/network/interfaces
$ sudo apt-get install bind9 bind9utils
$ cd /etc/bind
$ nano etc/bind/name.conf

37. Changing nameservers

Open your terminal by using ‘CTRL+ALT+T’ and write the following command in it.

$ sudo nano /etc/resolve.conf





This is the configuration file that has been opened. Now, we are going to write ‘8.8.8.8’ and then we’re going to change another server we’re going to write here ‘8.8.4.4’ so save it, write it out, and then we exit it.

Now before doing anything, let’s let us check that if the changes have been made in the file successfully or not. Write this command ping, which is the packet internet groper, so P is for packet I for Internet, and G is for groper. It communicates between the server and the source and the server and the host. It will verify that our main service has been changed and they’re like a set.

$ ping 8.8.8.8



We have set the name server as 8.8.8.8, and now you can see we have started to get reserves; we are getting all the packets, and the communication has begun.

Press ‘CTRL+C’ and you can see it has shown us all the details about the packets which have been sent, received and the information about the packet lost.

38. Basic Troubleshooting

We are going to discuss some basic troubleshooting commands on this topic. Before everything, whenever you get to a Linux host, run the following command to know the version of the Linux.

$ uname -a



This is essential to know because of the version across different distributions of Linux; the commands might differ. But these commands will work on any Linux distribution, so the first command that we are going to discuss the ping command.

Ping is used for network reachability tests, so if you want to test the network reachability, you will write this ping command. Let’s try to send five requests, and we send it to the IP address 8.8.8.8

$ ping -c5 8.8.8.8



Now it would send like five requests, and you can see that five packets have been transmitted, and five have been received, and in that whole scenario, there is a zero percent packet loss.

You can also test the ping command on some IP address where you know there might be a packet loss or something. Give a random IP address and test the command.

$ ping 2.2.2.2



Press ‘CTRL+C’ to know the results.

Ping can also be used with the DNS name as well; you can test it with the ‘www.google.com’.

$ ping www.google.com



Now let’s discuss another command, which is ‘traceroute’. This traceroute command trace all the path of the network, and it displays you each activity on each hop.

$ traceroute 8.8.8.8



Results have shown you all the activity through every hop. There is another command that will troubleshoot commands that we would like to discuss, which is ‘dig’. let’s try digging amazon.com, so we have tried to dig amazon.com

$ dig www.amazon.com



We can get the message size, the name, server IP, QE time.

There is another command, ‘netstat’, which represents the network status statistics; it displays you all the active sockets and internet connection.

$ netstat

$ netstat -l



This command will display all the programs which are currently listening and all the internet connections which are listening as well.

39. Informational utilities

Let’s look at some utilities which could provide information about your networking subsystem. The first command is the ‘arp’ command. arp stands for address resolution protocol, so the idea is that every machine has a unique address like every DNS has a unique address in the form of an IP address similarly every machine has a unique address as well which is known as MAC address. ‘arp’ or the address resolution protocol matches the IP address with the MAC address. Locally wherever you want to communicate or you want to communicate in that case, we need a MAC address specifically for local communication from one machine to another machine on the same network or from one machine to the router on the same network.

$ arp -a



There is another informational utility, which is ‘route.’

$ route



you can see a routing table as a result of the route command execution.

You can also use another utility to view the routing table, but this one shows the IP addresses of the destination instead of its name.

$ netstat -rn

$ man netstat





40. Packet Captures

In this topic, you will learn how to capture packets, and we can do that using some packet capturing tool. The most used tool for this purpose is ‘wireshark’. Write the following command to begin its installation on your system.

$ sudo apt-get install wireshark



Enter your password when it asks for it. After that, it would ask you for the configuration of Wireshark that if you want to give access to non-superusers so you have to select yes because we want to give access to non-superusers as well and now it would start to you know unpack the packet.





After its installation, open the Wireshark software; first of all, go here on the capture options, and you can see that we have input as cisco remote capture random pattern generator and ssh remote capture, UDP listener. Select the random packet generator, and once you click start and if you do not see any of these options, ten simply restart your system. Sometimes you need to restore the system.

Run a few commands before starting the process of packet capturing and to make sure that you set everything. First of all, check the group of the Wireshark

$ sudo addgroup -system wireshark

Make sure that this group exists.

After that write another command

$ sudo setcap cap_net_raw,cap_net_admin=eip /usr/bin/dumpcap

After that, add the user to the Wireshark group.



$ sudo usermod -a -G wireshark linuxhint

Now go back to the Wireshark software, and under the same settings, you will see the packet capturing process.



41. IP Tables

In this topic, we are going to discuss IP tables. IP tables are just a set of rules which define your network’s behavior, your machine’s behavior on your network.

The command to view the IP table is given below

$ sudo iptables -L



you can see this is the first chain is the input, then the second chain that we have is the forward chain, then we have the output chain. Whatever rules you will give to this in this IP table, your machine will follow it. This input rule or the input policy is for sending that traffic to itself like your machine right now whatever input it is taking like if you send traffic you’re sending traffic from your machine to your machine is called the input chain. Whatever rules you will set here, they will be for your machine or your localhost.

Output chain would send from your machine to some other machine out there in the world or out there on the network that would be the output chain. You can set and define rules for dealing with the output traffic from here, the traffic that you’re sending from your machine to the outside world to any other machine. In this example, you are trying to send traffic from your machine to the outside world to any other machine.

For sending a packet to the local host, execute the following command

$ ping 127.0.0.1



Now let’s say we define a rule here, and we do not want to send any packet to ourselves. We define a rule, and we drop the package that we intend to send to ourselves. For that, we set a rule in the IP tables.

$ sudo iptables -A INPUT -d 127.0.0.1 -p icmp -j DROP $ sudo iptables -L



You can see that this command has been executed successfully, so now, if you check the IP tables, you can see that this is a rule that has been added to the input chain, right. You can also define rules for the OUTPUT chain. An example of this is given below.

$ sudo iptables -A OUTPUT -d 8.8.8.8 -p icmp -j DROP $ sudo iptables -L

42. SSH servers

In this topic, you are going to learn how you can enable SSH and install an open server in your system. If your system is an SSH client, then it can connect to any SSH server out there using a simple command. It can connect to any of the SSH servers, and it can use the operating system remotely. To check that if SSH is installed or enabled on your system, type ssh and press enter.

$ ssh

If you see, you know things like this.



then it means that you are an SSH client, or your machine is an SSH client.

simply if you want to connect your machine to a remote machine and you want to use it like any server out there which is hundreds of miles away from you, you can do that by writing a command like this

$ ssh username@ip -5252

SSH then the username of that server, then the IP address of that server, and then if there is a special port, you can write here.

Now you are going to learn going to connect to your localhost. It means that you are going to connect to our machine and use your operating system. First of all, check whether SSH is enabled in your system or not.

$ ssh localhost



After this step, install the open shh server on your system

$ sudo apt-get install openssh-server



$ ssh localhost





Now check the status of the SSH service by using the following command.

$ sudo service ssh status



You can also make a different kind of changes in this whole procedure. You can edit the file for that.

$ sudo nano /etc/ssh/ssh_config



43. Netcat

Netcat is a popular network security tool. It was introduced in 1995. Netcat runs as a client to initiate the connections with other computers, and it can also operate as a server or listener in some specific settings. Some common usages of Netcat are using it as a chat or messaging service or file transfers. Netcat is also used for port scanning purposes.

To know that your system has netcat or not, type the command given below in your terminal.

$ nc -h





Next, you are going to learn how to create a chat service using Netcat on a terminal.

For this, you have to open two windows of the terminal. One is then considered ad server and the other window as a client. Use the following command in the server terminal for the establishment of a connection.

$ sudo nc -l -p 23

Here 23 is the port number. At the client-side, execute the following command.

$ nc localhost 23

And here we are with our chat service.



44. Installing Apache, MySQL, Php

First of all, we are going to install Apache, but before that, update your repository

$ sudo apt-obtener actualización



After updating the repository, install apache2 on your system.

$ sudo apt-get install apache2



You can confirm its existence by checking the system services and by typing localhost in your web browser.



The next package is the PHP, so you have to write the following command on your terminal.

$ sudo apt install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php



Now, test the terminal by executing the following command.

$ php -r ‘echo “nnYour PHP iNSTALLATION IS WORKING FINE. nnn”;





Execute the following command for the installation of MySQL.

$ sudo apt-get install mysql-server

After that, run some test commands on this MySQL terminal for testing.

$ sudo mysql -u root -p

> create database testdb;> show databases;



To install PHPMyAdmin, follow these steps:

$ sudo apt-get install phpmyadmin













45. Best youtube editors

We have plenty of editors that we can install, which are best. The first one that we are going to recommend is ‘Sublime text’; then, we have ‘brackets,’ and the one you are going to install on Ubuntu is named ‘Atom’.

$ snap install atom –classic





You can open it up, and then you can open all sorts of reading web files JS files, HTML files, CSS, or PHP files, whatever files related to the web development sort of thing.

46. Bash script

Open up your terminal by pressing ‘CTRL+ALT+T’. In this window, you can write and execute commands, and you will also get the instant output for that too. Below is a simple example is given for a better understanding of a bash script.

In step 1, you can view the list of files in your current working directory. Execute the ‘ls’ command for this purpose.

Now, let’s create and edit a bash script file through the terminal. For that, write the following ‘nano’ command in your terminal.

$ nano bashscript.sh

#! /bin/bash
touch bashtextfile.txt
chmod 777 bashtextfile.txt

$ ls



Now let’s create another file using this bash script. You can use the ‘touch’ command for creating the file and ‘chmod’ for changing the file privileges.

Write out the content using ‘ctrl+o’ and exit this window. Now execute ‘bashscript.sh’ and list the files to see if the ‘bashtextfile.txt’ is created or not.



The ‘bashscript.sh’ is not executable yet. Change the file permissions of this file by the ‘chmod’ command.

$ chmod 775 bashscript.sh

‘775’ is the file privileges given to the owner, groups, and public. File privileges are already well explained in the previous topic.

$ ls



You can also write some statements using the ‘echo’ command.

$ nano bashcript.sh #! /bin/bash
touch bashtextfile.txt
chmod 777 bashtextfile.txt
echo “this is linuxhint.com”



47. Python scripts

To work with python scripts, First of all, install python3 in your system using the terminal.

$ sudo install python3

Follow the installation procedure and install it. After the successful installation of python, test it on the terminal



Write some python commands to see the results.

$ python3

$ print(‘hello World’)



There are other methods of running python using the terminal, which is considered to be the conventional one. First, create a file using the ‘.py’ extension and write all of your python code you want to execute and save the file. To execute this file, simply write the following command in the terminal, and you will get your desired results in seconds.

$ python3 pythonscript.pyPrint(‘hello world’)

$ ls

$ python pythonscript.py

48. C programs

To work with ‘C programs’ using terminal, first of all, you should know whether ‘gcc’ is installed on your system or not and what is the version of ‘gcc’. To know this thing, write the following command in the terminal.

$ gcc –version



Now install the ‘build-essential’ package in your system.

$ sudo apt install build-essential



Create a ‘c’ file using the touch command.

$ touch hello.c

List the files to check its existence.

$ ls



Write the program in this ‘hello.c’ file for which you want to get the output.

#include
int main()
{
printf(“hello World”);
return 0;
}



After that, execute the file on the terminal, using the following command.

$ gcc hello.c -o test $ ./test

Now see the desired result.





Watch FULL VIDEO Course of 4 HOURS:


Debian
  1. Instale Linux Malware Detect en Debian / Ubuntu / LinuxMint:un escáner de malware para el sistema operativo Linux

  2. ¿Administrador de tareas para Ubuntu?

  3. 10 mejores IPTV para sistema Linux/Ubuntu en 2022

  4. 7-Zip para Linux

  5. ¿No se puede falsificar el sistema de Ubuntu para mi contraseña?

Multipass:ejecute Ubuntu VMs on Demand para cualquier sistema Linux

Los 5 mejores editores de PDF gratuitos para Ubuntu Linux en 2022

Comandos básicos de Linux para principiantes

Software de edición de video gratuito VidCutter para Ubuntu Linux

Los 25 mejores programas gratuitos de imágenes médicas para el sistema Linux

Proceso de arranque de Linux:explicado paso a paso para principiantes