Terminal

Terminal Terminal

Introduction to the Terminallink image 134

Disclaimer: This post has been translated to English using a machine translation model. Please, let me know if you find any mistakes.

Post Formatlink image 135

To avoid having to post console images for every action I take, I have created the following function that receives the terminal command we want to execute and returns the output that the terminal would give us. Sometimes I will use this function, and other times I will use ! before each command, which in notebooks means that you are going to run a terminal command.

	
import subprocess
import os
last_directory = ''
def terminal(command, max_lines_output=None):
global last_directory
debug = False
str = command.split()
# Check if there are " or ' characters
for i in range(len(str)):
if debug: print(f"i = {i}, str[i] = {str[i]}")
if len(str[i]) > 0:
if str[i][0] == '"' or str[i][0] == "'":
for j in range(i+1,len(str)):
if debug: print(f" j = {j}, str[j] = {str[j]}")
if str[j][-1] == '"' or str[j][-1] == "'":
for k in range(i+1,j+1):
if debug: print(f" k = {k}, str[i] = {str[i]}, str[k] = {str[k]}")
str[i] = str[i] + " " + str[k]
if debug: print(f" k = {k}, str[i] = {str[i]}, str[k] = {str[k]}")
str[j:] = [""]
str[i] = str[i].replace('"','')
# Remove empty strings
str = [x for x in str if x != ""]
if debug:
print(str)
return
if str[0] == "cd":
last_dir = os.getcwd()
if len(str) == 1:
os.chdir('/home/wallabot')
else:
if str[1] == "-":
os.chdir(last_directory)
else:
os.chdir(str[1])
last_directory = last_dir
else:
result = subprocess.run(str, stdout=subprocess.PIPE).stdout.decode('utf-8')
if max_lines_output is not None:
result_split = result.split(' ')
print(' '.join(result_split[:max_lines_output]))
print(" ...")
print(' '.join(result_split[-5:]))
else:
print(result)
Copy

First commands to navigate the terminallink image 136

ls (list directory)link image 137

The first command we are going to see is ls (list directory) which is used to list all the files in the folder we are in.

	
import subprocess
import os
last_directory = ''
def terminal(command, max_lines_output=None):
global last_directory
debug = False
str = command.split()
# Check if there are " or ' characters
for i in range(len(str)):
if debug: print(f"i = {i}, str[i] = {str[i]}")
if len(str[i]) > 0:
if str[i][0] == '"' or str[i][0] == "'":
for j in range(i+1,len(str)):
if debug: print(f"\t j = {j}, str[j] = {str[j]}")
if str[j][-1] == '"' or str[j][-1] == "'":
for k in range(i+1,j+1):
if debug: print(f" k = {k}, str[i] = {str[i]}, str[k] = {str[k]}")
str[i] = str[i] + " " + str[k]
if debug: print(f" k = {k}, str[i] = {str[i]}, str[k] = {str[k]}")
str[j:] = [""]
str[i] = str[i].replace('"','')
# Remove empty strings
str = [x for x in str if x != ""]
if debug:
print(str)
return
if str[0] == "cd":
last_dir = os.getcwd()
if len(str) == 1:
os.chdir('/home/wallabot')
else:
if str[1] == "-":
os.chdir(last_directory)
else:
os.chdir(str[1])
last_directory = last_dir
else:
result = subprocess.run(str, stdout=subprocess.PIPE).stdout.decode('utf-8')
if max_lines_output is not None:
result_split = result.split('\n')
print('\n'.join(result_split[:max_lines_output]))
print("\t ...")
print('\n'.join(result_split[-5:]))
else:
print(result)
terminal("ls")
Copy
	
2021-02-11-Introduccion-a-Python.ipynb
2021-04-23-Calculo-matricial-con-Numpy.ipynb
2021-06-15-Manejo-de-datos-con-Pandas.ipynb
2022-09-12 Introduccion a la terminal.ipynb
2022-09-12 Introduccion a la terminal.txt
command-line-cheat-sheet.pdf
CSS.ipynb
Docker.html
Docker.ipynb
Expresiones regulares.html
Expresiones regulares.ipynb
html_files
html.ipynb
introduccion_python
movies.csv
movies.dat
notebooks_translated
__pycache__
ssh.ipynb
test.html
test.ipynb

Commands can usually receive options (flags), which are introduced with the - character. For example, let's look at ls -l, which returns the list of files in the directory we are in, but with more information.

	
terminal('ls -l')
Copy
	
total 4512
-rw-rw-r-- 1 wallabot wallabot 285898 nov 12 02:07 2021-02-11-Introduccion-a-Python.ipynb
-rw-rw-r-- 1 wallabot wallabot 78450 nov 13 00:10 2021-04-23-Calculo-matricial-con-Numpy.ipynb
-rw-rw-r-- 1 wallabot wallabot 484213 nov 13 00:44 2021-06-15-Manejo-de-datos-con-Pandas.ipynb
-rw-rw-r-- 1 wallabot wallabot 320810 dic 6 00:11 2022-09-12 Introduccion a la terminal.ipynb
-rw-rw-r-- 1 wallabot wallabot 320594 dic 6 00:04 2022-09-12 Introduccion a la terminal.txt
-rw-rw-r-- 1 wallabot wallabot 119471 oct 3 16:13 command-line-cheat-sheet.pdf
-rw-rw-r-- 1 wallabot wallabot 2660 sep 18 03:32 CSS.ipynb
-rw-rw-r-- 1 wallabot wallabot 699225 nov 27 04:16 Docker.html
-rw-rw-r-- 1 wallabot wallabot 509125 sep 22 16:48 Docker.ipynb
-rw-rw-r-- 1 wallabot wallabot 156193 nov 27 04:21 Expresiones regulares.html
-rw-rw-r-- 1 wallabot wallabot 53094 oct 2 04:57 Expresiones regulares.ipynb
drwxrwxr-x 2 wallabot wallabot 4096 nov 28 14:39 html_files
-rw-rw-r-- 1 wallabot wallabot 14775 sep 18 03:29 html.ipynb
drwxrwxr-x 3 wallabot wallabot 4096 nov 12 01:51 introduccion_python
-rw-rw-r-- 1 wallabot wallabot 446172 oct 2 04:39 movies.csv
-rw-rw-r-- 1 wallabot wallabot 522197 oct 2 04:33 movies.dat
drwxrwxr-x 2 wallabot wallabot 4096 nov 28 14:39 notebooks_translated
drwxrwxr-x 2 wallabot wallabot 4096 ago 27 03:25 __pycache__
-rw-rw-r-- 1 wallabot wallabot 586 dic 4 02:31 ssh.ipynb
-rw-rw-r-- 1 wallabot wallabot 292936 nov 9 01:46 test.html
-rw-rw-r-- 1 wallabot wallabot 260227 nov 9 01:13 test.ipynb

As we can see, we have how many bytes each file occupies, but when we have files that take up a lot of space, this is not very easy to read, so we can add the h (human) option that gives us easier to read information.

	
terminal('ls -lh')
Copy
	
total 4,5M
-rw-rw-r-- 1 wallabot wallabot 280K nov 12 02:07 2021-02-11-Introduccion-a-Python.ipynb
-rw-rw-r-- 1 wallabot wallabot 77K nov 13 00:10 2021-04-23-Calculo-matricial-con-Numpy.ipynb
-rw-rw-r-- 1 wallabot wallabot 473K nov 13 00:44 2021-06-15-Manejo-de-datos-con-Pandas.ipynb
-rw-rw-r-- 1 wallabot wallabot 314K dic 6 00:11 2022-09-12 Introduccion a la terminal.ipynb
-rw-rw-r-- 1 wallabot wallabot 314K dic 6 00:04 2022-09-12 Introduccion a la terminal.txt
-rw-rw-r-- 1 wallabot wallabot 117K oct 3 16:13 command-line-cheat-sheet.pdf
-rw-rw-r-- 1 wallabot wallabot 2,6K sep 18 03:32 CSS.ipynb
-rw-rw-r-- 1 wallabot wallabot 683K nov 27 04:16 Docker.html
-rw-rw-r-- 1 wallabot wallabot 498K sep 22 16:48 Docker.ipynb
-rw-rw-r-- 1 wallabot wallabot 153K nov 27 04:21 Expresiones regulares.html
-rw-rw-r-- 1 wallabot wallabot 52K oct 2 04:57 Expresiones regulares.ipynb
drwxrwxr-x 2 wallabot wallabot 4,0K nov 28 14:39 html_files
-rw-rw-r-- 1 wallabot wallabot 15K sep 18 03:29 html.ipynb
drwxrwxr-x 3 wallabot wallabot 4,0K nov 12 01:51 introduccion_python
-rw-rw-r-- 1 wallabot wallabot 436K oct 2 04:39 movies.csv
-rw-rw-r-- 1 wallabot wallabot 510K oct 2 04:33 movies.dat
drwxrwxr-x 2 wallabot wallabot 4,0K nov 28 14:39 notebooks_translated
drwxrwxr-x 2 wallabot wallabot 4,0K ago 27 03:25 __pycache__
-rw-rw-r-- 1 wallabot wallabot 586 dic 4 02:31 ssh.ipynb
-rw-rw-r-- 1 wallabot wallabot 287K nov 9 01:46 test.html
-rw-rw-r-- 1 wallabot wallabot 255K nov 9 01:13 test.ipynb

If we want to see hidden files, we can use the a option, which will show us all the files in a directory

	
terminal('ls -lha')
Copy
	
total 4,5M
drwxrwxr-x 6 wallabot wallabot 4,0K dic 6 00:04 .
drwxrwxr-x 5 wallabot wallabot 4,0K oct 2 03:10 ..
-rw-rw-r-- 1 wallabot wallabot 280K nov 12 02:07 2021-02-11-Introduccion-a-Python.ipynb
-rw-rw-r-- 1 wallabot wallabot 77K nov 13 00:10 2021-04-23-Calculo-matricial-con-Numpy.ipynb
-rw-rw-r-- 1 wallabot wallabot 473K nov 13 00:44 2021-06-15-Manejo-de-datos-con-Pandas.ipynb
-rw-rw-r-- 1 wallabot wallabot 314K dic 6 00:11 2022-09-12 Introduccion a la terminal.ipynb
-rw-rw-r-- 1 wallabot wallabot 314K dic 6 00:04 2022-09-12 Introduccion a la terminal.txt
-rw-rw-r-- 1 wallabot wallabot 117K oct 3 16:13 command-line-cheat-sheet.pdf
-rw-rw-r-- 1 wallabot wallabot 2,6K sep 18 03:32 CSS.ipynb
-rw-rw-r-- 1 wallabot wallabot 683K nov 27 04:16 Docker.html
-rw-rw-r-- 1 wallabot wallabot 498K sep 22 16:48 Docker.ipynb
-rw-rw-r-- 1 wallabot wallabot 153K nov 27 04:21 Expresiones regulares.html
-rw-rw-r-- 1 wallabot wallabot 52K oct 2 04:57 Expresiones regulares.ipynb
drwxrwxr-x 2 wallabot wallabot 4,0K nov 28 14:39 html_files
-rw-rw-r-- 1 wallabot wallabot 15K sep 18 03:29 html.ipynb
drwxrwxr-x 3 wallabot wallabot 4,0K nov 12 01:51 introduccion_python
-rw-rw-r-- 1 wallabot wallabot 436K oct 2 04:39 movies.csv
-rw-rw-r-- 1 wallabot wallabot 510K oct 2 04:33 movies.dat
drwxrwxr-x 2 wallabot wallabot 4,0K nov 28 14:39 notebooks_translated
drwxrwxr-x 2 wallabot wallabot 4,0K ago 27 03:25 __pycache__
-rw-rw-r-- 1 wallabot wallabot 586 dic 4 02:31 ssh.ipynb
-rw-rw-r-- 1 wallabot wallabot 287K nov 9 01:46 test.html
-rw-rw-r-- 1 wallabot wallabot 255K nov 9 01:13 test.ipynb

If what we want is for it to sort them by size, we can use the S option

	
terminal('ls -lhS')
Copy
	
total 4,5M
-rw-rw-r-- 1 wallabot wallabot 683K nov 27 04:16 Docker.html
-rw-rw-r-- 1 wallabot wallabot 510K oct 2 04:33 movies.dat
-rw-rw-r-- 1 wallabot wallabot 498K sep 22 16:48 Docker.ipynb
-rw-rw-r-- 1 wallabot wallabot 473K nov 13 00:44 2021-06-15-Manejo-de-datos-con-Pandas.ipynb
-rw-rw-r-- 1 wallabot wallabot 436K oct 2 04:39 movies.csv
-rw-rw-r-- 1 wallabot wallabot 314K dic 6 00:11 2022-09-12 Introduccion a la terminal.ipynb
-rw-rw-r-- 1 wallabot wallabot 314K dic 6 00:04 2022-09-12 Introduccion a la terminal.txt
-rw-rw-r-- 1 wallabot wallabot 287K nov 9 01:46 test.html
-rw-rw-r-- 1 wallabot wallabot 280K nov 12 02:07 2021-02-11-Introduccion-a-Python.ipynb
-rw-rw-r-- 1 wallabot wallabot 255K nov 9 01:13 test.ipynb
-rw-rw-r-- 1 wallabot wallabot 153K nov 27 04:21 Expresiones regulares.html
-rw-rw-r-- 1 wallabot wallabot 117K oct 3 16:13 command-line-cheat-sheet.pdf
-rw-rw-r-- 1 wallabot wallabot 77K nov 13 00:10 2021-04-23-Calculo-matricial-con-Numpy.ipynb
-rw-rw-r-- 1 wallabot wallabot 52K oct 2 04:57 Expresiones regulares.ipynb
-rw-rw-r-- 1 wallabot wallabot 15K sep 18 03:29 html.ipynb
drwxrwxr-x 2 wallabot wallabot 4,0K nov 28 14:39 html_files
drwxrwxr-x 3 wallabot wallabot 4,0K nov 12 01:51 introduccion_python
drwxrwxr-x 2 wallabot wallabot 4,0K nov 28 14:39 notebooks_translated
drwxrwxr-x 2 wallabot wallabot 4,0K ago 27 03:25 __pycache__
-rw-rw-r-- 1 wallabot wallabot 2,6K sep 18 03:32 CSS.ipynb
-rw-rw-r-- 1 wallabot wallabot 586 dic 4 02:31 ssh.ipynb

If we want it to show us the files sorted alphabetically but in reverse order, we must use the -r option

	
terminal('ls -lhr')
Copy
	
total 4,5M
-rw-rw-r-- 1 wallabot wallabot 255K nov 9 01:13 test.ipynb
-rw-rw-r-- 1 wallabot wallabot 287K nov 9 01:46 test.html
-rw-rw-r-- 1 wallabot wallabot 586 dic 4 02:31 ssh.ipynb
drwxrwxr-x 2 wallabot wallabot 4,0K ago 27 03:25 __pycache__
drwxrwxr-x 2 wallabot wallabot 4,0K nov 28 14:39 notebooks_translated
-rw-rw-r-- 1 wallabot wallabot 510K oct 2 04:33 movies.dat
-rw-rw-r-- 1 wallabot wallabot 436K oct 2 04:39 movies.csv
drwxrwxr-x 3 wallabot wallabot 4,0K nov 12 01:51 introduccion_python
-rw-rw-r-- 1 wallabot wallabot 15K sep 18 03:29 html.ipynb
drwxrwxr-x 2 wallabot wallabot 4,0K nov 28 14:39 html_files
-rw-rw-r-- 1 wallabot wallabot 52K oct 2 04:57 Expresiones regulares.ipynb
-rw-rw-r-- 1 wallabot wallabot 153K nov 27 04:21 Expresiones regulares.html
-rw-rw-r-- 1 wallabot wallabot 498K sep 22 16:48 Docker.ipynb
-rw-rw-r-- 1 wallabot wallabot 683K nov 27 04:16 Docker.html
-rw-rw-r-- 1 wallabot wallabot 2,6K sep 18 03:32 CSS.ipynb
-rw-rw-r-- 1 wallabot wallabot 117K oct 3 16:13 command-line-cheat-sheet.pdf
-rw-rw-r-- 1 wallabot wallabot 314K dic 6 00:04 2022-09-12 Introduccion a la terminal.txt
-rw-rw-r-- 1 wallabot wallabot 314K dic 6 00:11 2022-09-12 Introduccion a la terminal.ipynb
-rw-rw-r-- 1 wallabot wallabot 473K nov 13 00:44 2021-06-15-Manejo-de-datos-con-Pandas.ipynb
-rw-rw-r-- 1 wallabot wallabot 77K nov 13 00:10 2021-04-23-Calculo-matricial-con-Numpy.ipynb
-rw-rw-r-- 1 wallabot wallabot 280K nov 12 02:07 2021-02-11-Introduccion-a-Python.ipynb

cd (change directory)link image 138

The second command will be cd (change directory) which allows us to change directories

	
terminal('cd /home/wallabot/Documentos/')
Copy

If we now use ls again to see the files we have, we see that they change

	
terminal('cd /home/wallabot/Documentos/')
terminal('ls')
Copy
	
aprendiendo-git.pdf
balena-etcher-electron-1.7.9-linux-x64
camerasIP
Documentacion
gstreamer
gstreamer_old
jetsonNano
kaggle
Libros
nerf
prueba.txt
pytorch
wallabot
web

If instead of giving cd the directory we want to move to, we give it the character -, it will return to the previous directory where it was.

	
terminal('cd -')
Copy
	
terminal('cd -')
terminal('ls')
Copy
	
2021-02-11-Introduccion-a-Python.ipynb
2021-04-23-Calculo-matricial-con-Numpy.ipynb
2021-06-15-Manejo-de-datos-con-Pandas.ipynb
2022-09-12 Introduccion a la terminal.ipynb
2022-09-12 Introduccion a la terminal.txt
command-line-cheat-sheet.pdf
CSS.ipynb
Docker.html
Docker.ipynb
Expresiones regulares.html
Expresiones regulares.ipynb
html_files
html.ipynb
introduccion_python
movies.csv
movies.dat
notebooks_translated
__pycache__
ssh.ipynb
test.html
test.ipynb

If we wanted to move to the home, just entering cd in the terminal will take us there.

	
terminal('cd')
Copy

pwd (print working directory)link image 139

To obtain the directory we are in, we can use pwd (print working directory)

	
terminal('cd')
terminal('pwd')
Copy
	
/home/wallabot

We can move using the cd command via relative paths and absolute paths. For example, let's move to a directory using an absolute path.

	
terminal('cd /home/wallabot/Documentos/')
Copy
	
terminal('cd /home/wallabot/Documentos/')
terminal('pwd')
Copy
	
/home/wallabot/Documentos
	
terminal('ls')
Copy
	
aprendiendo-git.pdf
balena-etcher-electron-1.7.9-linux-x64
camerasIP
Documentacion
gstreamer
gstreamer_old
jetsonNano
kaggle
Libros
nerf
prueba.txt
pytorch
wallabot
web

We can move using relative paths if we only provide the address from the point where we are located.

	
terminal('cd web')
Copy
	
terminal('cd web')
terminal('pwd')
Copy
	
/home/wallabot/Documentos/web

We can also go up one directory using relative paths with ..

	
terminal('cd ..')
Copy
	
terminal('cd ..')
terminal('pwd')
Copy
	
/home/wallabot/Documentos

If instead of .. we use ., we are referring to the directory we are currently in. That is, if we use cd ., we will not move because we are telling the terminal to go to the directory we are in.

	
terminal('cd .')
Copy
	
terminal('cd .')
terminal('pwd')
Copy
	
/home/wallabot/Documentos

Let's move to a path where we have files to display the following command

	
terminal('cd web/portafolio/posts/')
Copy
	
terminal('cd web/portafolio/posts/')
terminal('ls')
Copy
	
2021-02-11-Introduccion-a-Python.ipynb
2021-04-23-Calculo-matricial-con-Numpy.ipynb
2021-06-15-Manejo-de-datos-con-Pandas.ipynb
2022-09-12 Introduccion a la terminal.ipynb
2022-09-12 Introduccion a la terminal.txt
command-line-cheat-sheet.pdf
CSS.ipynb
Docker.html
Docker.ipynb
Expresiones regulares.html
Expresiones regulares.ipynb
html_files
html.ipynb
introduccion_python
movies.csv
movies.dat
notebooks_translated
__pycache__
ssh.ipynb
test.html
test.ipynb

Information of files with filelink image 140

If I don't know what type of file a particular one is, I can get a description using the file command

	
terminal('file 2021-02-11-Introduccion-a-Python.ipynb')
Copy
	
2021-02-11-Introduccion-a-Python.ipynb: UTF-8 Unicode text, with very long lines

Manipulating files and directorieslink image 141

Let's move first to the home.

	
terminal('cd /home/wallabot/Documentos/')
Copy

Directory Tree with treelink image 142

We can see the entire structure of the folder we are in using the tree command.

	
terminal('cd /home/wallabot/Documentos/')
terminal('tree', max_lines_output=20)
Copy
	
.
├── aprendiendo-git.pdf
├── balena-etcher-electron-1.7.9-linux-x64
│   └── balenaEtcher-1.7.9-x64.AppImage
├── camerasIP
│   ├── camerasIP.py
│   ├── camerasIP.sh
│   ├── config.py
│   ├── __pycache__
│   │   ├── config.cpython-38.pyc
│   │   └── config.cpython-39.pyc
│   └── README.md
├── Documentacion
│   ├── Curriculum Vitae (5).pdf
│   ├── Firma Pris.PNG
│   └── Firma.png
├── gstreamer
│   ├── basic_tutorial_c
│   │   ├── basic_tutorial_1_hello_world
│   │   │   ├── basic-tutorial-1
...
├── upload_page.py
└── utils.py
873 directories, 119679 files

But at the output, we have too many lines, and this is because tree is a command that shows all the files from the path we are in, making it a bit hard to read. However, with the L option, we can specify how many levels we want it to go deep.

	
terminal('tree -L 2')
Copy
	
.
├── aprendiendo-git.pdf
├── balena-etcher-electron-1.7.9-linux-x64
│   └── balenaEtcher-1.7.9-x64.AppImage
├── camerasIP
│   ├── camerasIP.py
│   ├── camerasIP.sh
│   ├── config.py
│   ├── __pycache__
│   └── README.md
├── Documentacion
│   ├── Curriculum Vitae (5).pdf
│   ├── Firma Pris.PNG
│   └── Firma.png
├── gstreamer
│   ├── basic_tutorial_c
│   └── README.md
├── gstreamer_old
│   ├── basic_tutorial_c
│   └── basic_tutorial_python
├── jetsonNano
│   ├── apuntes-Jetson-Nano
│   ├── deepstream_apps
│   ├── deepstream_nano
│   └── Digital zoom
├── kaggle
│   └── hubmap
├── Libros
│   └── aprendiendo-git.pdf
├── nerf
│   └── instant-ngp
├── prueba.txt
├── pytorch
│   └── Curso_Pytorch
├── wallabot
│   ├── Microfono - Blue Yeti X
│   ├── placa base - Asus prime x570-p
│   └── Silla - Corsair T3 Rush
└── web
├── jupyter-to-html
├── jupyter-translator
├── portafolio
└── wordpress_api_rest
30 directories, 12 files

We can see that it shows there are 30 directories and 12 files, whereas previously it indicated 873 directories, 119679 files.

Create directories with mkdir (make directory)link image 143

If we want to create a new directory, we can use the mkdir (make directory) command followed by a name

	
terminal("cd /home/wallabot/Documentos/web/portafolio/posts/")
Copy
	
terminal("cd /home/wallabot/Documentos/web/portafolio/posts/")
terminal('mkdir prueba')
Copy
	
	
terminal('ls')
Copy
	
2021-02-11-Introduccion-a-Python.ipynb
2021-04-23-Calculo-matricial-con-Numpy.ipynb
2021-06-15-Manejo-de-datos-con-Pandas.ipynb
2022-09-12 Introduccion a la terminal.ipynb
2022-09-12 Introduccion a la terminal.txt
command-line-cheat-sheet.pdf
CSS.ipynb
Docker.html
Docker.ipynb
Expresiones regulares.html
Expresiones regulares.ipynb
html_files
html.ipynb
introduccion_python
movies.csv
movies.dat
notebooks_translated
prueba
__pycache__
ssh.ipynb
test.html
test.ipynb

If we want to create a directory with spaces in the name, we need to put the name in quotes.

	
terminal('mkdir "directorio prueba"')
Copy
	
	
terminal('ls')
Copy
	
2021-02-11-Introduccion-a-Python.ipynb
2021-04-23-Calculo-matricial-con-Numpy.ipynb
2021-06-15-Manejo-de-datos-con-Pandas.ipynb
2022-09-12 Introduccion a la terminal.ipynb
2022-09-12 Introduccion a la terminal.txt
command-line-cheat-sheet.pdf
CSS.ipynb
directorio prueba
Docker.html
Docker.ipynb
Expresiones regulares.html
Expresiones regulares.ipynb
html_files
html.ipynb
introduccion_python
movies.csv
movies.dat
notebooks_translated
prueba
__pycache__
ssh.ipynb
test.html
test.ipynb

Let's go inside the prueba folder that we have created, to continue viewing the terminal there.

	
terminal("cd prueba")
Copy

Create files with touchlink image 144

In case we want to create a file, the command we have to use is touch

	
terminal("cd prueba")
terminal("touch prueba.txt")
Copy
	
	
terminal("ls")
Copy
	
prueba.txt

Copy Files with cp (copy)link image 145

If we want to copy a file, we do it using the cp (copy) command

	
terminal("cp prueba.txt prueba_copy.txt")
Copy
	
	
terminal("ls")
Copy
	
prueba_copy.txt
prueba.txt

Move files with mv (move)link image 146

If what we want is to move it, what we use is the mv (move) command

	
terminal("mv prueba.txt ../prueba.txt")
Copy
	
	
terminal("ls")
Copy
	
prueba_copy.txt
	
terminal("ls ../")
Copy
	
