This is the first in a series of posts on getting started from scratch – with ComputerCraft. I’m playing on a private Creative server (which sort of requested these tutorials), so these posts will cover computers more than turtles.
In this first post, we’ll cover the basics of using the command line: navigating, listing contents, and creating and deleting directories.
Alright, moving on! Let’s craft a computer!
Uhh, yeah, just get a computer from the Creative inventory and place it down. If you’re playing in Survival, here’s the crafting recipe.
Next, right click on your computer.
Welcome to CraftOS! CraftOS is the default operating system that is found in your computer. It uses a command line interface, much like DOS, or the Command Prompt or Terminal on your actual machine.
You can issue commands on your computer. Let’s try
ls. Type the command, then press enter. Also note: commands are case-sensitive!
ls stands for list, and is a command that lists all items in the current folder, also known as the directory.
Notice there is currently only one item in the directory, named “rom”. “rom” is a directory, standing for read only memory, and contains files that allows CraftOS to work. As its name suggests, you can only read items in rom, but you cannot change (or delete) them.
We’ll play with a few commands next: they are
Let’s start with
mkdir, which stands for make directory. However, if you try to run
mkdir, you will get this:
Usage: mkdir <path>
You need a name to name the folder! I’ll name my directory “name”, so I’ll run
mkdir name. I’m not very creative with names.
If you try
ls again, you’ll notice we now have a directory, named “name”.
You can navigate into that directory using
cd, which stands for change directory. Enter
cd name. You can see we are now in directory “name”.
Next, we will enter a series of commands.
At the end, you will notice the area before your cursor states
name/name2> . Commands take place inside where you currently are, as indicated there. When you are in folder “name”, and you create a folder, you will have a folder created inside of name.
Your computer’s files and directories currently looks like this:
- / (We call this the root directory)
- /name2 ( <– you are here)
To go upwards in the folder structure, you use
.. (two dots).
.. can be understood as “one level up”, so entering
cd .. will bring you back to “name”.
.. are known as relative paths, because they are applied relative to where you are now.
cd /rom. You will navigate to “rom”, regardless of where you are.
Paths like “/rom” are known as relative paths, starting from the root directory, which in this case is indicated by the preceding
/ (slash). As a comparison, on Windows absolute paths looks like
Let’s now navigate back to root, by entering
cd /, and listing the contents of root using
Before we end this post, let’s clean up after ourselves by deleting the folders we have created. You can delete “name” and its contents (name2) using
rm stands for remove, and works with both files and folders.
Notice that, unlike your usual computer, there is no confirmation prompts when deleting. Files and folders are immediately deleted, so always be careful with such commands.
Extra: If you try to
rm rom, you will get an error:
> delete rom
delete:9: Access denied
This is because rom, as mentioned earlier, is read-only, so you cannot edit or delete it.