Finished other CMD exercise.

This commit is contained in:
Nicolás A. Ortega Froysa 2021-11-28 18:59:34 +01:00
parent bad8acb248
commit d18d15f065
30 changed files with 285 additions and 0 deletions

View File

@ -0,0 +1,43 @@
cd
dir
help dir
dir \Q
dir /Q
cls
cd ..
cd
cd .
cd
cls
cd ..
cd
dir
cd F:
cls
cd E:\t4-ej1-2-cmd
cd
cls
dir E:\t4-ej1-2-cmd
cd E:\
cls
cd /d E:
dir E:\t4-ej1-2-cmd
dir t4-ej1-2-cmd
cd /d C:
cls
tree
cls
tree Users
cls
set
cd %HOMEPATH%
cls
set ESCRITORIO=%HOMEPATH%\Desktop
set
cls
set ESCRITORIO=%HOMEPATH%\Desktop
cd %ESCRITORIO%
cd
cls
DOSKEY /h
DOSKEY /h >> E:\t4-ej1-2-cmd\history.TXT

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

View File

@ -0,0 +1,234 @@
\documentclass[12pt,a4paper]{article}
\usepackage[spanish]{babel}
\usepackage{graphicx}
\usepackage{subcaption}
\title{Tema IV Ejercicio I: CMD}
\author{Nicolás A. Ortega Froysa}
\begin{document}
\maketitle
\pagebreak
\tableofcontents
\pagebreak
\section{Hoja De Control Del Documento}
\begin{table}[h!]
\begin{center}
\caption{Documento/Archivo}
\label{tab:document}
\begin{tabular}{|l|c|l|c|}
\hline
{\bf Fecha Última Modificación} & \the\day/\the\month/\the\year &
{\bf Versión/Revisión} & v01r01 \\ \hline
{\bf Fecha Creación} & \the\day/\the\month/\the\year & \hfill & \hfill \\ \hline
{\bf Fecha Finalización} & \the\day/\the\month/\the\year & \hfill &
\hfill \\ \hline
\end{tabular}
\end{center}
\end{table}
\begin{table}[h!]
\begin{center}
\caption{Registro De Cambios}
\label{tab:registro-cambios}
\begin{tabular}{|c|c|c|}
\hline
{\bf Versión/Revisión} & {\bf Página(s)} & {\bf Descripción} \\
\hline
v01r01 & Todas & Creación y elaboración del documento. \\ \hline
\end{tabular}
\end{center}
\end{table}
\begin{table}[h!]
\begin{center}
\caption{Autores Del Documento}
\label{tab:autores}
\begin{tabular}{|c|c|}
\hline
{\bf Apellidos, Nombre} & {\bf Curso} \\ \hline
Ortega Froysa, Nicolás Andrés & 1 \\ \hline
\end{tabular}
\end{center}
\end{table}
\begin{table}[h!]
\begin{center}
\begin{tabular}{|p{4cm}|p{4cm}|p{4cm}|}
\hline
{\bf Preparado} & {\bf Revisado} & {\bf Aprobado} \\ \hline
Ortega Froysa, Nicolás Andrés & \hfill & \hfill \\ \hline
\end{tabular}
\end{center}
\end{table}
\pagebreak
\section{Listado de Archivos}
\begin{figure}
\centering
\includegraphics[width=0.75\linewidth]{imgs/00-abrir-cmd.png}
\caption{Abierto el símbolo del sistema (CMD).}
\label{fig:abrir-cmd}
\end{figure}
El {\em shell} de Windows lo podemos acceder dando al botón de Windows e
introduciendo el texto ``CMD''. Haciendo esto nos encontraremos con una
aplicación que se denomina ``Símbolo del sistema''. Al abrir esto nos
encontraremos con el {\em shell} clásico de Windows (figura
\ref{fig:abrir-cmd}). Como se ve, la línea de entrada muestra un símbolo
\texttt{>} precedido por el ruta (i.e.\ {\em path}) de la ubicación actual.
Esto último también se puede conocer corriendo el comando \texttt{cd} sin
argumentos. Se puede notar también que los directorios de una ruta en el {\em
shell} de Windows están separadas por el carácter \texttt{\textbackslash}. Esto
es diferente a los sistemas UNIX donde se usa el \texttt{/}, que en el {\em
shell} de Windows se usa para los argumentos de comando; lo que en un sistema
se usaría el \texttt{-}.
Podemos ver los archivos de un directorio usando el comando \texttt{dir <file>}.
Si no se especifica el directorio, se mostrarán los archivos del directorio
actual (figura \ref{fig:dir}). Esto comando tiene más argumentos que podemos
conocer corriendo el comando \texttt{help dir} (figura \ref{fig:help-dir}). Uno
de estos comandos, por ejemplo, es el \texttt{/Q} que nos mostrará cuál es el
dueño de un archivo (figura \ref{fig:dir-q}).
\begin{figure}
\centering
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=0.95\linewidth]{imgs/01-dir.png}
\caption{Uso del comando \texttt{dir}.}
\label{fig:dir}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=0.95\linewidth]{imgs/02-help-dir.png}
\caption{Información de ayuda del comando \texttt{dir}.}
\label{fig:help-dir}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=0.95\linewidth]{imgs/03-dir-q.png}
\caption{Comando \texttt{dir} con información de dueño.}
\label{fig:dir-q}
\end{subfigure}
\caption{El comando \texttt{dir}.}
\end{figure}
\begin{figure}
\end{figure}
\section{Navegación}
Se puede navegar el sistema de archivos usando el comando \texttt{cd} (i.e.\
{\em change directory}). Con este comando podemos especificar una ruta a un
directorio en concreto de forma \texttt{cd <dir>} y nos llevará a esa ubicación
en el sistema lógico de archivos. Este {\em shell} también nos permite
autocompletar rutas usando el tabulador, de manera que si especificas una ruta
incompleta y le das al tabulador, intentará completarlo con subdirectorios
dentro de ese directorio que tienen esos primeros caracteres. Y como vimos al
principio, si no mencionas ningún directorio destino simplemente imprimirá tu
ubicación actual. También hay ciertos nombres especiales, en particular
\texttt{.} y \texttt{..}, que hacen referencia al directorio actual y superior
respectivamente -- e.g.\ el comando \texttt{cd test\textbackslash..} nos traerá
realmente al mismo directorio y sería igual que correr \texttt{cd .} en su
lugar.
Para navegar o especificar rutas podemos usar dos tipos de rutas: absolutas y
relativas. Hasta ahora hemos hablado de rutas relativas, que son relativas a la
ubicación actual del usuario en sistema de archivos. Las rutas absolutas nos
dicen dónde está un archivo desde la raíz de un sistema de archivos (e.g.\
\texttt{C:}, \texttt{D:}). Eso sí, de por sí sólo podremos navegar con
\texttt{cd} dentro de un mismo dispositivo (generalmente \texttt{C:}) salvo si
especificamos el argumento \texttt{/D} para acceder a otro dispositivo (figura
\ref{fig:relative-absolute}).
\begin{figure}
\centering
\includegraphics[width=0.75\linewidth]{imgs/06-relative-absolute.png}
\caption{Cambio de dispositivo usando el argumento \texttt{/d}.}
\label{fig:relative-absolute}
\end{figure}
\section{Sistema de Archivos Windows}
Si nos vamos a la ruta raíz del sistema de archivos de nuestro sistema Windows
(\texttt{cd C:}) y imprimimos la lista de todos los archivos dentro de este
directorio veremos algunos directorios interesantes: Windows, Program Files, y
Users (figura \ref{fig:c-drive}). Tienen los siguientes contenidos:
\begin{itemize}
\item {\bf Windows}: contiene todos los archivos relevantes al sistema
operativo en sí de Windows.
\item {\bf Program Files}: contiene los archivos que precisan los programas
del sistema. A veces existen dos directorios, donde otro tiene añadido
``(x86)'', que contendrá todos los archivos de programas de 32-bits (en
sistemas de 64-bits).
\item {\bf Users}: aquí se guardan todos los archivos de los usuarios.
\end{itemize}
\begin{figure}
\centering
\includegraphics[width=0.75\linewidth]{imgs/05-c-drive.png}
\caption{Lista de archivos en \texttt{C:\textbackslash}.}
\label{fig:c-drive}
\end{figure}
Podemos ver todos los archivos que hay dentro de un directorio y sus
subdirectorios de manera recursiva usando el comando \texttt{tree <dir>}. Si no
se especifica el directorio, simplemente mostrará los éstos del directorio
actual.
\section{Variables de Entorno}
Como en cualquier {\em shell} moderno, también podemos hacer uso de variables.
En Windows éstos se señalan poniendo un \texttt{\%} al principio y al final del
nombre (e.g.\ \texttt{\%MYVAR\%}). Podemos ver todos los variables que están
definidos corriendo el comando \texttt{set} (figura \ref{fig:homepath}). Hay
algunos variables que son específicos al usuario, como sería
\texttt{\%HOMEPATH\%}, que referencia el directorio {\em home} del usuario
actual. Podemos usar esto con nuestros comandos de manera que \texttt{cd
\%HOMEPATH\%} nos traerá al directorio {\em home} de nuestro usuario. Podemos
establecer o sobre escribir éstos por medio también del comando \texttt{set},
corriendo \texttt{set <varname>=<value>} (figura \ref{fig:escritorio}).
\begin{figure}
\centering
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=0.95\linewidth]{imgs/09-homepath.png}
\caption{Lista de variables.}
\label{fig:homepath}
\end{subfigure}
\hfill
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=0.95\linewidth]{imgs/10-escritorio.png}
\caption{Definición de un variable.}
\label{fig:escritorio}
\end{subfigure}
\end{figure}
\section{Historial del {\em Shell}}
A veces es bueno poder ver el historial de los comandos que hemos corrido en el
{\em shell}. En Windows esto se hace por medio del comando \texttt{DOSKEY} junto
a la opción \texttt{/h}. Esto nos mostrará todos los comandos que hemos corrido.
También podemos guardar esta información a un archivo por medio del {\em pipe}
\texttt{>} de la forma \texttt{DOSKEY /h >\ history.txt} (figura
\ref{fig:doskey-h}).
\begin{figure}
\centering
\includegraphics[width=0.75\linewidth]{imgs/11-doskey-h.png}
\caption{Historial del {\em shell}.}
\label{fig:doskey-h}
\end{figure}
\pagebreak
\section{Derechos de Autor y Licencia}
Copyright \copyright\ \the\year\ Nicolás A. Ortega Froysa <nicolas@ortegas.org>
\\
Este documento se distribuye bajo los términos y condiciones de la licencia
Creative Commons Attribution No Derivatives 4.0 International.
\end{document}

View File

@ -0,0 +1,8 @@
\babel@toc {spanish}{}
\contentsline {section}{\numberline {1}Hoja De Control Del Documento}{3}{}%
\contentsline {section}{\numberline {2}Listado de Archivos}{4}{}%
\contentsline {section}{\numberline {3}Navegación}{4}{}%
\contentsline {section}{\numberline {4}Sistema de Archivos Windows}{5}{}%
\contentsline {section}{\numberline {5}Variables de Entorno}{7}{}%
\contentsline {section}{\numberline {6}Historial del {\em Shell}}{7}{}%
\contentsline {section}{\numberline {7}Derechos de Autor y Licencia}{8}{}%