Change default Linux / UNIX text editor from VI to Pico

Q. I find vi hard to use. How do I change my default text editor from vim / vi to Pico under Debian Linux?

A. To use and change an editor to edit your text message, set the variable EDITOR to the pathname of the vi / vim binary file. You need to use export or set command for the same purpose.

Many Linux / UNIX command read shell EDITOR environment variable to determine which editor to use for editing a text file.

Set default text editor to pico

Type the command as follows:
$ which pico
Output:

/usr/bin/pico

Now setup a new text editor:
export EDITOR=/usr/bin/pico
OR
export EDITOR=pico

Add above line to ~/.bashrc file:
$ vi ~/.bashrc
Append text as follows:
export EDITOR=pico
Close and save the file. There is no no need to reboot system.

Also you can add alias if you want:
alias vi=/usr/bin/pico


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 16 comments so far... add one


CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
16 comments… add one
  • soraver May 6, 2008 @ 12:38

    just a small suggestion:
    alias pico=’nano -w’

    thats because not every distro has pico symlinked to nano (nano is the open source pico) and because nano by default wraps long lines (-w).

    also someone might be interested in seting TERM to linux
    export TERM=linux
    so he can use home/end/delete and numpad correctly in nano and also in shell

    hope im not too much offtopic (a)

    • Ray Mar 3, 2013 @ 17:23

      Nice tips :)

  • Dan Jul 6, 2008 @ 18:58

    Thanks for the handy reference!

  • John Aug 6, 2008 @ 8:48

    Thanks for the help. Very useful and concise explanation.

  • Stan Jul 8, 2011 @ 19:52

    “alias vi=/usr/bin/pico”

    Blasphemy!!

    But thanks… I needed the editor variable info :).

  • Slobo Jan 26, 2012 @ 20:57

    Thanks a hundred thousand times! I hate vim !!!

  • FOppe Feb 29, 2012 @ 23:18

    export EDITOR=$(which nano)
    in /home/$USER/.profile
    .profile is the last of the shell initialisation files to be loaded. The $(which nano) – or whatever editor of your taste- is a bash trick. everything in $(…) will be evaluated, so `which nano` will be evaluated to /usr/bin/nano or herever it’s located.

  • Jose Jun 17, 2012 @ 22:32

    Thanks a thousand times!

    I hate vim too !!!

  • test Jun 26, 2012 @ 16:19

    Need to change the default editor (that opens files) from EMACS to VIM.

    The $EDITOR env variable doesn’t help (this is already vi). If anyone knows, can they help?

    Thanks.

  • test Jun 26, 2012 @ 16:21

    Need to change the default editor (that opens files) from EMACS to VIM.

    The $EDITOR env variable doesn’t help (this is already vi). If anyone knows, can they help?

    Thanks.

    Update: Solved. No need for follow-up

  • adeel Sep 26, 2012 @ 7:15

    I used same procedure to set default editor = kate but its not working. can anybody tell?

  • al1reza Feb 27, 2013 @ 19:54

    just vim I love vim

  • Jarod Chiang Apr 8, 2013 @ 8:21

    for Ubuntu user:
    sudo update-alternatives –config editor
    # Type the number which corresponds to Vim here (after installing it) then press Enter.

  • Whyvi Jul 2, 2013 @ 17:53

    Why set an alias of vi as pico.

    That is pure evil.

  • Anonymouse Sep 4, 2013 @ 16:19

    Because VI is not an editor as people commonly refer to, it’s a manipulator. Nano is a powerful yet simple editor.

  • Tanker Mar 1, 2015 @ 22:00

    Thanks guys! :D
    Keep on linuxin in the free world – Neil Young.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum