You opened a config file and the terminal swallowed your cursor
You are configuring a systemd service or tweaking a firewall rule. You run sudo nano /etc/firewalld/zones/public.xml. The screen clears. Your prompt disappears. The cursor sits alone on a black background. You type a few characters, hit Enter, and nothing happens. You try to close the window. The terminal refuses. This is normal. Terminal editors do not behave like graphical applications. They run inside the shell, capture all input, and require explicit commands to save and exit.
What the terminal editor actually does
A terminal editor is a text interface that maps keyboard combinations to editing actions. It does not use a mouse. It does not render buttons. It reads the file into memory, displays it line by line, and writes it back when you explicitly tell it to. Think of it like a typewriter with a manual save button. The shell hands control to the editor process. That process intercepts every keystroke. When you are done, it returns control to the shell and drops you back at the prompt.
The editor runs in the foreground. It cannot be backgrounded while you are actively typing. If you open a file as a regular user and the file belongs to root, the editor will load it in read-only mode. You will see a warning at the bottom of the screen. You must either close the file and reopen it with sudo, or switch to a root shell before launching the editor. Editing system configuration files requires elevated privileges. Fedora enforces this strictly.
Pick your editor
Use nano when you need to make a quick change without memorizing modal states. Use vim when you edit configuration files daily and want keyboard-driven efficiency. Use vi when you are on a minimal server image that only ships the base editor. Stay on nano for one-off tweaks. Switch to vim once you edit the same file types more than three times a week.
Fedora Workstation ships with both nano and vim-enhanced preinstalled. The vi command is usually a symlink to vim. If you are on a stripped-down Server install, you may only have vi available. Install the full package with sudo dnf install vim-enhanced if you want syntax highlighting and plugin support.
Working with nano
Nano displays the file contents immediately. The bottom of the screen shows a menu of keyboard shortcuts. Each shortcut is prefixed with ^ for Control and M- for Alt. You do not need to switch modes. You type, you navigate, you save.
Here is how to open a file, make a change, and exit safely.
sudo nano /etc/hostname
# sudo elevates privileges so the editor can write to a root-owned file
# nano loads the file into memory and displays it line by line
# ^O writes the current buffer to disk without closing the editor
# ^X closes the editor and returns control to the shell
Navigation relies on arrow keys and page up/down. Search uses ^W. Replace uses ^ \ (Control backslash). Undo uses ^_ (Control underscore) in older versions, but modern Fedora ships nano 7.x where undo is ^Z and redo is ^Y. The status bar updates automatically. If you modify the file, an asterisk appears next to the filename in the header. That asterisk means unsaved changes exist.
Convention aside: always edit files in /etc/. Files in /usr/lib/ ship with packages and get overwritten on the next dnf upgrade. If you need to modify a package default, copy it to /etc/ first or use a drop-in directory. Manual edits in /usr/lib/ drift and disappear.
Here is how to handle a read-only warning inside nano.
# nano detects the file is owned by root and drops privileges
# ^O prompts for a filename to save the modified buffer
# nano writes a temporary file and attempts to replace the original
# ^X exits cleanly after confirming the write succeeded
If nano prints Cannot open file: Permission denied, close the editor without saving. Reopen it with sudo. Do not force a write. The filesystem will reject it and leave a broken temporary file in your home directory.
Run ^O before ^X. The asterisk in the header is your only warning before data loss.
Working with vim
Vim operates in modes. The default is Normal mode. In Normal mode, every key triggers an editor command. Press i to enter Insert mode. Your keystrokes now type text. Press Esc to return to Normal mode. Press : to enter Command-line mode. Type a command and press Enter.
Here is the standard workflow for opening, editing, and saving a configuration file.
sudo vim /etc/sysctl.conf
# sudo grants write access to the root-owned configuration file
# vim starts in Normal mode and displays the file contents
# i switches to Insert mode so you can type new text
# Esc returns to Normal mode and cancels any pending insert
# :wq writes the buffer to disk and quits the editor
Navigation in vim uses h, j, k, l for left, down, up, right. Arrow keys work but break muscle memory. Search uses /pattern followed by Enter. Jump to the next match with n. Jump backward with N. Delete a line with dd. Copy a line with yy. Paste with p. Undo with u. Redo with Ctrl+R.
Convention aside: Fedora's vim-enhanced package includes a default configuration in /etc/vimrc. It enables syntax highlighting, line numbers, and basic indentation. Do not edit /etc/vimrc directly. Create ~/.vimrc for user preferences. The system file resets on package updates. Your home file persists across upgrades.
Here is how to recover from an accidental save or an unsaved exit.
# vim detects unsaved changes and blocks the quit command
# :q! discards all changes and closes the editor immediately
# vim writes a swap file in the same directory as the target
# vim prompts to recover the swap file on the next launch
If you see E37: No write since last change (add ! to override), you typed :q while the buffer was modified. Add ! to force quit, or use :wq to save. If you see E212: Can't open file for writing, check your permissions. You likely opened the file as root but the editor dropped privileges, or you are trying to write to a read-only mount.
Check :set ft? to verify syntax highlighting is active. Mismatched file types cause broken indentation and missing keywords.
Read the mode indicator at the bottom left. Normal mode commands fail silently if you are stuck in Insert mode.
Verify your changes took effect
Terminal editors do not reload services automatically. They only modify files on disk. You must verify the file contents and restart the affected service.
Here is how to confirm the edit and apply it.
cat /etc/hostname
# cat prints the file contents to the terminal for quick verification
# systemctl daemon-reload reloads unit files if you edited a service
# systemctl restart <service> applies the new configuration immediately
# journalctl -xeu <service> shows recent logs and explanatory text
If you edited a systemd unit, run systemctl daemon-reload before restarting. The init system caches unit files in memory. Without reloading, the service continues running the old configuration. If you edited a network configuration, run nmcli connection reload followed by nmcli connection up <name>. NetworkManager does not watch /etc/NetworkManager/ for changes.
Run cat or less on the file before restarting anything. A misplaced character in a config file crashes the service on boot.
Common pitfalls and exact error messages
Terminal editors produce specific errors when permissions, modes, or file states conflict. Recognizing the exact wording saves time.
E37: No write since last change (add ! to override)
# vim blocks quit because the buffer contains unsaved modifications
# Add ! to force quit, or use :wq to save and exit cleanly
Cannot open file: Permission denied
# nano cannot write to the target path because your user lacks privileges
# Close the editor, reopen with sudo, and retry the edit
E212: Can't open file for writing
# vim attempted to write but the filesystem or directory is read-only
# Check mount options with findmnt, or verify you are not editing a container overlay
W10: Warning: Changing a readonly file
# nano detected the file is owned by root but you opened it without sudo
# The editor will create a new file in your home directory instead of overwriting the original
If you accidentally save a root-owned file as a regular user, nano creates a new file in your home directory with the same name. The original system file remains untouched. Delete the stray file in ~ and reopen the correct path with sudo.
If vim creates a swap file and you lose power, vim prompts E325: ATTENTION on the next launch. Press R to recover, or D to delete the swap file if you already saved elsewhere. Never ignore swap prompts. They indicate interrupted writes.
Reboot before you debug. Half the time the symptom is gone.