2021-02-11-Introduccion-a-Python.ipynb
2021-04-23-Calculo-matricial-con-Numpy.ipynb
2021-06-15-Manejo-de-datos-con-Pandas.ipynb
2022-09-12 Introduccion a la terminal.ipynb
2022-09-12 Introduccion a la terminal.txt
command-line-cheat-sheet.pdf
CSS.ipynb
directorio prueba
Docker.html
Docker.ipynb
Expresiones regulares.html
Expresiones regulares.ipynb
html_files
html.ipynb
introduccion_python
movies.csv
movies.dat
notebooks_translated
prueba
prueba.txt
__pycache__
ssh.ipynb
test.html
test.ipynb

Rename files with mv (move)link image 147

The mv command also helps us rename files, as moving them within the same directory but giving them a different name ultimately renames the file.

	
terminal("mv prueba_copy.txt prueba_move.txt")
Copy
	
	
terminal("ls")
Copy
	
prueba_move.txt

Delete files with rm (remove)link image 148

To delete files or directories we use the rm (remove) command

	
terminal("rm prueba_move.txt")
Copy
	
	
terminal("ls")
Copy
	

Delete directories with rm -r (remove recursive)link image 149

If what we want is to delete a directory with files inside, we must use the -r flag.

	
terminal("cd ..")
Copy
	
terminal("cd ..")
terminal('rm -r "directorio prueba"')
Copy
	
	
terminal("ls")
Copy
	
2021-02-11-Introduccion-a-Python.ipynb
2021-04-23-Calculo-matricial-con-Numpy.ipynb
2021-06-15-Manejo-de-datos-con-Pandas.ipynb
2022-09-12 Introduccion a la terminal.ipynb
2022-09-12 Introduccion a la terminal.txt
command-line-cheat-sheet.pdf
CSS.ipynb
Docker.html
Docker.ipynb
Expresiones regulares.html
Expresiones regulares.ipynb
html_files
html.ipynb
introduccion_python
movies.csv
movies.dat
notebooks_translated
prueba
prueba.txt
__pycache__
ssh.ipynb
test.html
test.ipynb

As you can see it never asks if we are sure, to make it ask we need to add the flag -i (interactive)

	
terminal("rm -i prueba.txt")
Copy
	
rm: ¿borrar el fichero regular vacío 'prueba.txt'? (s/n) s

Synchronize files using rsynclink image 150

So far we have seen how to copy, move, and delete files, but let's suppose we have a folder and we copy those files to another one. Now let's suppose we modify a file in the first folder and we want the second one to have the changes. We have two options, copy all the files again, or synchronize them using rsync

First, let's create a new folder in which we will create several files

	
!mkdir sourcefolder
!touch sourcefolder/file1 sourcefolder/file2 sourcefolder/file3
Copy

Now we create a second folder which is the one we are going to synchronize with the first one.

	
!mkdir sourcefolder
!touch sourcefolder/file1 sourcefolder/file2 sourcefolder/file3
!mkdir syncfolder
Copy
	
!mkdir sourcefolder
!touch sourcefolder/file1 sourcefolder/file2 sourcefolder/file3
!mkdir syncfolder
!echo "ls sourcefolder:" && ls sourcefolder && echo "ls syncfolder:" && ls syncfolder
Copy
	
ls sourcefolder:
file1 file2 file3
ls syncfolder:

We synchronize the two folders with rsync, the first time it will only copy the files from the first folder to the second. To do this, we must also add the -r (recursive) flag.

	
!rsync -r sourcefolder/ syncfolder/
Copy
	
!rsync -r sourcefolder/ syncfolder/
!echo "ls sourcefolder:" && ls sourcefolder && echo "ls syncfolder:" && ls syncfolder
Copy
	
ls sourcefolder:
file1 file2 file3
ls syncfolder:
file1 file2 file3

If I now create a new file in sourcefolder and sync again, only that file will be copied to syncfolder. To see that only one file is copied, we can use the -v (verbose) flag.

	
!touch sourcefolder/file4
Copy
	
!touch sourcefolder/file4
!rsync -r -v sourcefolder/ syncfolder/
Copy
	
sending incremental file list
file1
file2
file3
file4
sent 269 bytes received 92 bytes 722.00 bytes/sec
total size is 0 speedup is 0.00

But it seems that it has copied all the files, so to prevent this from happening and to copy only the ones that have been modified, you need to use the -u flag.

	
!touch sourcefolder/file5
Copy
	
!touch sourcefolder/file5
!rsync -r -v -u sourcefolder/ syncfolder/
Copy
	
sending incremental file list
file5
sent 165 bytes received 35 bytes 400.00 bytes/sec
total size is 0 speedup is 0.00
	
!echo "ls sourcefolder:" && ls sourcefolder && echo "ls syncfolder:" && ls syncfolder
Copy
	
ls sourcefolder:
file1 file2 file3 file4 file5
ls syncfolder:
file1 file2 file3 file4 file5

What happens if I create a new file in syncfolder?

	
!touch syncfolder/file6
Copy
	
!touch syncfolder/file6
!rsync -r -v -u sourcefolder/ syncfolder/
Copy
	
sending incremental file list
sent 122 bytes received 12 bytes 268.00 bytes/sec
total size is 0 speedup is 0.00
	
!echo "ls sourcefolder:" && ls sourcefolder && echo "ls syncfolder:" && ls syncfolder
Copy
	
ls sourcefolder:
file1 file2 file3 file4 file5
ls syncfolder:
file1 file2 file3 file4 file5 file6

It doesn't sync it, so it's important to keep this in mind

Some important flags to keep in mind are:

  • -a: This flag is a shortcut for several options, including -r (recursive), -l (copy symbolic links), -p (preserve permissions), -t (preserve modification time), and -g (preserve group). This option is useful for making an exact copy of a directory, including all its subdirectories and files.* -v: This flag activates verbose output, which shows the files being copied and the progress of the operation. * -r: This flag is used to copy recursively, which means it copies all subfolders and files within a directory. * -u: This flag is used to copy only the new or modified files. If a file already exists at the destination and is more recent than the source file, it is not copied. * -n: This flag is used to perform a dry run, which means no changes are made to the destination. * --exclude: This flag is used to exclude specific files or folders from the copy operation. You can specify multiple files or folders to exclude by using this option multiple times. * -z: This flag is used to compress the data during transfer, which reduces the bandwidth used and speeds up the transfer rate.* -h: this flag is used to display information in a more readable format, especially when working with large amounts of data or large file sizes.

We delete the two created folders

	
!rm -r sourcefolder syncfolder
Copy

Exploring the Content of the Fileslink image 151

To avoid having to open a file from a graphical interface, we have several ways. First, I am going to copy a text file into this folder.

	
!rm -r sourcefolder syncfolder
terminal("cd prueba")
Copy
	
!rm -r sourcefolder syncfolder
terminal("cd prueba")
terminal("cp ../2021-02-11-Introduccion-a-Python.ipynb .")
Copy
	
	
terminal("ls")
Copy
	
2021-02-11-Introduccion-a-Python.ipynb

File Header with headlink image 152

The first command to be able to look inside a text file is head, which allows us to see the first 10 lines of a file, but if you use the -n flag you can indicate the number of lines.

	
terminal("head 2021-02-11-Introduccion-a-Python.ipynb")
Copy
	
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "dsaKCKL0IxZl"
},
"source": [
"# Introducción a Python"
]
	
terminal("head -n 5 2021-02-11-Introduccion-a-Python.ipynb")
Copy
	
{
"cells": [
{
"cell_type": "markdown",
"metadata": {

End of a file with taillink image 153

In case you want to see the last lines, we use tail

	
terminal("tail 2021-02-11-Introduccion-a-Python.ipynb")
Copy
	
},
"vscode": {
"interpreter": {
"hash": "d5745ab6aba164e1152437c779991855725055592b9f2bdb41a4825db7168d26"
}
}
},
"nbformat": 4,
"nbformat_minor": 0
}
	
terminal("tail -n 5 2021-02-11-Introduccion-a-Python.ipynb")
Copy
	
}
},
"nbformat": 4,
"nbformat_minor": 0
}

If we want to continuously see the latest lines of a file, for example, we want to continuously monitor a LOG file to see events, we add the -f flag, this will make the terminal continuously check the file, and each time a new line appears in it, it will display it.

For example, if I monitor the login log on my machine

	
!tail -f /var/log/auth.log
Copy
	
Dec 1 16:27:22 wallabot gcr-prompter[1457]: Gcr: calling the PromptDone method on /org/gnome/keyring/Prompt/p2@:1.26, and ignoring reply
Dec 1 16:27:22 wallabot gnome-keyring-daemon[1178]: asked to register item /org/freedesktop/secrets/collection/login/10, but it's already registered
Dec 1 16:27:26 wallabot systemd-logind[835]: Watching system buttons on /dev/input/event28 (Logitech Wireless Mouse MX Master 3)
Dec 1 16:27:33 wallabot gcr-prompter[1457]: Gcr: 10 second inactivity timeout, quitting
Dec 1 16:27:33 wallabot gcr-prompter[1457]: Gcr: unregistering prompter
Dec 1 16:27:33 wallabot gcr-prompter[1457]: Gcr: disposing prompter
Dec 1 16:27:33 wallabot gcr-prompter[1457]: Gcr: finalizing prompter
Dec 1 16:27:34 wallabot polkitd(authority=local): Operator of unix-session:1 successfully authenticated as unix-user:wallabot to gain TEMPORARY authorization for action org.debian.apt.install-or-remove-packages for system-bus-name::1.96 [/usr/bin/python3 /usr/bin/update-manager --no-update --no-focus-on-map] (owned by unix-user:wallabot)
Dec 1 16:27:42 wallabot systemd-logind[835]: Watching system buttons on /dev/input/event30 (T9-R (AVRCP))
Dec 1 16:27:49 wallabot gnome-keyring-daemon[1178]: asked to register item /org/freedesktop/secrets/collection/login/2, but it's already registered

We see in the last two lines my login when I turned on my computer today.

Now I connect to my own machine via SSH

	
!ssh localhost
Copy
	
wallabot@localhost's password:
Welcome to Ubuntu 20.04.5 LTS (GNU/Linux 5.15.0-53-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
1 device has a firmware upgrade available.
Run `fwupdmgr get-upgrades` for more information.
Se pueden aplicar 0 actualizaciones de forma inmediata.
Your Hardware Enablement Stack (HWE) is supported until April 2025.
*** System restart required ***
Last login: Sun May 8 02:18:09 2022 from 192.168.1.147

In the console where I was monitoring the login, two new lines have appeared

	
Copy
	
Dec 1 16:32:23 wallabot sshd[25647]: Accepted password for wallabot from 127.0.0.1 port 54668 ssh2
Dec 1 16:32:23 wallabot sshd[25647]: pam_unix(sshd:session): session opened for user wallabot by (uid=0)
Dec 1 16:32:23 wallabot systemd-logind[835]: New session 4 of user wallabot.

And when I close the SSH session, two new lines appear.

	
Copy
	
Dec 1 16:33:52 wallabot sshd[25647]: pam_unix(sshd:session): session closed for user wallabot
Dec 1 16:33:52 wallabot systemd-logind[835]: Session 4 logged out. Waiting for processes to exit.
Dec 1 16:33:52 wallabot systemd-logind[835]: Removed session 4.

The most powerful file viewer: lesslink image 154

One of the most powerful commands to view inside files is less

	
terminal("less 2021-02-11-Introduccion-a-Python.ipynb", max_lines_output=20)
Copy
	
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "dsaKCKL0IxZl"
},
"source": [
"# Introducción a Python"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Ho_8zgIiI0We"
},
"source": [
"## 1. Resumen"
]
},
...
},
"nbformat": 4,
"nbformat_minor": 0
}

Being inside a notebook, you can't really see what happens when using less, but when we use it, we enter the document, and we can navigate through it using the keyboard or the mouse. If we want to search for something within the document, we write the character / and what we want to search for. To switch between the different instances it has found, we press the n key, and if we want to go back in the searches, we press shift+n. To exit, just press q

The cat viewerlink image 155

It does not allow you to browse the file or perform searches.

	
terminal("cat 2021-02-11-Introduccion-a-Python.ipynb", max_lines_output=20)
Copy
	
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "dsaKCKL0IxZl"
},
"source": [
"# Introducción a Python"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Ho_8zgIiI0We"
},
"source": [
"## 1. Resumen"
]
},
...
},
"nbformat": 4,
"nbformat_minor": 0
}

Default system editor xdg-openlink image 156

If we want to open it with the file's default editor, we need to use xdg-open

	
terminal("xdg-open 2021-02-11-Introducción-a-Python.ipynb")
Copy
	

File manager nautiluslink image 157

If what we want is to open the folder we are in, we use nautilus

	
terminal("nautilus")
Copy
	

And if what we want is for it to open in a specific path, the path is included.

	
terminal("nautilus ~/")
Copy
	

Word count of a file with wc (word count)link image 158

Finally, a very useful command is wc (word count), which shows you how many lines, words, and bytes a file has

	
terminal("wc 2021-02-11-Introduccion-a-Python.ipynb")
Copy
	
11678 25703 285898 2021-02-11-Introduccion-a-Python.ipynb

As we can see, the file has 11678 lines, 25703 words, and occupies 285898 bytes.

What is a commandlink image 159

A command can be four things* An executable program, these are usually stored in the /usr/bin path* A shell command * A shell function * An alias

