CH-J Toolsserver management over SSH
Menu
All guides and articles →

How to edit source code directly from your phone

Securely open local or remote text, preserve encoding, and resolve concurrent changes. Save, check syntax, and verify the result on the real server.

App screenshots

How to edit source code directly from your phone
Selecting remote files before editing; the editor itself is not captured here. iPhone. Actual UI of development build from 11/29/2026, English UI and test data. This is not proof of a live connection or compliance with release 0.0.4.

A small code change needs the same order as on a computer

A phone is great for correcting a typo, checking a configuration, or making a small, targeted edit. But a smaller screen doesn't diminish the impact of a change. First, identify the file, the environment, and the expected result. Editing the same name on a test server, in staging, and in an active production revision can have completely different effects.

Distinguish between editing a local document, a file at a provider, and a remote file via SFTP. A local copy does not itself become a published site. Also, a successful save to the server may not activate a new state if the deployment uses a generator, container image, or immutable revisions. You need to know the authoritative source and the established publishing procedure.

CH-J Tools Mobile in the 0.0.4 series provides a local and remote text editor. Please check your version for specific offerings; TestFlight on iOS may not offer the same build as Android. This guide describes the workflow and limitations, not a promise of a full-fledged replacement for any desktop IDE.

Open the correct source and confirm its origin

For a remote file, first verify the profile and SSH host, then navigate to the correct directory. Don't just infer the destination from the bookmark name. The relative path in the home directory is different from the same name in the webroot. If the paths are symlinked or generated, find out their actual role before editing.

# Čtecí kontrola ve vzdáleném terminálu:
whoami
hostname
pwd
ls -l /cesta/ke/konfiguraci

When opened locally via the system selection, the document can be provided by the phone's storage, external disk, or cloud. On Android, the application works with the given document URI, and on iOS, with the corresponding file provider. Therefore, the user's folder label may not express the usual absolute POSIX path. Check the destination selection when Save As as carefully as you would the remote profile.

Don't send sensitive configuration between multiple editors and chats just because one method of opening fails. The file may contain passwords or tokens, and each copy extends the storage space. Use a harmless snippet to reproduce the error, while leaving the original in an allowed environment.

Encoding, line endings, and binary file

Text may use UTF-8, BOM, UTF-16, or older encodings. Incorrect decoding sometimes looks like randomly broken diacritics, and saving it back can destroy the original bytes. If the editor offers a choice of encoding, choose it based on the actual file and check the preview. Don't do a blanket conversion as a side effect of one small fix.

Also keep LF or CRLF and the presence of a trailing newline as per the project. For scripts and some tools these differences have practical significance. A huge diff of the entire file after a single word change often indicates recoding or line breaks. Before publishing, find out the reason instead of approving the change based on a correct-looking preview.

Binary data, an image, or an archive is not a text source just because it can be opened with a hexadecimal viewer. Viewing an archive also does not mean it is safe to edit its contents. Use an appropriate tool and do not overwrite a binary file by saving it as text. If you are not sure of the type, first determine it with a read check.

Limit editing and search with context knowledge

Before making a change, have the original content or another suitable fallback available. Fix as little of the meaningful part as possible. Syntax highlighting helps readability, but does not confirm syntactic correctness or value safety. In configuration, it is often more important which block a directive is in than what color it is.

Find and replace with regular expressions is a powerful tool even on your phone. Before mass replacing, check the scope and a few specific matches. The same text can belong to a comment, a test, and a production value. Also, check if you are not or mistakenly case-sensitive and if the replacement works with the expected groups.

For long lines, watch out for hidden parts, keyboard autocorrects, and quote replacements. Paste from an external source may contain typographical characters or an additional newline. Therefore, read commands and configuration values in their entirety before saving, especially if they are to change permissions or the address of the target service.

Resolve concurrent change conflict by comparing, not forcing

