Additional resource (in spanish): Aprenda Linux como si estuviese en primero.
Read the first of the resources in the previous section.
Consider the structure of folders and files in the following figure:
The ovals represent folders and the rectangles text files. Start your Linux system and open a command terminal. With the help of the Linux Cheatsheet, and executing all the commands from the interpreter, solve the following exercises.
In your home directory, create the same folder
structure that is shown in the figure (only the folders). You must
use the mkdir command several times, but you must
execute it without changing the folder, that
is, executing the commands always from your home directory
/home/teleco
(check
the options of the mkdir command in the
manual.
Change the directory in the command interpreter and
go to the Section1
folder. Remember that while
you are typing the name of a file or a folder, the
TAB key completes that name. Once in the
Section1
folder, invoke from the command line
the kate editor. Insert in the file the sentence
“This is the content of file 1” and store it with name
file1.txt
as shown in the figure.
Repeat the same steps with
file2.txt
but instead of creating it entirely
with the editor, first create a duplicate of file
file1.txt
with name file2
with the cp command. Open the new file with the
editor and modify the text to say “... of file
2”.
Repeat this last step, but now you have to create
the files file3.txt
and
file4.txt
. Execute the appropriate commands in
the interpreter (creating a duplicate and edition using
kate) without changing the working
directory. You must, then, use the paths to the new files
such that they reflect the new location in the folder
hierarchy.
Change the working directory in your interpreter
wwith a single command to go to the SecondPart
folder. Execute now the appropriate commands to create a duplicate
of any of the four files previously created and modify its content
similar to what you have done in the previous section. Again, you
should not change your working directory. Remember that while you
type the file and folder names, the TAB key may
be useful to complete their names.
Finally, we do not want the
Section2
folder to be at that level, but at the
level of the FirstPart
and
SecondPart
folders. Thus, from the top
directory LinuxLab
execute a single command
that moves the Section2
folder to its new
location with name ThirdPart
.
Read the manual page for the cat command and use it to show the content of all the files in the previous exercise on the screen with a single command.
Read the manual page for the cp command and create, with a single command, a duplicated of the file tree with which you have been working.
Read the manual page for the rm command and delete the duplicate of the files you just created with just one command.
Read the manual page for the ls
command and execute it in the LinuxLab
folder. Use the options -a, -l
and -t. Try to write them all together to see the
result.
Use the chmod command to chante the permissions in one file. Try to change separatedly the user, group and other permissions. Use the ls command with the appropriate options to see the changes.