To see which class a command belongs to, we use type

	
!type cd
Copy
	
cd is a shell builtin
	
!type mkdir
Copy
	
mkdir is /usr/bin/mkdir
	
!type ls
Copy
	
ls is /usr/bin/ls

What is an alias?link image 160

An alias is a command that we define ourselves, it is defined using the alias command. For example, we are going to create the alias l that will perform ls -h

	
!alias l='ls -l'
Copy

When we execute l, it shows us the result of ls -h.

	
!alias l='ls -l'
!l
Copy
	
2021-02-11-Introducción-a-Python.ipynb

But this has the problem that when we close the terminal, the alias disappears. Later we will learn how to create permanent alias.

Command Helplink image 161

Help with helplink image 162

With many shell commands, we can get their help using the help command

	
!help cd
Copy
	
cd: cd [-L|[-P [-e]]] [dir]
Modifica el directorio de trabajo del shell.
Modifica el directorio actual a DIR. DIR por defecto es el valor de la
variable de shell HOME.
La variable CDPATH define la ruta de búsqueda para el directorio que
contiene DIR. Los nombres alternativos de directorio en CDPATH se
separan con dos puntos (:). Un nombre de directorio nulo es igual que
el directorio actual. Si DIR comienza con una barra inclinada (/),
entonces no se usa CDPATH.
Si no se encuentra el directorio, y la opción del shell "cdable_vars"
está activa, entonces se trata la palabra como un nombre de variable.
Si esa variable tiene un valor, se utiliza su valor para DIR.
Opciones:
-L fuerza a seguir los enlaces simbólicos: resuelve los enlaces
simbólicos en DIR después de procesar las instancias de ".."
-P usa la estructura física de directorios sin seguir los enlaces
simbólicos: resuelve los enlaces simbólicos en DIR antes de procesar
las instancias de ".."
-e si se da la opción -P y el directorio actual de trabajo no se
puede determinar con éxito, termina con un estado diferente de cero.
La acción por defecto es seguir los enlaces simbólicos, como si se
especificara "-L".
".." se procesa quitando la componente del nombre de la ruta inmediatamente
anterior hasta una barra inclinada o el comienzo de DIR.
Estado de Salida:
Devuelve 0 si se cambia el directorio, y si $PWD está definido como
correcto cuando se emplee -P; de otra forma es diferente a cero.

Manual with manlink image 163

Another command is man, which refers to the user manual.

	
terminal("man ls", max_lines_output=20)
Copy
	
LS(1) User Commands LS(1)
NAME
ls - list directory contents
SYNOPSIS
ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is speci‐
fied.
Mandatory arguments to long options are mandatory for short options
too.
-a, --all
do not ignore entries starting with .
-A, --almost-all
...
Full documentation at: <https://www.gnu.org/software/coreutils/ls>
or available locally via: info '(coreutils) ls invocation'
GNU coreutils 8.30 September 2019 LS(1)

To exit, press q, as man uses less as the manual viewer

Information with infolink image 164

Another command is info

	
terminal("info ls", max_lines_output=20)
Copy
	
File: coreutils.info, Node: ls invocation, Next: dir invocation, Up: Directory listing
10.1 ‘ls’: List directory contents
==================================
The ‘ls’ program lists information about files (of any type, including
directories). Options and file arguments can be intermixed arbitrarily,
as usual.
For non-option command-line arguments that are directories, by
default ‘ls’ lists the contents of directories, not recursively, and
omitting files with names beginning with ‘.’. For other non-option
arguments, by default ‘ls’ lists just the file name. If no non-option
argument is specified, ‘ls’ operates on the current directory, acting as
if it had been invoked with a single argument of ‘.’.
By default, the output is sorted alphabetically, according to the
locale settings in effect.(1) If standard output is a terminal, the
output is in columns (sorted vertically) and control characters are
output as question marks; otherwise, the output is listed one per line
...
‘--show-control-chars’
Print nongraphic characters as-is in file names. This is the
default unless the output is a terminal and the program is ‘ls’.

To exit, press q, as info uses less as the information viewer.

Information about a command with whatislink image 165

Another command is whatis

	
terminal("whatis ls")
Copy
	
ls (1) - list directory contents

Wildcardslink image 166

Wildcards are special characters that help us perform special searches. For example, if I want to search for all files ending in .txt. Let's create a few files to see them.

	
terminal("touch file.txt dot.txt dot2.txt index.html datos1 datos123 Abc")
Copy
	
	
terminal("ls")
Copy
	
2021-02-11-Introduccion-a-Python.ipynb
Abc
datos1
datos123
dot2.txt
dot.txt
file.txt
index.html

All characters *link image 167

Let's now search for all .txt files

	
!ls *.txt
Copy
	
dot2.txt dot.txt file.txt

Let's now search for all that start with the word datos

	
!ls datos*
Copy
	
datos1 datos123

Numbers ?link image 168

But what if we actually want to show all the files that start with the word datos but are followed only by a number? We need to use a question mark ?.

	
!ls datos?
Copy
	
datos1

If what we want is for it to have three numbers, then we have to put three question marks ???

	
!ls datos???
Copy
	
datos123

Uppercase [[:upper:]]link image 169

If we want it to search for files that start with uppercase letters

	
!ls [[:upper:]]*
Copy
	
Abc

Lowercase [[:lower:]]link image 170

For files that start with lowercase.

	
!ls [[:lower:]]*
Copy
	
datos1 datos123 dot2.txt dot.txt file.txt index.html

Classeslink image 171

By using brackets, we can create classes; thus, if we want to search for files that start with the letters d or f followed by any character

	
!ls [df]*
Copy
	
datos1 datos123 dot2.txt dot.txt file.txt

Redirections: how the shell workslink image 172

A command works as follows pipeline command It has a standard input, which by default is the text we enter through the keyboard, a standard output, which by default is the text that comes out on the console, and a standard error which is also by default a text that comes out on the console, but has a different format.

Redirecting standard outputlink image 173

But with the > character, we can modify the standard output of a command. For example, if we want to list the files in the current directory with ls, but we don't want the result to be printed on the screen, instead, we want it to be saved in a file, we would do the following ls > lista.txt, this writes the list to lista.txt, and if lista.txt does not exist, it creates it.

	
!ls > lista.txt
Copy

We see that the file has been created and we see what is inside.

	
!ls > lista.txt
terminal("ls")
Copy
	
2021-02-11-Introduccion-a-Python.ipynb
Abc
datos1
datos123
dot2.txt
dot.txt
file.txt
index.html
lista.txt
	
terminal("cat lista.txt")
Copy
	
2021-02-11-Introduccion-a-Python.ipynb
Abc
datos1
datos123
dot2.txt
dot.txt
file.txt
index.html
lista.txt

We see that lista.txt appears within lista.txt, that's because it first creates the file and then executes the command.

We do the same, but with the parent folder

	
!ls ../ > lista.txt
Copy

If we look inside lista.txt again

	
!ls ../ > lista.txt
terminal("cat lista.txt")
Copy
	
2021-02-11-Introduccion-a-Python.ipynb
2021-04-23-Calculo-matricial-con-Numpy.ipynb
2021-06-15-Manejo-de-datos-con-Pandas.ipynb
2022-09-12 Introduccion a la terminal.ipynb
2022-09-12 Introduccion a la terminal.txt
command-line-cheat-sheet.pdf
CSS.ipynb
Docker.html
Docker.ipynb
Expresiones regulares.html
Expresiones regulares.ipynb
html_files
html.ipynb
introduccion_python
movies.csv
movies.dat
notebooks_translated
prueba
__pycache__
ssh.ipynb
test.html
test.ipynb

We see that the content is overwritten

If what we want is to concatenate the content, we should use >>

	
!ls > lista.txt
Copy
	
!ls > lista.txt
!ls ../ >> lista.txt
Copy
	
!ls > lista.txt
!ls ../ >> lista.txt
terminal("cat lista.txt")
Copy
	
2021-02-11-Introduccion-a-Python.ipynb
Abc
datos1
datos123
dot2.txt
dot.txt
file.txt
index.html
lista.txt
2021-02-11-Introduccion-a-Python.ipynb
2021-04-23-Calculo-matricial-con-Numpy.ipynb
2021-06-15-Manejo-de-datos-con-Pandas.ipynb
2022-09-12 Introduccion a la terminal.ipynb
2022-09-12 Introduccion a la terminal.txt
command-line-cheat-sheet.pdf
CSS.ipynb
Docker.html
Docker.ipynb
Expresiones regulares.html
Expresiones regulares.ipynb
html_files
html.ipynb
introduccion_python
movies.csv
movies.dat
notebooks_translated
prueba
__pycache__
ssh.ipynb
test.html
test.ipynb

Now the information has been concatenated

This is very useful for creating log files

Redirecting standard errorlink image 174

If we perform an incorrect operation, we get an error. Let's see what happens when we redirect a command that gives an error.

	
!ls fjhdsalkfs > lista.txt
Copy
	
ls: no se puede acceder a 'fjhdsalkfs': No existe el archivo o el directorio

As we can see, it has given an error, but if we now look inside lista.txt

	
terminal("cat lista.txt")
Copy
	

We see that the file is empty, that's because we haven't redirected the standard error to lista.txt, but the standard output. As we have seen in the image, there are two standard outputs in a command, the first one is the standard output and the second one is the standard error, so to redirect the standard error you have to indicate it with 2>. Let's proceed this way now.

	
!ls kjhsfskjd 2> lista.txt
Copy
	
!ls kjhsfskjd 2> lista.txt
terminal("cat lista.txt")
Copy
	
ls: no se puede acceder a 'kjhsfskjd': No existe el archivo o el directorio

As we can see, it has now been redirected

Redirecting standard output and standard errorlink image 175

If we want to redirect both, we use the following

	
!ls kjhsfskjd > lista.txt 2>&1
Copy

Let's look inside lista.txt

	
!ls kjhsfskjd > lista.txt 2>&1
terminal("cat lista.txt")
Copy
	
ls: no se puede acceder a 'kjhsfskjd': No existe el archivo o el directorio

If we now execute a command without errors

	
!ls . >> lista.txt 2>&1
Copy

Let's look inside lista.txt (note, now we have concatenated)

	
!ls . >> lista.txt 2>&1
terminal("cat lista.txt")
Copy
	
ls: no se puede acceder a 'kjhsfskjd': No existe el archivo o el directorio
2021-02-11-Introduccion-a-Python.ipynb
Abc
datos1
datos123
dot2.txt
dot.txt
file.txt
index.html
lista.txt

As you can see, both standard error and standard output have been redirected to the same file.

Pipelineslink image 176

We can create pipelines by making the standard output of one command become the standard input of another. For example, let's make the output of ls -lha the input of grep, which we will see later, but it is a command for searching.

	
!ls -lha | grep -i "txt"
Copy
	
-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 182 dic 6 01:06 lista.txt

As we can see, what we have done is pipe the output of ls to grep with which we have searched for any file with txt in the name

Control Operators - Chaining Commandslink image 177

Commands Sequentiallylink image 178

One way to chain commands sequentially is to separate them using ;. This creates different threads for each task.

	
!ls; echo 'Hola'; cal
Copy
	
2021-02-11-Introduccion-a-Python.ipynb datos123 file.txt
Abc dot2.txt index.html
datos1 dot.txt lista.txt
Hola
Diciembre 2022
do lu ma mi ju vi sá
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 29 30 31

As we can see, the ls command was executed first, then Hello was printed thanks to the command echo "Hola", and finally a calendar was printed thanks to the command cal.

Let's now do another example to see that they execute sequentially.

	
!echo "Before touch;"; ls -lha; touch secuential.txt; echo "After touch:"; ls -lha
Copy
	
Before touch;
total 292K
drwxrwxr-x 2 wallabot wallabot 4,0K dic 6 01:04 .
drwxrwxr-x 7 wallabot wallabot 4,0K dic 6 00:24 ..
-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 0 dic 6 00:56 index.html
-rw-rw-r-- 1 wallabot wallabot 182 dic 6 01:06 lista.txt
After touch:
total 292K
drwxrwxr-x 2 wallabot wallabot 4,0K dic 6 01:07 .
drwxrwxr-x 7 wallabot wallabot 4,0K dic 6 00:24 ..
-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 0 dic 6 00:56 index.html
-rw-rw-r-- 1 wallabot wallabot 182 dic 6 01:06 lista.txt
-rw-rw-r-- 1 wallabot wallabot 0 dic 6 01:07 secuential.txt

As you can see, in the first ls, secuential.txt does not appear, while in the second one it does. This means that the commands were executed sequentially, one after the other.

Parallel Commandslink image 179

If what we want is for the commands to be executed in parallel, we must use the & operator. This will create a new process for each command.

Let's look at the previous example

	
!rm secuential.txt
Copy
	
!rm secuential.txt
!echo "Before touch;" & ls -lha & touch secuential.txt & echo "After touch:" & ls -lha
Copy
	
Before touch;
After touch:
total 292K
drwxrwxr-x 2 wallabot wallabot 4,0K dic 6 01:08 .
drwxrwxr-x 7 wallabot wallabot 4,0K dic 6 00:24 ..
-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 0 dic 6 00:56 index.html
-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

