edit
Edit files
TLDR
Edit action can be used to view any file on default mailcap explorer
With run-mailcap
SYNOPSIS
edit [OPTIONS]... [FILE]...
PARAMETERS
[OPTIONS]...
Any options provided are passed directly to the invoked text editor. These can include editor-specific flags like -R (read-only), +N (jump to line N), or -c command for executing editor commands.
[FILE]...
One or more files to be opened for editing by the invoked text editor.
DESCRIPTION
The edit command is a generic utility designed to invoke a user's preferred text editor for file manipulation. Unlike specific editor commands like vi or nano, edit acts as a wrapper or a symbolic link, typically resolving to the editor configured by system-wide defaults, environment variables (such as EDITOR or VISUAL), or user preferences. Its primary purpose is to provide a consistent and convenient way to open a file for editing without needing to remember the specific editor command. Historically, edit might have referred to simpler line editors, often a subset of ex, but in modern Linux systems, it commonly points to more full-featured editors like vim, nano, or emacs, often via utilities like sensible-editor or the update-alternatives system.
CAVEATS
The behavior of edit is highly dependent on the system's configuration and the user's environment variables. Its specific functionality and available options are determined by the underlying editor it invokes, which can vary significantly between systems or even between user sessions. Users should be aware that edit is not a standalone editor but a convenient abstraction for launching another program.
ENVIRONMENT VARIABLES
The behavior of edit is often influenced by environment variables. The EDITOR variable (e.g., EDITOR=vim) specifies the preferred editor for shell commands that invoke an editor. The VISUAL variable (e.g., VISUAL=nano) is similar, often preferred for visual, full-screen editors. If both are set, VISUAL typically takes precedence for interactive use.
SYSTEM CONFIGURATION
On many systems, utilities like sensible-editor (part of the debianutils package on Debian-based systems) or the update-alternatives command are used to determine which specific editor edit should invoke. This provides a system-wide or user-specific default choice, allowing administrators or users to easily change their preferred editor without modifying scripts or aliases.
HISTORY
The concept of a generic 'edit' command dates back to early Unix systems, where it often served as a simplified interface to a line editor like ex. This provided a less intimidating entry point than the full editor. Over time, as more sophisticated screen-oriented editors emerged, the role of edit evolved. In modern Linux distributions, it typically functions as a wrapper, often implemented as a symlink to sensible-editor or configured via the update-alternatives system. This evolution reflects a shift from a basic line editor to a mechanism for invoking a user's preferred, full-featured text editor.
SEE ALSO
sensible-editor(1), vi(1), vim(1), nano(1), emacs(1), ex(1), update-alternatives(8)