Serious Problem

Hi,

This may be a really novice question but I'm a new FreeBSD user. I need some help. I've entered the command chsh as a root user on the system. I entered an editor environment and I couldn't exit.

What is the command to exit the environment? I've also entered some commands on the editor which I couldn't erase, any methods to clear them and exit the system?

Kind Regards,
 
You are most likely inside vi(1). You can quit vi (without saving) with <ESC>:q! (that's escape key, colon, q, exclamation mark and hitting enter).
 
Thanks for the prompt reply.

But when I click esc key it doesn't appear on the interface and when I click the letter q,
it says 'q isn't a vi command'

I couldn't execute the <ESC>:q!
 
You forgot the colon (:).

You won't see the escape, just hear a beep. When you start typing :q! this will appear on the bottom left-hand side.
 
@andy8: it would be a very, very good idea for you to learn (n)vi if you're going to be working on unix / unix-like systems. Search the 'net for some tutorials.

-------

In the meantime, FreeBSD includes an "easy editor". To try it out, use one of the following (based on the shell your account is using).

For c shell-based:
Code:
setenv EDITOR /usr/bin/ee

For Bourne shell-based:
Code:
export EDITOR=/usr/bin/ee

From that point on, most commands that invoke an editor (including chpass(1), crontab(1), and others) will use ee(1) instead of vi(1). If you decide you like it, you simply put the same statement in your account's shell startup file.
 
It should also be added, quickly, that you should not change root's shell. It can leave you stranded at bad times.
If you really want something other than csh for root, add a bit to the end of your .cshrc:
Code:
if (-f /usr/local/bin/bash) then
  exec /usr/local/bin/bash
endif
 
Yes, vi. It's a really good editor but it has a massive learning curve. The 'best' part of it is that you can usually find it on every unix or unix-like system. So, at least learn the basics of it. Like editing and exit with/without saving for instance ;)

Don't worry, I actually ended up rebooting my machine when I first encountered vi and couldn't figure out how to quit the damn thing.
 
Can't understand the vi fans (no offence) =) Usually on fresh install I set up the net with [cmd=]ee /etc/rc.conf[/cmd] and then just [cmd=]pkg_add -r mc[/cmd] :P
And yes, I'm using noobish mcedit to solve my tasks and don't think about editor things ever. �e
 
SirDice said:
Yes, vi. It's a really good editor but it has a massive learning curve
Mmm, I disagree. Compared to everything else one needs to learn to administer a Unix system, vi is a drop in the ocean... and a well worth drop! :)
 
SirDice said:
I actually ended up rebooting my machine when I first encountered vi and couldn't figure out how to quit the damn thing.

Hahahaha, good old times; happened to me to :))
 
Back
Top