SET$EDITOR: Difference between revisions
Line 2: | Line 2: | ||
==Drop Down Info Box For Setting $EDITOR== | ==Drop Down Info Box For Setting $EDITOR== | ||
<div class="toccolours mw-collapsible mw-collapsed"> | <div class="toccolours mw-collapsible mw-collapsed"> | ||
Set <code>$EDITOR</code> - Quick Guide | Set CLi Text <code>$EDITOR</code> - Quick Guide | ||
<div class="mw-collapsible-content"> | <div class="mw-collapsible-content"> | ||
<b>FIND WHICH SHELL YOU ARE USING</b><br> | <b>FIND WHICH SHELL YOU ARE USING</b><br> |
Revision as of 11:30, 22 June 2025
Drop Down Info Box For Setting $EDITOR
Set CLi Text $EDITOR
- Quick Guide
FIND WHICH SHELL YOU ARE USING
- This command will tell you your current shell.
echo $SHELL
SH SHELL
- Check if EDITOR is already set:
echo $EDITOR
- Set the environment variable:
set EDITOR=nano
- Unset the variable:
unset EDITOR
BASH SHELL
- Check if EDITOR is already set:
echo $EDITOR
- Set the environment variable:
export EDITOR=nano
- Unset the variable:
- will export/set EDITOR to empty string
export EDITOR=
Find your current shell
- Will return your current shell
echo $SHELL
Set $EDITOR
In FreeBSD and other Unix-like operating systems, the EDITOR environment variable specifies the default text editor for command-line operations.
To set EDITOR to the nano text editor, use:
set EDITOR=nano
This ensures that commands or programs needing a text editor, like git commit, will use nano by default.
Nano is appreciated for its simplicity and user-friendly interface, making it ideal for beginners.
Setting EDITOR to nano can be beneficial for:
- Users preferring nano over other editors like vi or emacs.
- Those new to Linux.
To make this setting persistent across sessions, add the command to your shell startup file:
- For Bash: ~/.bashrc
- For Zsh: ~/.zshrc
SH SHELL Checking, Setting, and Unsetting $EDITOR
- Check if EDITOR is already set:
echo $EDITOR
- Set the environment variable:
set EDITOR=nano
- Unset the variable:
unset EDITOR
Once set, you can use:
$EDITOR /home/$USER/somefile.txt
to open files with your chosen editor, in this case, nano.
BASH SHELL Checking, Setting, and Unsetting $EDITOR
- Check if EDITOR is already set:
echo $EDITOR
- Set (export) the environment variable:
export EDITOR=nano
- Unset the variable:
export EDITOR=
- will export/set EDITOR to empty string
Once set, you can use:
$EDITOR /home/$USER/somefile.txt
to open files with your chosen editor, in this case, nano.