Now you can see that they have not been executed sequentially, since the echos have been executed first, which will take the least time, and then the rest.

Conditional Commandslink image 180

Andlink image 181

Using the && operator, a command will execute when the previous one has successfully run

	
!rm secuential.txt
Copy
	
!rm secuential.txt
!echo "Before touch;" && ls -lha && touch secuential.txt && echo "After touch:" && ls -lha
Copy
	
Before touch;
total 292K
drwxrwxr-x 2 wallabot wallabot 4,0K dic 6 01:08 .
drwxrwxr-x 7 wallabot wallabot 4,0K dic 6 00:24 ..
-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 0 dic 6 00:56 index.html
-rw-rw-r-- 1 wallabot wallabot 182 dic 6 01:06 lista.txt
After touch:
total 292K
drwxrwxr-x 2 wallabot wallabot 4,0K dic 6 01:08 .
drwxrwxr-x 7 wallabot wallabot 4,0K dic 6 00:24 ..
-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 0 dic 6 00:56 index.html
-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

Here we can see how it has been executed one after another, that is, a command does not start until the previous one ends

But then, what's the difference between ; and &&?

In the first case, the sequential ;, one command is executed first and then the other, but for a command to be executed, it doesn't matter if the previous one was executed successfully.

	
!rm prueba ; ls -lha
Copy
	
rm: no se puede borrar 'prueba': No existe el archivo o el directorio
total 292K
drwxrwxr-x 2 wallabot wallabot 4,0K dic 6 01:08 .
drwxrwxr-x 7 wallabot wallabot 4,0K dic 6 00:24 ..
-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 0 dic 6 00:56 index.html
-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

As you can see, first rm prueba is executed, an error occurs, and ls -lha prueba is still executed.

In the conditional manner &&, if a command does not execute successfully, the next one will not be executed.

	
!rm prueba && ls -lha
Copy
	
rm: no se puede borrar 'prueba': No existe el archivo o el directorio

As you can see ls -lha prueba does not execute because rm prueba has given an error

Orlink image 182

Unlike &&, the 'or' will execute all processes regardless of their result. The || operator should be used.

	
!rm prueba || ls -lha
Copy
	
rm: no se puede borrar 'prueba': No existe el archivo o el directorio
total 292K
drwxrwxr-x 2 wallabot wallabot 4,0K dic 6 01:08 .
drwxrwxr-x 7 wallabot wallabot 4,0K dic 6 00:24 ..
-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 0 dic 6 00:56 index.html
-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

The difference between this and ; is that || (or) does not create a new thread for each command

How Permissions are Managedlink image 183

When listing the files in a directory with the -l (long) flag, some symbols appear next to each file.

	
!mkdir subdirectorio
Copy
	
!mkdir subdirectorio
!ls -l
Copy
	
total 288
-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 0 dic 6 00:56 index.html
-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:10 subdirectorio

This gives us information about each file

First, let's see what types of files there are. * -: Regular file* d: Directory* l: Symbolic link* b: Special block file. These are files that manage data block information, such as a USB

Later we will see the types of mode:

<table border="1">
      ``````markdown
      <header>
      ```<tr><th scope="col" colspan="3">Owner</th><th scope="col" colspan="3">Group</th><th scope="col" colspan="3">Mundo</th>```markdown
          	</tr>
      ```	</header><body>		<tr><th scope="row" colspan="3">rwx</th><th scope="row" colspan="3">r-x</th><th scope="row" colspan="3">r-x</th>		</tr>		<tr>			<th scope="row">1</th><th scope="row">1</th>			<th scope="row">1</th><th scope="row">1</th><th scope="row">0</th>			<th scope="row">1</th>			<th scope="row">1</th><th scope="row">0</th><th scope="row">1</th>		</tr>		<tr>			<th scope="row" colspan="3">7</th>			<th scope="row" colspan="3">5</th>			<th scope="row" colspan="3">5</th>		</tr><body></table>
      * r: read* w: write * x: execute
      

Symbolic mode:* u: User-only* g: Group only* o: Only for others (world)* a: For all

Modifying Permissions in the Terminallink image 184

We create a new file

	
terminal("cd subdirectorio")
Copy
	
terminal("cd subdirectorio")
!echo "hola mundo" > mitexto.txt
Copy
	
terminal("cd subdirectorio")
!echo "hola mundo" > mitexto.txt
!cat mitexto.txt
Copy
	
hola mundo

Let's see the permissions it has.

	
!ls -l
Copy
	
total 4
-rw-rw-r-- 1 wallabot wallabot 11 dic 6 01:10 mitexto.txt

As we can see, it has read and write permissions for my user and the group, and only read permissions for the rest (world)

Changing Permissions with chmod (change mode)link image 185

To change the permissions of a file we use the chmod (change mode) command, where we need to set the user's permissions first in octal, then the group's, and lastly the others'.

	
!chmod 755 mitexto.txt
Copy
	
!chmod 755 mitexto.txt
!ls -l
Copy
	
total 4
-rwxr-xr-x 1 wallabot wallabot 11 dic 6 01:10 mitexto.txt

We see that now my user has read, write, and execute permissions, while the group and the rest of the world have read and execute permissions.

We are going to remove the read permissions only for my user. To change only the permissions for a user, we use the symbolic identifier, a + if we want to add permissions or a - if we want to remove them or a = if we want to reset them followed by the type of permission

	
!chmod u-r mitexto.txt
Copy
	
!chmod u-r mitexto.txt
!ls -l
Copy
	
total 4
--wxr-xr-x 1 wallabot wallabot 11 dic 6 01:10 mitexto.txt
	
!cat mitexto.txt
Copy
	
cat: mitexto.txt: Permiso denegado

As we can see, by removing read permissions for my user, we cannot read the file.

We will grant the read permission again

	
!chmod u+r mitexto.txt
Copy
	
!chmod u+r mitexto.txt
!ls -l
Copy
	
total 4
-rwxr-xr-x 1 wallabot wallabot 11 dic 6 01:10 mitexto.txt
	
!cat mitexto.txt
Copy
	
hola mundo

If we want to add or remove permissions for more than one user, we do so by separating each permission with a ,

	
!chmod u-x,go=w mitexto.txt
Copy
	
!chmod u-x,go=w mitexto.txt
!ls -l
Copy
	
total 4
-rw--w--w- 1 wallabot wallabot 11 dic 6 01:10 mitexto.txt

As can be seen, execution permission has been removed for the user and write-only permission has been set for the group and the rest of the world.

User Identification with whoamilink image 186

To find out who we are, we can use the whoami (who am I) command.

	
!whoami
Copy
	
wallabot

User Information with idlink image 187

Another way, which also provides more information, is the id command.

	
!id
Copy
	
uid=1000(wallabot) gid=1000(wallabot) grupos=1000(wallabot),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),120(lpadmin),131(lxd),132(sambashare),998(docker)

This command tells us that our user ID is 1000, the group ID is 1000, and that we belong to the groups wallabot, adm, cdrom, sudo, dip, plugdev, lpadmin, lxd, sambashare, and docker

Change of user with the su (switch user) commandlink image 188

If we want to switch users, we use the su (switch user) command. For certain users, we need to use sudo (superuser do)

	
!sudo su root
Copy
	
root@wallabot:/home/wallabot/Documentos/web/portafolio/posts/prueba/subdirectorio#

As we can see, the prompt changes and now indicates that we are the user root.

Let's go to the home folder

	
!cd
Copy
	
root@wallabot:~#

But in Linux there is a home folder for each user, we can see this if we run the command pwd

	
!pwd
Copy
	
/root

I am going to create a file in the folder where I previously created the mitexto.txt file.

	
!touch /home/wallabot/Documentos/web/portafolio/posts/prueba/subdirectorio/rootfile.txt
Copy
	

I change back to my user

	
!su wallabot
Copy
	
wallabot@wallabot:

And I go to the directory where the files I have created are located.

	
!cd /home/wallabot/Documentos/web/portafolio/posts/prueba/subdirectorio
Copy

We see the files that are there and their permissions

	
!cd /home/wallabot/Documentos/web/portafolio/posts/prueba/subdirectorio
!ls -l
Copy
	
total 4
-rw--w--w- 1 wallabot wallabot 11 dic 6 01:10 mitexto.txt
-rw-r--r-- 1 root root 0 dic 6 01:22 rootfile.txt

As we can see, the owner and group of the file rootfile.txt is the user root

If I, now that I am the user wallabot, try to delete the file rootfile.txt

	
!rm rootfile.txt
Copy
	
rm: ¿borrar el fichero regular vacío 'rootfile.txt' protegido contra escritura? (s/n)

As we can see, it asks us if we want to delete it, as it belongs to another user.

Change a User's Passwordlink image 189

If I want to modify the password of the currently active user, I use the passwd (password) command.

First, I check which user I am

	
!whoami
Copy
	
wallabot

And now we try to change the password

	
!passwd
Copy
	
$ passwd
Cambiando la contraseña de wallabot.
Contraseña actual de :
Nueva contraseña:
Vuelva a escribir la nueva contraseña

As we can see, it asks for the current password in order to change it.

We can create symbolic links to a specific path using the ln (link) command followed by the -s (symbolic) flag, the directory, and the name of the link.

	
!ln -s /home/wallabot/Documentos/web web
Copy

If we now list the files

	
!ln -s /home/wallabot/Documentos/web web
!ls -l
Copy
	
total 4
-rw--w--w- 1 wallabot wallabot 11 dic 6 01:10 mitexto.txt
-rw-r--r-- 1 root root 0 dic 6 01:22 rootfile.txt
lrwxrwxrwx 1 wallabot wallabot 29 dic 6 01:28 web -> /home/wallabot/Documentos/web

We see the symbolic link web pointing to /home/wallabot/Documentos/web:

I can now go to web

	
terminal("cd web")
Copy
	
terminal("cd web")
!pwd
Copy
	
/home/wallabot/Documentos/web

Set environment variableslink image 191

Viewing Environment Variables with printenvlink image 192

With the printenv command, we can see all the environment variables

	
!printenv
Copy
	
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
VSCODE_CWD=/home/wallabot
LESSOPEN=| /usr/bin/lesspipe %s
CONDA_PROMPT_MODIFIER=(base)
PYTHONIOENCODING=utf-8
USER=wallabot
VSCODE_NLS_CONFIG={"locale":"es","availableLanguages":{"*":"es"},"_languagePackId":"b07c40c9acb9e1d7b3ca14b06f814803.es","_translationsConfigFile":"/home/wallabot/.config/Code/clp/b07c40c9acb9e1d7b3ca14b06f814803.es/tcf.json","_cacheRoot":"/home/wallabot/.config/Code/clp/b07c40c9acb9e1d7b3ca14b06f814803.es","_resolvedLanguagePackCoreLocation":"/home/wallabot/.config/Code/clp/b07c40c9acb9e1d7b3ca14b06f814803.es/6261075646f055b99068d3688932416f2346dd3b","_corruptedFile":"/home/wallabot/.config/Code/clp/b07c40c9acb9e1d7b3ca14b06f814803.es/corrupted.info","_languagePackSupport":true}
VSCODE_HANDLES_UNCAUGHT_ERRORS=true
MPLBACKEND=module://ipykernel.pylab.backend_inline
SSH_AGENT_PID=1373
XDG_SESSION_TYPE=x11
SHLVL=0
HOME=/home/wallabot
CHROME_DESKTOP=code-url-handler.desktop
CONDA_SHLVL=1
DESKTOP_SESSION=ubuntu
GIO_LAUNCHED_DESKTOP_FILE=/usr/share/applications/code.desktop
VSCODE_IPC_HOOK=/run/user/1000/vscode-26527400-1.73.1-main.sock
PYTHONUNBUFFERED=1
GTK_MODULES=gail:atk-bridge
GNOME_SHELL_SESSION_MODE=ubuntu
APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL=true
PAGER=cat
MANAGERPID=1153
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
GIO_LAUNCHED_DESKTOP_FILE_PID=3897
_CE_M=
IM_CONFIG_PHASE=1
LOGNAME=wallabot
_=/home/wallabot/anaconda3/bin/python
JOURNAL_STREAM=8:52662
XDG_SESSION_CLASS=user
USERNAME=wallabot
TERM=xterm-color
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
_CE_CONDA=
WINDOWPATH=2
PATH=/home/wallabot/anaconda3/bin:/home/wallabot/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
SESSION_MANAGER=local/wallabot:@/tmp/.ICE-unix/1410,unix/wallabot:/tmp/.ICE-unix/1410
INVOCATION_ID=73bba2d15f2e492fa6c16538996a2556
VSCODE_AMD_ENTRYPOINT=vs/workbench/api/node/extensionHostProcess
XDG_RUNTIME_DIR=/run/user/1000
XDG_MENU_PREFIX=gnome-
GDK_BACKEND=x11
DISPLAY=:0
LANG=es_ES.UTF-8
XDG_CURRENT_DESKTOP=Unity
XAUTHORITY=/run/user/1000/gdm/Xauthority
XDG_SESSION_DESKTOP=ubuntu
XMODIFIERS=@im=ibus
LS_COLORS=
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
ORIGINAL_XDG_CURRENT_DESKTOP=ubuntu:GNOME
CONDA_PYTHON_EXE=/home/wallabot/anaconda3/bin/python
SHELL=/bin/bash
ELECTRON_RUN_AS_NODE=1
QT_ACCESSIBILITY=1
GDMSESSION=ubuntu
LESSCLOSE=/usr/bin/lesspipe %s %s
CONDA_DEFAULT_ENV=base
PYDEVD_IPYTHON_COMPATIBLE_DEBUGGING=1
GPG_AGENT_INFO=/run/user/1000/gnupg/S.gpg-agent:0:1
GJS_DEBUG_OUTPUT=stderr
QT_IM_MODULE=ibus
GIT_PAGER=cat
PWD=/home/wallabot/Documentos/web
CLICOLOR=1
XDG_DATA_DIRS=/usr/share/ubuntu:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
VSCODE_CODE_CACHE_PATH=/home/wallabot/.config/Code/CachedData/6261075646f055b99068d3688932416f2346dd3b
CONDA_EXE=/home/wallabot/anaconda3/bin/conda
CONDA_PREFIX=/home/wallabot/anaconda3
VSCODE_PID=3897

View an environment variable with the echo commandlink image 193

To see a specific environment variable, we can do it using the echo command followed by the $ symbol and the name of the variable

	
!echo $HOME
Copy
	
/home/wallabot

Modify an environment variable for a terminal sessionlink image 194

We can modify an environment variable for the active terminal session, for example, let's add a new path to the PATH variable. First, let's see what's in it

	
!echo $PATH
Copy
	
/home/wallabot/anaconda3/bin:/home/wallabot/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

Now we add a new directory

	
!PATH=$PATH:"subdirectorio
Copy
	

We return to see what's inside PATH

	
!echo $PATH
Copy
	
/home/wallabot/anaconda3/bin:/home/wallabot/anaconda3/condabin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:subdirectorio

We see that the subdirectory directory has been added. The problem with this method is that when we open a new terminal this change in PATH will not be maintained.

Modify an environment variable for all terminal sessionslink image 195

We go to the home folder

	
terminal("cd /home/wallabot")
Copy

Here in the home, we list all files with the -a (all) flag

	
terminal("cd /home/wallabot")
!ls -a
Copy
	
. .eclipse .pki
.. Escritorio Plantillas
.afirma .gitconfig .platformio
anaconda3 .gnupg .profile
.audacity-data Imágenes .psensor
.bash_history .ipython Público
.bash_logout .java .python_history
.bashrc .jupyter snap
.cache .lesshst .ssh
.conda Lightworks .sudo_as_admin_successful
.config .Lightworks.thereCanBeOnlyOne .thunderbird
.cortex-debug .local Vídeos
.cyberghost logiops .vnc
.dbus .MCTranscodingSDK .vscode
Descargas .mozilla .wget-hsts
.docker Música
Documentos .nv

We see that there is a file called .bashrc, this file is the file that contains the configuration of our bash

	
terminal("cat .bashrc", max_lines_output=3)
Copy
	
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
...
fi
unset __conda_setup
# <<< conda initialize <<<

This file configures the terminal each time a new one is opened, so if we edit the PATH variable in it, this change will persist for all new terminal windows we open.

To modify the PATH variable within the configuration file, we need to add the following line to the file

PATH=$PATH:"subdirectory"```