Between loading and saving, the same file may have been modified by another administrator, automation, or generator. The editor therefore needs to verify that it is still saving against the same original state. CH-J Tools Mobile performs a change check on supported sources. Its warning is not a broken button, but information that overwriting may destroy newer work.

Keep your own commit, fetch the current remote state, and compare the difference. Then consciously merge the changes and save them against the new baseline. It can be tempting to force a fix when you need to, but that just pushes uncertainty onto the server content. Don't mistake a deliberate commit of an overwrite for a resolved conflict.

Atomic file replacement helps prevent another reader from seeing half of the content that is being saved. However, it is not a database transaction across multiple files, does not guard the application's relevance, and does not imply automatic deployment. If a change requires consistency across multiple files, use an established publishing mechanism.

SFTP and targeted sudo storage have different options

Regular SFTP works under the logged in account. Saving over a temporary file and renaming may require permissions to the directory, not just the original file. If the write is denied, first find out the specific permissions and save state. Automatic chmod 777 would sometimes change the result, but also create unwanted access.

The 0.0.4 mobile series offers editor save via sudo with confirmation and password for supported Linux processes. The goal is to preserve the original permissions and verify the state of the file, not to allow general root access. This feature is not a universal privileged read of files that the account could not open. A different scope may be available for a different operating system or older build.

If sudo rejects a policy or requires another method of authentication, do not fix it by disabling security for all accounts. Verify administrator privileges and supported procedure. Enter the password only for the expected targeted operation and do not include it in the text of the command that would remain in the history or in the file being edited.

Syntax checking and actual application of the change

After saving, use validation appropriate to the language and the actual environment. JSON, YAML, or XML editor validation does not verify all application policies. Properly closed parentheses do not exclude an invalid path, bad port, or missing required value. Additionally, for a server service, the file being loaded may be different from the currently open copy.

# Příklady kontrol podle skutečného typu; zvolte jen odpovídající příkaz:
php -l /cesta/aplikace.php
python3 -m json.tool /cesta/config.json > /dev/null
sudo nginx -t

PHP CLI check is not a full simulation of a running FPM request. Nginx -t does not confirm backend availability and JSON parser does not know business meaning of configuration. So after success, proceed with proper approved reload or publisher and safe functional test. Don't restart all services just because you don't know which change is being applied.

If it fails, revert your specific change and re-verify the state. Don't overwrite the old full file with other people's newer concurrent work. Use the proper rollback for the system for unchangeable revisions. Only a real test confirms that the saved code produced the intended behavior.

What should remain after completion?

Read the final diff or other comparable difference and note the purpose, location, and result of the test. The note does not include passwords or entire non-public configurations. If an export or backup copy was created on the phone, decide whether to store it securely or delete it as needed. A file left in shared documents may be more sensitive than the Vault application itself.

  • The correct resource on the correct server or provider was modified.
  • The encoding and line endings match the project, and the diff has the expected range.
  • The concurrent change is resolved and newer edits are not lost.
  • Permissions, syntax, and functional test after activation match the target.
  • There is a clear return and no unwanted copies of secret data remain.

A phone is a useful tool for targeted editing, if you can follow this process. For a large change with multiple bindings, tests, and difficult recovery, a full desktop environment may be more appropriate. What matters is the review of the result, not how big the screen is that you wrote the change on.

Frequently asked questions

Is syntax highlighting the same as validation?

No. It helps readability, but it does not itself confirm syntactic or application correctness.

Why does saving report a changed file?

Someone else may have edited the content since it was loaded. Keep both versions, compare them, and merge the changes against the current baseline.

Does atomic save mean application deployment?

No. It addresses file replacement, not all publishing steps and functional dependencies.

Can sudo save automatically open every unreadable file?

No. The described mobile series does not involve universal privileged reading and browsing of the entire server.

Detailed documentation

CH-J Tools Mobile: editor and published information →

Android: documents and system providers →

PHP: syntax checking via CLI →

NGINX: configuration and application of changes →

Biometric unlock and security →

All tutorials by category →