Introduction
I actually do code on a Chromebook daily. When I started the time, I didn't know anyone else who coded. That left me to figure out everything by myself and learn everything that makes it easy for me to code now. Or at least, easier than trying to learn everything, all at once.
In this article, I'll show you how to get started with coding on a Chromebook. I'll show you how to install Python3
(Python interpreter), pip
(Python package manager), gcc
(C compiler), g++
(C++ compiler), and some other things.
(I assume you know how to navigate a Chromebook already.)
Getting Started
To get started, you must first enable Linux in Settings.
Open the Settings app, and scroll down until you see "Advanced". It should look like this:
Click on it.
Once you've done that, scroll all the way to the bottom. You should now see a section titled "Developers".
Click on the arrow. There will be a button to "add the development environment" or something similar to that.
Follow the prompts and you're good to go!
Wait for the download to complete and you're good to go!
About the terminal that chromeOS uses
The terminal is actually a Debian terminal. Debian is a version (distribution) of Linux, so if you've used it or Ubuntu before, you'll be very familiar with the commands.
File system
For some reason, Chromebooks separate your Linux Files from your normal files. To see this, open the Files app. On the left, in the navigation bar, you should see a section saying "Linux Files". You cannot access your normal files from Linux, so make sure to always save files you need from your terminal to the correct place.
Using the CLI
Running your first Bash command:
echo "Hello, World!"
#=> Hello, World!
Bash is what the terminal uses for things like switching directories (or folders), printing text, and so on. You can learn it quickly here.
Some other quick and useful commands:
ls # shows all files in your current folder
ls --color=auto -a -F # shows all files with color, trailing slashes after folder names, and includes hidden files
cat $FILE # prints entire contents of $FILE to the output
touch $FILE # make a new file called $FILE
rm $FILE # delete a file called $FILE
mkdir $FOLDER # make a new folder called $FOLDER
rmdir $FOLDER # remove a folder called $FOLDER
Installing some stuff
Installing Python
Python tends to come pre-installed on Chromebooks' terminals. See if it's there with this command:
python3 --version
This should output the version of Python you have. If not, install it like this:
sudo apt install python3
When prompted [Y/n]
, type Y
and hit enter.
Use this to install pip:
sudo apt install python3-pip
Tada!
GCC/G++
These do not come pre installed, so let's download them.
sudo apt install g++
g++
lists gcc
as a dependency, so it will be automatically installed with g++
. You don't have to do more than that. If you only want gcc
, then replace the g++
in the command above with gcc
.
Vim
Vim should come preinstalled. If not, then
sudo apt install vim
Type vim
to get started.
VS Code
You can also download Visual Studio Code. Go to the official downloads page and get the file ending in .deb
. Then open the files app, and double click it.
Press install, and an icon should appear in your launcher.
Go
Open the Go downloads page in your favorite browser.
Select the "Linux" option. It should end in .tar.gz
.
Save it to your Linux files. Not your normal files.
After that, open your terminal. Find where you downloaded the file to.
Now type this to unpack it:
sudo tar -C /usr/local -xzf ./GO_TARBALL_NAME.tar.gz
Replace GO_TARBALL_NAME
with whatever you named the file.
This command unpacks the tarball, and saves Go to /usr/local/go
.
My setup
Here are some of the things I make sure to install:
- Vim
- Python3
- GCC
- Git
- Nasm (assembly compiler)
- Go
Conclusion
- Coding on a Chromebook is doable
- It is not terrifying or atrocious.
- Maybe it's a bit slower, but it does the same stuff.
It's still fun!
What are your thoughts? Have you used a Chromebook? Do you code in another way?