Create aliases for all sessionslink image 196

We already saw how to create command aliases, but it also happened that they were lost every time we closed a terminal session. To prevent this, we also add them to the .bashrc configuration file. For example, in my case, I have added the following lines. alias ll='ls -l'alias la='ls -a'bash alias lh='ls -h'

alias
      

Search Commandslink image 197

Searching for Binaries with whichlink image 198

The first search command we will see is which which allows us to find the path of the binaries

	
!which python
Copy
	
/home/wallabot/anaconda3/bin/python

However, if we look for something that is not in any of the PATH routes, which will not be able to tell us the path.

	
!which cd
Copy

File Search with findlink image 199

To search for a file with find, we need to indicate from which path we want to search for the file, followed by the -name flag and the name of the file we want to search for.

	
!which cd
!find ~ -name "2021-02-11-Introduccion-a-Python.ipynb"
Copy
	
/home/wallabot/Documentos/web/portafolio/posts/prueba/2021-02-11-Introduccion-a-Python.ipynb
/home/wallabot/Documentos/web/portafolio/posts/2021-02-11-Introduccion-a-Python.ipynb

As we can see, it is in its directory plus the copy that I have created in this notebook and saved in the prueba folder

One very powerful thing about find is that we can use wildcards, for example, if I want to search for all text files in my web folder.

	
!find ~/Documentos/web/ -name *.txt
Copy
	
/home/wallabot/Documentos/web/portafolio/posts/2022-09-12 Introduccion a la terminal.txt
/home/wallabot/Documentos/web/portafolio/posts/prueba/lista.txt
/home/wallabot/Documentos/web/portafolio/posts/prueba/dot.txt
/home/wallabot/Documentos/web/portafolio/posts/prueba/dot2.txt
/home/wallabot/Documentos/web/portafolio/posts/prueba/secuential.txt
/home/wallabot/Documentos/web/portafolio/posts/prueba/subdirectorio/rootfile.txt
/home/wallabot/Documentos/web/portafolio/posts/prueba/subdirectorio/mitexto.txt
/home/wallabot/Documentos/web/portafolio/posts/prueba/file.txt
/home/wallabot/Documentos/web/wordpress_api_rest/page.txt

If we do not want it to distinguish between uppercase and lowercase, we must use the -iname flag. For example, if we search for all files that contain the text FILE, but using the -iname flag.

	
!find ~/Documentos/web/ -iname *FILE*
Copy
	
/home/wallabot/Documentos/web/portafolio/posts/html_files
/home/wallabot/Documentos/web/portafolio/posts/prueba/subdirectorio/rootfile.txt
/home/wallabot/Documentos/web/portafolio/posts/prueba/file.txt

We see that all the results contain file and not FILE, that is, it has not distinguished between uppercase and lowercase

We can specify the file type with the -type flag. It only accepts two types f for files and d for directories.

	
!find ~/Documentos/nerf -name image*
Copy
	
/home/wallabot/Documentos/nerf/instant-ngp/configs/image
/home/wallabot/Documentos/nerf/instant-ngp/dependencies/tiny-cuda-nn/benchmarks/image
/home/wallabot/Documentos/nerf/instant-ngp/dependencies/tiny-cuda-nn/dependencies/cutlass/media/images
/home/wallabot/Documentos/nerf/instant-ngp/dependencies/tiny-cuda-nn/dependencies/fmt/doc/bootstrap/mixins/image.less
/home/wallabot/Documentos/nerf/instant-ngp/dependencies/tiny-cuda-nn/data/images
/home/wallabot/Documentos/nerf/instant-ngp/dependencies/dlss/NVIDIAImageScaling/samples/media/images
/home/wallabot/Documentos/nerf/instant-ngp/data/nerf/fox/images
/home/wallabot/Documentos/nerf/instant-ngp/data/image
	
!find ~/Documentos/nerf -name image* -type d
Copy
	
/home/wallabot/Documentos/nerf/instant-ngp/configs/image
/home/wallabot/Documentos/nerf/instant-ngp/dependencies/tiny-cuda-nn/benchmarks/image
/home/wallabot/Documentos/nerf/instant-ngp/dependencies/tiny-cuda-nn/dependencies/cutlass/media/images
/home/wallabot/Documentos/nerf/instant-ngp/dependencies/tiny-cuda-nn/data/images
/home/wallabot/Documentos/nerf/instant-ngp/dependencies/dlss/NVIDIAImageScaling/samples/media/images
/home/wallabot/Documentos/nerf/instant-ngp/data/nerf/fox/images
/home/wallabot/Documentos/nerf/instant-ngp/data/image
	
!find ~/Documentos/nerf -name image* -type f
Copy
	
/home/wallabot/Documentos/nerf/instant-ngp/dependencies/tiny-cuda-nn/dependencies/fmt/doc/bootstrap/mixins/image.less

If we want to filter by file size we can use the -size flag, for example, if we want to search for all files larger than 200 MB

	
!find ~/Documentos/ -type f -size +200M
Copy
	
/home/wallabot/Documentos/kaggle/hubmap/models/13_efficientnet-b7_final_model.pth
/home/wallabot/Documentos/kaggle/hubmap/models/12_efficientnet-b7_final_model.pth
/home/wallabot/Documentos/kaggle/hubmap/models/14_resnet152_final_model.pth
/home/wallabot/Documentos/kaggle/hubmap/models/14_resnet152_best_model.pth
/home/wallabot/Documentos/kaggle/hubmap/models/12_efficientnet-b7_early_stopping.pth
/home/wallabot/Documentos/kaggle/hubmap/models/efficientnet-b7-dcc49843.pth
/home/wallabot/Documentos/kaggle/hubmap/models/13_efficientnet-b7_early_stopping.pth
/home/wallabot/Documentos/kaggle/hubmap/models/14_resnet152_early_stopping.pth
/home/wallabot/Documentos/kaggle/hubmap/models/12_efficientnet-b7_best_model.pth
/home/wallabot/Documentos/kaggle/hubmap/models/13_efficientnet-b7_best_model.pth

If we want to perform operations after the search, we use the -exec flag

For example, I am going to search for all folders named subdirectorio

	
!find ~/ -name subdirectorio -type d
Copy
	
/home/wallabot/Documentos/web/portafolio/posts/prueba/subdirectorio

I can make them delete with the -exec flag

	
!find ~/ -name subdirectorio -type d -exec rm -r {} ;
Copy
	
rm: ¿borrar el fichero regular vacío '/home/wallabot/Documentos/web/portafolio/posts/prueba/subdirectorio/rootfile.txt' protegido contra escritura? (s/n) s
find: ‘/home/wallabot/Documentos/web/portafolio/posts/prueba/subdirectorio’: No existe el archivo o el directorio
	
!find ~/ -name subdirectorio -type d
Copy

Finally, if we use the ! character, we will be indicating that it should find everything that does not match what we have specified.

	
!find ~/ -name subdirectorio -type d
!find ~/Documentos/web/portafolio/posts/prueba ! -name *.txt
Copy
	
/home/wallabot/Documentos/web/portafolio/posts/prueba
/home/wallabot/Documentos/web/portafolio/posts/prueba/index.html
/home/wallabot/Documentos/web/portafolio/posts/prueba/Abc
/home/wallabot/Documentos/web/portafolio/posts/prueba/datos1
/home/wallabot/Documentos/web/portafolio/posts/prueba/2021-02-11-Introduccion-a-Python.ipynb
/home/wallabot/Documentos/web/portafolio/posts/prueba/datos123

As we can see, it has found everything that is not a .txt

grep Search Commandlink image 200

grep is a very powerful search command, that's why we dedicate a section to it alone. The grep command uses regular expressions, so if you want to learn about them, I leave you a link to a post where I explain them.

Let's start to see the power of this command, let's search for all the times the text MaximoFN appears within the file 2021-02-11-Introduccion-a-Python.ipynb

	
terminal("cd /home/wallabot/Documentos/web/portafolio/posts/prueba")
Copy
	
terminal("cd /home/wallabot/Documentos/web/portafolio/posts/prueba")
terminal("grep MaximoFN 2021-02-11-Introduccion-a-Python.ipynb", max_lines_output=20)
Copy
	
"a = 'MaximoFN' ",
"'MaximoFN'"
"string = "MaximoFN" ",
"'MaximoFN'"
"string = 'MaximoFN' ",
"'MaximoFN'"
"Este es el blog de "MaximoFN" "
"print("Este es el blog de \"MaximoFN\"")"
"Este es el blog de 'MaximoFN' "
"print('Este es el blog de \'MaximoFN\'')"
"Este es el blog de \MaximoFN\\n"
"print('Este es el blog de \\MaximoFN\\\')"
"MaximoFN "
"print('Este es el blog de \nMaximoFN')"
"Este es el blog de MaximoFN "
"print('Esto no se imprimirá \rEste es el blog de MaximoFN')"
"Este es el blog de MaximoFN "
"print('Este es el blog de \tMaximoFN')"
"Este es el blog deMaximoFN "
"print('Este es el blog de \bMaximoFN')"
...
"funcion2_del_modulo('MaximoFN')"
"MaximoFN ",
" print('MaximoFN') ",
" variable = 'MaximoFN' ",

However, if we perform the same search for the text maximofn

	
!grep maximofn 2021-02-11-Introduccion-a-Python.ipynb
Copy

No results appear, this is because grep is case sensitive, that is, it searches the text exactly as you have entered it, differentiating between uppercase and lowercase. If we don't want this, we need to introduce the -i flag.

	
!grep maximofn 2021-02-11-Introduccion-a-Python.ipynb
terminal("grep -i MaximoFN 2021-02-11-Introduccion-a-Python.ipynb", max_lines_output=20)
Copy
	
