Tutorials
Handy Terminal Commands For Newcomers (a story)
From now on, your terminal will be less mysterious.
Mon 22 August 2022
The story
So you want to write some notes about your cat’s health. The first question might be: “Where am I on my computer?”
Type: pwd
Okay, you are in the /Users/mario
folder.
Where mario
is the name of your account.
You start thinking about the right place put these notes. You want to see what is inside the current folder.
Type: ls
You can see a list of folders.
- videos
- photos
- notes
You know you want to write a note, so you want to switch to the notes folder.
Type: cd notes
Now you are inside the notes folder.
To get proof of that, type pwd
again and you should get: /Users/mario/notes
What does this folder contain? You already know the command: ls
In this case the output will be:
- car
- dog
- doctor
- pasta.txt
None of those are appropriate locations for the task at hand, right? The goal is to take some notes about your cat. So, let’s create a folder for this purpose.
Type: mkdir cat
If we try ls
again, the output should be:
- car
- cat
- dog
- doctor
- pasta.txt
Switch to the cat folder.
Type: cd cat
Now that you are in the right place, it’s time to create a file to store your notes.
This file will be in plain-text format, so use the extension .txt
.
Type: touch note1.txt
The touch
command allows you to create an empty file.
If you run ls
, you will see a new note1.txt
file in the list.
You have created a file! 🎉
It’s time to write down how Prezzemolo (your cat) is doing.
Type: open note1.txt
This will open your file with the default application associated with .txt
files. If you are using MacOS, that will probably be TextEdit, or if on Windows, perhaps Notepad.
Once the file is open, write the following in the document:
2022-08-12
Today Prezzemolo is fine, but I think he ate too much lasagna this morning.
Save the file and close your editor software.
Done! Now your note will live with you forever. Or at least until your computer goes up in flames. But that problem can be avoided just by keeping a backup somewhere. On Fortressa there is an app called Syncthing that does backups without slowing down your computer.
Two days later…
You decide you want to check the content of your note. You want to know how your cat was two days ago, because now he doesn’t seem to be feeling well.
You can open the file using open
again, or you can try something faster.
Type: cat note1.txt
The output should be:
2022-07-12
Today Prezzemolo is fine, but I think he ate too much lasagna this morning.
Now you know why he isn’t feeling well. The other day Prezzemolo ate too much lasagna.
Okay, got it. Less lasagna for Prezzemolo next time.
And also, now you know how to perform these actions in a terminal console:
- switch folders
- create new files
- edit files
- see file contents
It can be complicated right?
Fortunately, you don't need to know the terminal to use Fortressa. Just log into the platform and install the services you need 😉