Read Linux Tutorial Part1, before you start here.
Commands you have head about in Part1 are:
whoami, hostname, uname, uptime, clear, pwd, cd, echo, ~ and ..
In the second part of the Linux Tutorial, we will learn about dealing with files and folders (directory).
First move to your home directory with (change directory):
Now let us create a directory, named „garage“, with the „make directory“ command:
You have created the garage directory, but you are still inside your home directory. Go into the garage directory with:
Notice, that the „change directory“ is by far the most important command. You will see, that you will use this command very often.
In the next step, you go „one directory up“, so that you will be in your home directory again. This can be achieved with:
Don’t forget the space between „cd“ and the two dots. The two dots is a sign for the directory above. There is a top-level directory, called the root. There is no directory above the root directory. You can go there with:
Again, there is a space between „cd“ and the „slash“. If you are curious whats inside the root folder, type:
The list command, with the parameter „l“, shows you the directories content. Time to go back into our garage directory inside our home directory. Go there with:
The tilde (press Alt-key + tilde-sign) is a sign for our home folder. And we want to go inside the garage folder, which is inside our home folder. We create now a file called „mycar.txt“ and write „bmw“ inside this file. Here we go:
The echo command simply displays the word in quotes, in this case „bmw“. The > character redirects the result („bmw“) into the file, which came behind the „>“ sign. Btw: a single „>“ always create an empty file, even when the file already exists. When you want to attach something to a file simply use „>>“. Let’s look into the file:
We want to copy the file mycar.txt:
And now we want to attach something to our new file:
echo "is not a car" >> mybike.txt
Check the content of our new file with:
And check the contet of our garage folder with: