Sometimes it can be a fun exercise to try doing a normal task using unusual tools. This is a case where I found myself offline with only a phone (no internet) and also no apps to write HTML files with.

Luckily, I had a terminal app already installed on my Android, so I had access to the command-line and whatever came pre-installed on my phone.

First I looked around to find a folder I had permissions to write in, and discovered that I could write files on my SD card, and also view them in the Chrome browser.

I poked around looking for a command-line editor that might be installed ( vim , nano , emacs , edit , etc…) and even looked through the installed software for anything that even sounded like it might edit a file (and there are some weird names for command-line utilities on Android. Still no luck.

I recalled that you could use echo to print text, and > to send the output of a command to a file.

$ echo 'This text will be output to test.txt' > test.txt

The above example would produce a file in the current folder named test.txt that would contain the text 'This text will be output to test.txt'. How do we verify this? Another useful command called cat (short for 'concatenate') which is used to display the contents of one or more files. We could verify that our test.txt file has been written by issuing the following command:

$ cat test.txt

The result:

$ cat test.txt This text will be output to test.txt

Aha! Now we're getting somewhere, if we were to echo an entire HTML file written as a single line of text, and then send that to a new HTML file we should be able to view that in Chrome. Keep in mind that we can't go back in and edit our document, only overwrite it with new content.

$ echo '<!DOCTYPE html><html><head><title></title></head><body></body></html>' > index.html

That's a barebones HTML page with no content, but when we use cat it shows our entire HTML file on one line because we haven't added line breaks.

$ cat index.html <!DOCTYPE html><html><head><title></title></head><body></body></html>

To add line breaks manually we need to add them with the

escape character. Then we can also add whitespace after each line break so our code is indented and easy to read. A nicer formatted HTML file might look like this instead:

$ echo '<!DOCTYPE html>

<html>

<head>

<title></title>

</head>

<body>

</body>

</html>' > index.html

Which produces output like this from our cat command:

$ cat index.html <!DOCTYPE html> <html> <head> <title></title> </head> <body> </body> </html>

Now if you get stuck on a flight with nothing to do, at the very least you can get cozy with the linux command-line and make some HTML.

Life finds a way!

If we're ready to see how this works and looks from actual Android screenshots, here are some captures from my attempt: