On this page6 sections
Write one line into a file. Shut down the little machine holding it. Come back, open the file and find the same line. It is a modest experiment, but it answers an important question: which part of your work survives when the running system stops?
A virtual machine gives Linux a separate practice space, away from an important service. Later lessons will turn this same system into a small service. First, we will give one recognizable file a home and find our way back to it after a restart.
A separate Ubuntu machine for practice
The practice machine runs Ubuntu 24.04, managed by Canonical’s Multipass tool. Your existing computer is the host; the virtual machine is the guest. The guest has its own Linux kernel, users and files, so later exercises can use ordinary Linux service tools without changing the host’s service configuration.
A container shares a host kernel and can offer a different service environment. Containers are useful, but introducing those differences here would add exceptions before the ordinary Linux service is familiar. The Ubuntu VM keeps the exercises consistent. It still uses your computer: keep the files synthetic and leave host-directory sharing unconfigured.
You need permission to install Multipass, an internet connection for the Ubuntu download and room for two virtual CPUs, 2 GB of memory and an 8 GB virtual disk. Allow additional disk space for the downloaded image and host files. Eight gigabytes is the guest allocation, not the whole installation requirement. No Linux desktop is needed; the command line is enough.
Install Multipass using Canonical's current instructions for your operating system. On a managed computer, use the approved installation route. If virtualization is unavailable, an approved disposable Ubuntu 24.04 training VM is an alternative: establish access, then continue at “Confirm the machine, account and directory.” Cloud VMs can cost money, so the default here is a local guest.
Launch the guest from the host
Open Terminal on macOS or Linux, or PowerShell on Windows. These commands run on the host, before entering Ubuntu:
multipass version
multipass launch 24.04 -n linux-basics -c 2 -m 2G -d 8G
multipass listThe first command checks whether the Multipass client responds. The next requests Ubuntu 24.04, calls the guest linux-basics and allocates its resources. The list should show that name as Running. Addresses and the exact display can differ between machines.
The first launch downloads and prepares Ubuntu, so let it finish. If the name already exists, inspect multipass list before creating anything else. Start a stopped guest with multipass start linux-basics. If the terminal cannot find Multipass, return to installation. The command has not reached Ubuntu yet.
Open a shell inside the guest:
multipass shell linux-basicsThe terminal window stays where it was, but a different machine now receives the commands. This shell runs in Ubuntu. Before creating a file, ask it to identify itself rather than trusting the appearance of the prompt.
Confirm the machine, account and directory
Run these inside the guest, one at a time:
hostname
whoami
uname -s
cat /etc/os-release
pwdThe hostname is ordinarily linux-basics; whoami ordinarily reports the effective user ubuntu. uname -s should say Linux. The release file names Ubuntu and its version, and pwd shows the current directory, normally /home/ubuntu in this new session.
Together, those answers tell you which machine replied, which account is acting and where it is in the filesystem. When several terminals look alike, these checks can catch a wrong location before a command changes anything.
If the kernel reports Darwin, you are still on macOS. Enter the guest before continuing. A different training VM may use another hostname, username or home directory; confirm its real values rather than trying to force them to match this example.
Save a line you will recognize
Create a practice folder and put one recognizable line in its first file:
mkdir -p "$HOME/linux-basics"
printf '%s\n' 'Purpose: practice operating a small service.' > "$HOME/linux-basics/lab-record.txt"
cat "$HOME/linux-basics/lab-record.txt"$HOME expands to the guest account’s home directory. Quotes keep the path in one argument. mkdir -p creates the folder if necessary, printf supplies the line and > sends it into the named file instead of onto the screen.
That single > replaces existing contents. Use the practice filename: substituting an important document could overwrite it. Repeating this exact example writes the same line again. The next file lesson covers appending, backups and comparisons.
The cat command should show what you saved:
Purpose: practice operating a small service.If cat cannot find the file, check pwd and try the complete $HOME path above. That path is meant to reach the same file regardless of the shell’s current directory.
Return to the same file after a restart
First leave the guest shell:
exitBack on the host, stop this guest, inspect its state, then start it and enter again:
multipass stop linux-basics
multipass list
multipass start linux-basics
multipass shell linux-basicsStopping ends the guest’s running system while keeping its disk. From the new guest shell, ask for the same file:
cat "$HOME/linux-basics/lab-record.txt"The line should still be there. The terminal experience contains three separate things: a shell for talking to the system, a machine running the work and a disk holding the file. Ending the shell or stopping the VM does not delete that disk.
If the record is missing, check hostname and whoami before creating it again. Another guest or account means another home directory. Find out where you returned first.
Keep the VM for the next lesson. When you are done, exit to the host and stop linux-basics there. The practice system now has a small record you can recognize, and you know how to return to the place that holds it.
Sources and verification scope
The original VM procedure was checked against Canonical’s launch, shell, stop and start documentation. The kernel documentation provides Linux kernel background; Ubuntu’s whoami and uname manuals describe the account and kernel-name checks. The lab record is constructed course material. The original preparation review records two successful runs of the directory, write and read commands and syntax checks of all seven shell blocks. The raw output from those original checks is not retained in this revision’s evidence. On November 2, 2026, a fresh check ran the same file exercise twice in an isolated local directory and checked the seven shell blocks for syntax; both runs produced the expected single line. Those checks do not establish VM behavior. The VM procedure was documentation-reviewed, not executed across supported host platforms. The outputs above describe expected results, not captured VM sessions.
Sources & context
Sources linked in this article. Read alongside the author’s analysis; a citation does not independently verify a publisher’s claims.
- Canonical’s instructions for your operating systemcanonical.com
- launchcanonical.com
- shellcanonical.com
- stopcanonical.com
- startcanonical.com
- kernel documentationwww.kernel.org
- whoamimanpages.ubuntu.com
- unamemanpages.ubuntu.com