"a = 'MaximoFN' ",
"'MaximoFN'"
"string = "MaximoFN" ",
"'MaximoFN'"
"string = 'MaximoFN' ",
"'MaximoFN'"
"Este es el blog de "MaximoFN" "
"print("Este es el blog de \"MaximoFN\"")"
"Este es el blog de 'MaximoFN' "
"print('Este es el blog de \'MaximoFN\'')"
"Este es el blog de \MaximoFN\\n"
"print('Este es el blog de \\MaximoFN\\\')"
"MaximoFN "
"print('Este es el blog de \nMaximoFN')"
"Este es el blog de MaximoFN "
"print('Esto no se imprimirá \rEste es el blog de MaximoFN')"
"Este es el blog de MaximoFN "
"print('Este es el blog de \tMaximoFN')"
"Este es el blog deMaximoFN "
"print('Este es el blog de \bMaximoFN')"
...
"funcion2_del_modulo('MaximoFN')"
"MaximoFN ",
" print('MaximoFN') ",
" variable = 'MaximoFN' ",

If what we want is for it to return the number of times it appears, we use the -c flag

	
!grep -c MaximoFN 2021-02-11-Introduccion-a-Python.ipynb
Copy
	
105

If we don't care if it appears in uppercase or lowercase, we can add the -i flag again, but there's no need to separate it from the -c flag; they can be introduced together

	
!grep -ci MaximoFN 2021-02-11-Introduccion-a-Python.ipynb
Copy
	
105

If now we want all the times in which the word MáximoFN does not appear, we introduce the -v flag

	
!grep -cv MaximoFN 2021-02-11-Introduccion-a-Python.ipynb
Copy
	
11573

Network Utilitieslink image 201

Network Interface Information with ifconfiglink image 202

The first command will be ifconfig which shows us information about our network interfaces.

	
!ifconfig
Copy
	
br-470e52ae2708: flags=4099<UP,BROADCAST,MULTICAST> 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<UP,BROADCAST,MULTICAST> 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<UP,BROADCAST,RUNNING,MULTICAST> 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<link>
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<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
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<UP,BROADCAST,MULTICAST> 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

As we can see, we have information about all the network interfaces of my computer, but if I want to know only one, it is specified by adding its name.

	
!ifconfig enp6s0
Copy
	
enp6s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> 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<link>
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

Network Interface Information with iplink image 203

Another way to obtain information about our network interfaces is by using the ip command; adding a gives us information about all interfaces.

	
!ip a
Copy
	
1: lo: <LOOPBACK,UP,LOWER_UP> 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: <BROADCAST,MULTICAST,UP,LOWER_UP> 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: <NO-CARRIER,BROADCAST,MULTICAST,UP> 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: <NO-CARRIER,BROADCAST,MULTICAST,UP> 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: <NO-CARRIER,BROADCAST,MULTICAST,UP> 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

Communication Test with pinglink image 204

Another useful command is ping, which can help us see if we have a connection to a specific IP. For example, Google's IP is 142.250.200.78, so we do a ping to see if it responds. The ping command in Linux pings continuously, so it never ends until we stop it. To prevent this, we add the -c flag and the number of attempts.

	
!ping 142.250.200.132 -c 4
Copy
	
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

The same would have happened if we had done it directly on google.com

	
!ping www.google.com -c 4
Copy
	
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

Download Source Files with curllink image 205

We can obtain a text file from a given address using the curl command, for example, we can download Google's html.

	
!curl https://www.google.com
Copy
	
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="es"><head><meta content="Google.es permite acceder a la informaci�n mundial en castellano, catal�n, gallego, euskara e ingl�s." name="description"><meta content="noodp" name="robots"><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"><title>Google</title><script nonce="zXcc4tMJWBRoE7q_o_Z2fQ">(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&&(!a.getAttribute||!(b=a.getAttribute("eid")));)a=a.parentNode;return b||h}function m(a){for(var b=null;a&&(!a.getAttribute||!(b=a.getAttribute("leid")));)a=a.parentNode;return b}
function n(a,b,c,d,g){var e="";c||-1!==b.search("&ei=")||(e="&ei="+l(d),-1===b.search("&lei=")&&(d=m(d))&&(e+="&lei="+d));d="";!c&&f._cshid&&-1===b.search("&cshid=")&&"slh"!==a&&(d="&cshid="+f._cshid);c=c||"/"+(g||"gen_204")+"?atyp=i&ct="+a+"&cad="+b+e+"&zx="+Date.now()+d;/^http:/i.test(c)&&"https:"===window.location.protocol&&(google.ml&&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&&!a.elements.q.value?!0:!1}else a=!1;a&&(b.preventDefault(),b.stopPropagation())},!0);document.documentElement.addEventListener("click",function(b){var a;a:{for(a=b.target;a&&a!==document.documentElement;a=a.parentElement)if("A"===a.tagName){a="1"===a.getAttribute("data-nohref");break a}a=!1}a&&b.preventDefault()},!0);}).call(this);</script><style>#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}
</style><style>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}</style><script nonce="zXcc4tMJWBRoE7q_o_Z2fQ">(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&&(r=a&&a.message);if(google.dl)return google.dl(a,e,d),null;if(0>v){window.console&&console.error(a,d);if(-2===v)throw a;b=!1}else b=!a||!a.message||"Error loading script"===a.message||q>=l&&!m?!1:!0;if(!b)return null;q++;d=d||{};b=encodeURIComponent;var c="/gen_204?atyp=i&ei="+b(google.kEI);google.kEXPI&&(c+="&jexpid="+b(google.kEXPI));c+="&srcpg="+b(google.sn)+"&jsr="+b(t.jsr)+"&bver="+b(t.bv);var f=a.lineNumber;void 0!==f&&(c+="&line="+f);var g=
a.fileName;g&&(0<g.indexOf("-extension:/")&&(e=3),c+="&script="+b(g),f&&g===window.location.href&&(f=document.documentElement.outerHTML.split(" ")[f],c+="&cad="+b(f?f.substring(0,300):"No script found.")));c+="&jsel="+e;for(var u in d)c+="&",c+=b(u),c+="=",c+=b(d[u]);c=c+"&emsg="+b(a.name+": "+a.message);c=c+"&jsst="+b(a.stack||"N/A");12288<=c.length&&(c=c.substr(0,12288));a=c;m||google.log(0,"",a);return a};window.onerror=function(a,b,d,m,e){r!==a&&(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&&q>=l&&(window.onerror=null)};})();</script></head><body bgcolor="#fff"><script nonce="zXcc4tMJWBRoE7q_o_Z2fQ">(function(){var src='/images/nav_logo229.png';var iesg=false;document.body.onload = function(){window.n && window.n();if (document.images){new Image().src=src;}
if (!iesg){document.f&&document.f.q.focus();document.gbqf&&document.gbqf.q.focus();}
}
})();</script><div id="mngb"><div id=gbar><nobr><b class=gb1>B�squeda</b> <a class=gb1 href="https://www.google.es/imghp?hl=es&tab=wi">Im�genes</a> <a class=gb1 href="https://maps.google.es/maps?hl=es&tab=wl">Maps</a> <a class=gb1 href="https://play.google.com/?hl=es&tab=w8">Play</a> <a class=gb1 href="https://www.youtube.com/?tab=w1">YouTube</a> <a class=gb1 href="https://news.google.com/?tab=wn">Noticias</a> <a class=gb1 href="https://mail.google.com/mail/?tab=wm">Gmail</a> <a class=gb1 href="https://drive.google.com/?tab=wo">Drive</a> <a class=gb1 style="text-decoration:none" href="https://www.google.es/intl/es/about/products?tab=wh"><u>M�s</u> &raquo;</a></nobr></div><div id=guser width=100%><nobr><span id=gbn class=gbi></span><span id=gbf class=gbf></span><span id=gbe></span><a href="http://www.google.es/history/optout?hl=es" class=gb4>Historial web</a> | <a href="/preferences?hl=es" class=gb4>Ajustes</a> | <a target=_top id=gb_70 href="https://accounts.google.com/ServiceLogin?hl=es&passive=true&continue=https://www.google.com/&ec=GAZAAQ" class=gb4>Iniciar sesi�n</a></nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div></div><center><br clear="all" id="lgpd"><div id="lga"><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"><br><br></div><form action="/search" name="f"><table cellpadding="0" cellspacing="0"><tr valign="top"><td width="25%">&nbsp;</td><td align="center" nowrap=""><input name="ie" value="ISO-8859-1" type="hidden"><input value="es" name="hl" type="hidden"><input name="source" type="hidden" value="hp"><input name="biw" type="hidden"><input name="bih" type="hidden"><div class="ds" style="height:32px;margin:4px 0"><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"></div><br style="line-height:0"><span class="ds"><span class="lsbb"><input class="lsb" value="Buscar con Google" name="btnG" type="submit"></span></span><span class="ds"><span class="lsbb"><input class="lsb" id="tsuid_1" value="Voy a tener suerte" name="btnI" type="submit"><script nonce="zXcc4tMJWBRoE7q_o_Z2fQ">(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/';};})();</script><input value="AJiK0e8AAAAAY46fQwdyVrbrgW6gkEtVkGfp2nyO0ZXL" name="iflsig" type="hidden"></span></span></td><td class="fl sblc" align="left" nowrap="" width="25%"><a href="/advanced_search?hl=es&amp;authuser=0">B�squeda avanzada</a></td></tr></table><input id="gbv" name="gbv" type="hidden" value="1"><script nonce="zXcc4tMJWBRoE7q_o_Z2fQ">(function(){var a,b="1";if(document&&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&&-1==location.search.indexOf("&gbv=2")){var f=google.gbvu,g=document.getElementById("gbv");g&&(g.value=a);f&&window.setTimeout(function(){location.href=f},0)};}).call(this);</script></form><div id="gac_scont"></div><div style="font-size:83%;min-height:3.5em"><br><div id="gws-output-pages-elements-homepage_additional_languages__als"><style>#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}</style><div id="SIvCob">Ofrecido por Google en: <a href="https://www.google.com/setprefs?sig=0_vwUKUD2Xhro4NnrueK1hCfItt30%3D&amp;hl=ca&amp;source=homepage&amp;sa=X&amp;ved=0ahUKEwjjw_C44uP7AhW_UaQEHVbMChoQ2ZgBCAU">catal�</a> <a href="https://www.google.com/setprefs?sig=0_vwUKUD2Xhro4NnrueK1hCfItt30%3D&amp;hl=gl&amp;source=homepage&amp;sa=X&amp;ved=0ahUKEwjjw_C44uP7AhW_UaQEHVbMChoQ2ZgBCAY">galego</a> <a href="https://www.google.com/setprefs?sig=0_vwUKUD2Xhro4NnrueK1hCfItt30%3D&amp;hl=eu&amp;source=homepage&amp;sa=X&amp;ved=0ahUKEwjjw_C44uP7AhW_UaQEHVbMChoQ2ZgBCAc">euskara</a> </div></div></div><span id="footer"><div style="font-size:10pt"><div style="margin:19px auto;text-align:center" id="WqQANb"><a href="http://www.google.es/intl/es/services/">Soluciones Empresariales</a><a href="/intl/es/about.html">Todo acerca de Google</a><a href="https://www.google.com/setprefdomain?prefdom=ES&amp;prev=https://www.google.es/&amp;sig=K_a2UXepORMQOw5-SHU8h4noB_VWk%3D">Google.es</a></div></div><p style="font-size:8pt;color:#70757a">&copy; 2022 - <a href="/intl/es/policies/privacy/">Privacidad</a> - <a href="/intl/es/policies/terms/">T�rminos</a></p></span></center><script nonce="zXcc4tMJWBRoE7q_o_Z2fQ">(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&&b&&(a!=google.cdo.width||b!=google.cdo.height)&&google.log("","","/client_204?&atyp=i&biw="+a+"&bih="+b+"&ei="+google.kEI);}).call(this);})();</script> <script nonce="zXcc4tMJWBRoE7q_o_Z2fQ">(function(){google.xjs={ck:'xjs.hp.oxai9SxkIQY.L.X.O',cs:'ACT90oEGh-_ImDfBjn6aD_ABGaOlD2MqVw',excm:[]};})();</script> <script nonce="zXcc4tMJWBRoE7q_o_Z2fQ">(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&&google.timers.load&&google.tick&&google.tick("load","xjsls");var b=document;var c="SCRIPT";"application/xhtml+xml"===b.contentType&&(c=c.toLowerCase());c=b.createElement(c);if(void 0===g){b=null;var k=d.trustedTypes;if(k&&k.createPolicy){try{b=k.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(q){d.console&&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&&a.constructor===l?a.g:"type_error:TrustedResourceUrl";var f,n;(f=(a=null==(n=(f=(c.ownerDocument&&c.ownerDocument.defaultView||window).document).querySelector)?void 0:n.call(f,"script[nonce]"))?a.nonce||a.getAttribute("nonce")||"":"")&&c.setAttribute("nonce",f);document.body.appendChild(c);google.psa=!0};google.xjsu=u;setTimeout(function(){0<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);})();</script> </body></html>

We can also create a pipeline to save it to a file

	
!curl https://www.google.com > google.html
Copy
	
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 15168 0 15168 0 0 135k 0 --:--:-- --:--:-- --:--:-- 137k

Now we can see if it has saved correctly

	
!cat google.html
Copy
	
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="es"><head><meta content="Google.es permite acceder a la informaci�n mundial en castellano, catal�n, gallego, euskara e ingl�s." name="description"><meta content="noodp" name="robots"><meta content="text/html; charset=UTF-8" http-equiv="Content-Type"><meta content="/images/branding/googleg/1x/googleg_standard_color_128dp.png" itemprop="image"><title>Google</title><script nonce="Jo7WFU6XWWwu6NrdwaRyIw">(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&&(!a.getAttribute||!(b=a.getAttribute("eid")));)a=a.parentNode;return b||h}function m(a){for(var b=null;a&&(!a.getAttribute||!(b=a.getAttribute("leid")));)a=a.parentNode;return b}
function n(a,b,c,d,g){var e="";c||-1!==b.search("&ei=")||(e="&ei="+l(d),-1===b.search("&lei=")&&(d=m(d))&&(e+="&lei="+d));d="";!c&&f._cshid&&-1===b.search("&cshid=")&&"slh"!==a&&(d="&cshid="+f._cshid);c=c||"/"+(g||"gen_204")+"?atyp=i&ct="+a+"&cad="+b+e+"&zx="+Date.now()+d;/^http:/i.test(c)&&"https:"===window.location.protocol&&(google.ml&&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&&!a.elements.q.value?!0:!1}else a=!1;a&&(b.preventDefault(),b.stopPropagation())},!0);document.documentElement.addEventListener("click",function(b){var a;a:{for(a=b.target;a&&a!==document.documentElement;a=a.parentElement)if("A"===a.tagName){a="1"===a.getAttribute("data-nohref");break a}a=!1}a&&b.preventDefault()},!0);}).call(this);</script><style>#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}
</style><style>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}</style><script nonce="Jo7WFU6XWWwu6NrdwaRyIw">(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&&(r=a&&a.message);if(google.dl)return google.dl(a,e,d),null;if(0>v){window.console&&console.error(a,d);if(-2===v)throw a;b=!1}else b=!a||!a.message||"Error loading script"===a.message||q>=l&&!m?!1:!0;if(!b)return null;q++;d=d||{};b=encodeURIComponent;var c="/gen_204?atyp=i&ei="+b(google.kEI);google.kEXPI&&(c+="&jexpid="+b(google.kEXPI));c+="&srcpg="+b(google.sn)+"&jsr="+b(t.jsr)+"&bver="+b(t.bv);var f=a.lineNumber;void 0!==f&&(c+="&line="+f);var g=
a.fileName;g&&(0<g.indexOf("-extension:/")&&(e=3),c+="&script="+b(g),f&&g===window.location.href&&(f=document.documentElement.outerHTML.split(" ")[f],c+="&cad="+b(f?f.substring(0,300):"No script found.")));c+="&jsel="+e;for(var u in d)c+="&",c+=b(u),c+="=",c+=b(d[u]);c=c+"&emsg="+b(a.name+": "+a.message);c=c+"&jsst="+b(a.stack||"N/A");12288<=c.length&&(c=c.substr(0,12288));a=c;m||google.log(0,"",a);return a};window.onerror=function(a,b,d,m,e){r!==a&&(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&&q>=l&&(window.onerror=null)};})();</script></head><body bgcolor="#fff"><script nonce="Jo7WFU6XWWwu6NrdwaRyIw">(function(){var src='/images/nav_logo229.png';var iesg=false;document.body.onload = function(){window.n && window.n();if (document.images){new Image().src=src;}
if (!iesg){document.f&&document.f.q.focus();document.gbqf&&document.gbqf.q.focus();}
}
})();</script><div id="mngb"><div id=gbar><nobr><b class=gb1>B�squeda</b> <a class=gb1 href="https://www.google.es/imghp?hl=es&tab=wi">Im�genes</a> <a class=gb1 href="https://maps.google.es/maps?hl=es&tab=wl">Maps</a> <a class=gb1 href="https://play.google.com/?hl=es&tab=w8">Play</a> <a class=gb1 href="https://www.youtube.com/?tab=w1">YouTube</a> <a class=gb1 href="https://news.google.com/?tab=wn">Noticias</a> <a class=gb1 href="https://mail.google.com/mail/?tab=wm">Gmail</a> <a class=gb1 href="https://drive.google.com/?tab=wo">Drive</a> <a class=gb1 style="text-decoration:none" href="https://www.google.es/intl/es/about/products?tab=wh"><u>M�s</u> &raquo;</a></nobr></div><div id=guser width=100%><nobr><span id=gbn class=gbi></span><span id=gbf class=gbf></span><span id=gbe></span><a href="http://www.google.es/history/optout?hl=es" class=gb4>Historial web</a> | <a href="/preferences?hl=es" class=gb4>Ajustes</a> | <a target=_top id=gb_70 href="https://accounts.google.com/ServiceLogin?hl=es&passive=true&continue=https://www.google.com/&ec=GAZAAQ" class=gb4>Iniciar sesi�n</a></nobr></div><div class=gbh style=left:0></div><div class=gbh style=right:0></div></div><center><br clear="all" id="lgpd"><div id="lga"><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"><br><br></div><form action="/search" name="f"><table cellpadding="0" cellspacing="0"><tr valign="top"><td width="25%">&nbsp;</td><td align="center" nowrap=""><input name="ie" value="ISO-8859-1" type="hidden"><input value="es" name="hl" type="hidden"><input name="source" type="hidden" value="hp"><input name="biw" type="hidden"><input name="bih" type="hidden"><div class="ds" style="height:32px;margin:4px 0"><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"></div><br style="line-height:0"><span class="ds"><span class="lsbb"><input class="lsb" value="Buscar con Google" name="btnG" type="submit"></span></span><span class="ds"><span class="lsbb"><input class="lsb" id="tsuid_1" value="Voy a tener suerte" name="btnI" type="submit"><script nonce="Jo7WFU6XWWwu6NrdwaRyIw">(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/';};})();</script><input value="AJiK0e8AAAAAY46fV7gpXBHCT6KAebFZAqGv1l-4BtIR" name="iflsig" type="hidden"></span></span></td><td class="fl sblc" align="left" nowrap="" width="25%"><a href="/advanced_search?hl=es&amp;authuser=0">B�squeda avanzada</a></td></tr></table><input id="gbv" name="gbv" type="hidden" value="1"><script nonce="Jo7WFU6XWWwu6NrdwaRyIw">(function(){var a,b="1";if(document&&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&&-1==location.search.indexOf("&gbv=2")){var f=google.gbvu,g=document.getElementById("gbv");g&&(g.value=a);f&&window.setTimeout(function(){location.href=f},0)};}).call(this);</script></form><div id="gac_scont"></div><div style="font-size:83%;min-height:3.5em"><br><div id="gws-output-pages-elements-homepage_additional_languages__als"><style>#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}</style><div id="SIvCob">Ofrecido por Google en: <a href="https://www.google.com/setprefs?sig=0_HljXEzVisqsnlJP1S5dx0Fao0Lw%3D&amp;hl=ca&amp;source=homepage&amp;sa=X&amp;ved=0ahUKEwiimaPC4uP7AhU3UKQEHXzFDBQQ2ZgBCAU">catal�</a> <a href="https://www.google.com/setprefs?sig=0_HljXEzVisqsnlJP1S5dx0Fao0Lw%3D&amp;hl=gl&amp;source=homepage&amp;sa=X&amp;ved=0ahUKEwiimaPC4uP7AhU3UKQEHXzFDBQQ2ZgBCAY">galego</a> <a href="https://www.google.com/setprefs?sig=0_HljXEzVisqsnlJP1S5dx0Fao0Lw%3D&amp;hl=eu&amp;source=homepage&amp;sa=X&amp;ved=0ahUKEwiimaPC4uP7AhU3UKQEHXzFDBQQ2ZgBCAc">euskara</a> </div></div></div><span id="footer"><div style="font-size:10pt"><div style="margin:19px auto;text-align:center" id="WqQANb"><a href="http://www.google.es/intl/es/services/">Soluciones Empresariales</a><a href="/intl/es/about.html">Todo acerca de Google</a><a href="https://www.google.com/setprefdomain?prefdom=ES&amp;prev=https://www.google.es/&amp;sig=K_8O8QHBmoai9DOT5YZxMWevJK8VI%3D">Google.es</a></div></div><p style="font-size:8pt;color:#70757a">&copy; 2022 - <a href="/intl/es/policies/privacy/">Privacidad</a> - <a href="/intl/es/policies/terms/">T�rminos</a></p></span></center><script nonce="Jo7WFU6XWWwu6NrdwaRyIw">(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&&b&&(a!=google.cdo.width||b!=google.cdo.height)&&google.log("","","/client_204?&atyp=i&biw="+a+"&bih="+b+"&ei="+google.kEI);}).call(this);})();</script> <script nonce="Jo7WFU6XWWwu6NrdwaRyIw">(function(){google.xjs={ck:'xjs.hp.oxai9SxkIQY.L.X.O',cs:'ACT90oEGh-_ImDfBjn6aD_ABGaOlD2MqVw',excm:[]};})();</script> <script nonce="Jo7WFU6XWWwu6NrdwaRyIw">(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&&google.timers.load&&google.tick&&google.tick("load","xjsls");var b=document;var c="SCRIPT";"application/xhtml+xml"===b.contentType&&(c=c.toLowerCase());c=b.createElement(c);if(void 0===g){b=null;var k=d.trustedTypes;if(k&&k.createPolicy){try{b=k.createPolicy("goog#html",{createHTML:e,createScript:e,createScriptURL:e})}catch(q){d.console&&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&&a.constructor===l?a.g:"type_error:TrustedResourceUrl";var f,n;(f=(a=null==(n=(f=(c.ownerDocument&&c.ownerDocument.defaultView||window).document).querySelector)?void 0:n.call(f,"script[nonce]"))?a.nonce||a.getAttribute("nonce")||"":"")&&c.setAttribute("nonce",f);document.body.appendChild(c);google.psa=!0};google.xjsu=u;setTimeout(function(){0<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);})();</script> </body></html>

Download files with wgetlink image 206

Another similar command is wget, however, unlike curl, wget downloads the file directly.

	
!wget https://www.google.com
Copy
	
--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 [ <=> ] 14,76K --.-KB/s en 0,002s
2022-12-06 01:49:19 (7,17 MB/s) - “index.html.1” guardado [15117]
	
!ls -l
Copy
	
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

We see that it has been saved as index.html, which is how Google has it named.

If we want to save it with a specific name, we can use the -O flag

	
!wget https://www.google.com -O google2.html
Copy
	
--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 [ <=> ] 14,78K --.-KB/s en 0,003s
2022-12-06 01:49:37 (5,27 MB/s) - “google2.html” guardado [15131]
	
!ls -l
Copy
	
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

Path Debugging with traceroutelink image 207

A very useful command is to see the route to a destination, for this we use traceroute, for example, let's see all the sites I have to pass through to connect to Google

	
!traceroute www.google.com
Copy
	
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

Route Debugging with mtrlink image 208

Another debugging tool is mtr, which is an improved version of traceroute. It provides information for each hop, such as response time, packet loss percentage, etc.

	
!mtr -n maximofn.com
Copy
	
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

As you can see in hop 5, almost 50% of the packets are lost, which would help me call my phone company and ask them to try routing me through a different path.

Name of our machine with hostnamelink image 209

If we want to know the name of our machine, we can use hostname, which is useful if we want to connect to our machine from another one.

	
!hostname
Copy
	
wallabot

Default gateway information with route -nlink image 210

If we want to know our default gateway we use the command route -n

	
!route -n
Copy
	
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

IP Information of a Domain with nslookuplink image 211

If we want to know the IP of a domain, we can find it out using the nslookup command.

	
!nslookup google.com
Copy
	
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

This tells us that Google's IPv4 is 172.217.168.174 and its IPv6 is 2a00:1450:4003:803::200e

Information about our network with netstatslink image 212

The last utility command is netstats, this command gives us the status of our network, and with the -i flag it returns our network interfaces.

	
!netstat -i
Copy
	
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

DNS Queries with diglink image 213

With the command dig <domain> we can make DNS queries, for example, let's make a query to Google

	
!dig google.com
Copy
	
; <<>> DiG 9.16.1-Ubuntu <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- 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

It can be seen

```;; ANSWER SECTION:google.com.       283     IN      A       142.250.184.14```
      Therefore, the query has given us Google's IP
      

We can query a particular DNS server with dig @<DNS server> <domain>

	
!dig @1.1.1.1 google.com
Copy
	
; <<>> DiG 9.16.1-Ubuntu <<>> @1.1.1.1 google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- 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

We have made the same query, but we have made it to Cloudflare's DNS.

Compressing Fileslink image 214

Before compressing and decompressing, let's see what we are going to compress. First, we print our path and list the files.

	
!pwd; ls -l
Copy
	
/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

Let's create a new folder and copy everything that is inside the current folder into it.

	
!mkdir tocompress; cp * tocompress; ls -l
Copy
	
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

As we can see, everything except the tocompress folder itself has been copied because we did not use the -r flag in the cp command. But what happened is what we wanted.

Compress with tarlink image 215

The first command we are going to use to compress is tar to which we will add the -c flag for compress, -v for verbose, so it will show us what it is doing, and the -f flag for file, followed by the name we want for the compressed file and the name of the file we want to compress.

	
!tar -cvf tocompress.tar tocompress
Copy
	
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
	
!ls -l
Copy
	
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