Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.5: Restore Terminal's welcome message UNIX
After upgrading to Leopard, you'll probably find something missing when you first launch Terminal: "Welcome to Darwin!" For some reason, the file that generates this message, /etc/motd, is not included in Leopard. This means no message of the day in Terminal, or any other app that picks up on the motd file.

You can create a new one, though, using your favourite plain text editor in Terminal. For example, sudo vi /etc/motd. Press a to switch to add mode, then type whatever you'd like for a welcome message -- I went with "Welcome to Leopard!" but I guess "Welcome to Darwin" would have been more appropriate. When done, press Escape, then :w to write and :q to quit.

Next time you open a Terminal window, you'll see your new message of the day.
    •    
  • Currently 3.60 / 5
  You rated: 4 / 5 (5 votes cast)
 
[14,233 views]  

10.5: Restore Terminal's welcome message | 30 comments | Create New Account
Click here to return to the '10.5: Restore Terminal's welcome message' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Restore Terminal's welcome message
Authored by: Makki on Nov 02, '07 08:33:08AM

I followed your instructions but get hung up on the press esc and :W :q part seems to not work for me and says add ! i dont get it im not terminal savy.



[ Reply to This | # ]
10.5: Restore Terminal's welcome message
Authored by: marklark on Nov 03, '07 09:06:08AM

Make sure to use the lower case 'w' in ":w" (to write the file) and 'q' in ":q" (to quit vi).



[ Reply to This | # ]
10.5: Restore Terminal's welcome message
Authored by: diamondsw on Nov 02, '07 08:40:34AM

Please don't torture people's brains with vi. It's about as unfriendly as a program can get. Instead use Nano, which includes a helpful menu of commands at the bottom of the screen:

sudo nano /etc/motd

When done, use Control-X to exit (it's on the menu at the bottom), and save when prompted.

MUCH easier than vi.



[ Reply to This | # ]
10.5: Restore Terminal's welcome message
Authored by: Anonymous on Nov 02, '07 08:49:27AM

It's not that hard to use, really - It's... different.
All you need to know is:
i to go into insert mode mode (where you can insert/delete text as usual)
Esc or ctrl+c to exit control mode
:wq to save and quit
:q! to exit without saving.

If you don't know what ^O means, it's just as hard to use, more or less.
And besides, I'd say emacs is far harder to use :P



[ Reply to This | # ]
10.5: Restore Terminal's welcome message
Authored by: n1mie on Nov 02, '07 06:37:21PM

I loathe vi. It's so arcane and obscure in it's use. I, as others have stated, prefer nano (or pico).

---
--Chip



[ Reply to This | # ]
Vi
Authored by: googoo on Nov 02, '07 07:16:36PM

Like a good beer, a smokey Scotch, and a raunchy blue cheese, vi is an acquired taste. Once you get used to it, vi is a fast and powerful text editor. I prefer it to all other terminal-based editors. That being said, I would never force-feed it to novice users without a lengthy introduction. They would probably just spit it out!

-Mark



[ Reply to This | # ]
Vi
Authored by: corienti on Nov 02, '07 11:09:40PM

vi, if you know it well, is *incredibly* powerful. I use it for almost all text editing. The stuff it can do is just utterly amazing - if you know how to use it (note actually I'm referring to vim more than the original vi).

As a vi user, I can't stand nano; it's pseudo-GUI interface just gets in the way of fast text manipulation.
vi (or vim) is definitely not for beginners though. If you're not prepared to sink some time into learning it properly, stay away from it. But if you are willing to give it a proper go and sink a bit of time into it, you'll never ever look back.
But then I also use sed and awk on a very regular basis...



[ Reply to This | # ]
To Vi or not Vi(|m)
Authored by: TvE on Nov 03, '07 06:11:04AM

I am trying to use vi as my preferred CLI based texteditor, primarily due to the fact that it is supposed to be available on all *NIX platforms, so the idea is to try to get better using a tools available at all places, hence be productive on all platforms, that a more user-friendly tool, that is NOT availble when I need it.

PS.: Can one get vi(|m) to run on Win XP ;-)



[ Reply to This | # ]
To Vi or not Vi(|m)
Authored by: makip on Nov 05, '07 01:39:03PM
Yes. My recommendation is install cygwin (www.cygwin.com) which will provide the familiar unix shells, commands, and man pages. If you have unix skills, then once you have cygwin on your windows system you'll wonder how you managed without it. Cygwin also provides an X client and other packages you can select on install.
If all you want is vim try www.vim.org

[ Reply to This | # ]
To Vi or not Vi(|m)
Authored by: TvE on Nov 06, '07 01:12:03PM

Actually THAT have been on my very-long todo list for a very long period of time, thanx for reminding me!



[ Reply to This | # ]
10.5: Restore Terminal's welcome message
Authored by: ars on Nov 02, '07 10:00:00AM

The problem with vi is that if you don't use it every day one forgets all the different commands (at least I do). I therefore second the use of nano for this. It shows at the bottom of the screen the commands.



[ Reply to This | # ]
10.5: Restore Terminal's welcome message
Authored by: jdw2004 on Nov 02, '07 10:23:34AM

A couple things: Firstly, this isn't really "Terminal's" welcome message, because it's got nothing to do with Terminal in particular. It's the "message of the day" file, which is (usually) displayed at login. This can include when you log in from a remote host.

This brings us to the second point: There is a belief, justified or not, that wording like "Welcome to XYZ" may make it harder to prosecute people who break into your system. They may be able to argue, "But it said I was welcome!" Yeah, yeah, I know, it sounds dumb. And I have no idea whether such a thing ever has been successfully argued. But why give potential ammunition to a cracker? Also, some people think you shouldn't give away any information, like even "this is a Darwin system" (not that any cracker with two brain cells to rub together couldn't figure that out in two seconds anyway). Better for /etc/motd to say "UNAUTHORIZED ACCESS PROHIBITED"...

Oh, and vi is not that hard if all you want to do is very basic editing. That said, I still would have recommended nano or similar, given that most readers are not going to be Unix users familiar with vi. Hey, be glad he didn't suggest you use ed.



[ Reply to This | # ]
10.5: Restore Terminal's welcome message
Authored by: rwmitchell on Nov 03, '07 09:43:06AM

And that is exactly the reason I made my wife remove that "Welcome" mat at our front door, I didn't want a burglar testifying in court that they thought they were welcome to my stuff...

I've done the same thing as you, removing Welcome from motd files, but it really is silly when you think about it. If that was true, people wouldn't have welcome mats at their front door and instead they would say "keep out" and be covered in red speckle.




[ Reply to This | # ]
10.5: Restore Terminal's welcome message
Authored by: mountainbiker on Nov 02, '07 10:51:27AM
For those of you that hate vi, you could do
sudo cat "I love vi and Unix!" > /etc/motd
If you are going to be playing in terminal then you really want to set up your profile, e.g., .profile or .bash_profile.

Commenter #1 - use a lowercase w; that is, :w and :q --or-- simply :wq. vi commands are case-sensitive.

Thanks for the tip and info about alternative editors.

[ Reply to This | # ]
I believe you mean echo
Authored by: boredzo on Nov 02, '07 01:49:17PM

cat will read a file by that name (and fail). echo is the command you're looking for.



[ Reply to This | # ]
That was cat redirect
Authored by: MJCube on Nov 03, '07 04:23:06PM
No, mountainbiker is correct. Notice the > in that line. That takes the standard in and writes it to a file.

[ Reply to This | # ]
That was cat redirect
Authored by: OlKentuckyShark on Nov 04, '07 02:53:34AM

Nope. Give it a try. He definitely meant echo.

That command will attempt to open a file called "I love vi and Unix!" and dump its contents to /etc/motd.

And unless such a file exists, /etc/motd will just end up being blank.



[ Reply to This | # ]
Yepper ... echo (instead of cat)
Authored by: mountainbiker on Nov 04, '07 11:31:24PM
My bad -- use echo:

sudo echo "I love vi and Unix!" > /etc/motd

* and maybe more coffee ... assuming you have coffee on your file system -LOL ZZ

[ Reply to This | # ]
Or ZZ
Authored by: googoo on Nov 02, '07 07:19:28PM

Or you can save and quit from vi by pressing escape followed by ZZ (two upper-case Zs).

-Mark



[ Reply to This | # ]
Turn Off the Welcome Message
Authored by: ccase on Nov 02, '07 11:57:02AM

If you are like me and you would like to turn off the "Welcome to Darwin" message in earlier versions of OS X, or the message of the day in another Unix system, create the file .hushlogin (note the leading period). The file can be completely empty.

From the command line:

% touch .hushlogin

[ Reply to This | # ]
10.5: Restore Terminal's welcome message
Authored by: baltwo on Nov 02, '07 02:19:51PM

Did I miss something? The motd file's been gone since Tiger shipped.



[ Reply to This | # ]
10.5: Restore Terminal's welcome message
Authored by: n1mie on Nov 02, '07 06:34:32PM

I think you must be. I bought this MBP with Tiger pre-installed. It has that file and I am certain I never added it.

---
--Chip



[ Reply to This | # ]
10.5: Restore Terminal's welcome message
Authored by: pwsloss on Nov 02, '07 05:15:54PM

A Power User hint or two for "vi":
To save the edited file and exit, type:
:wq<ret>
or
:ZZ<ret>
where <ret> means "hit the Return" key. I had a friend who responded to such a
prompt by actually typing "<ret>", so I patched the code to accept that response as well. Easier than explaining it to him.



[ Reply to This | # ]
You mean Escape ZZ
Authored by: googoo on Nov 02, '07 07:24:27PM

In vi, :ZZ<ret> only gets you an error message. You mean escape (which causes you to exit the insert mode if you are in it) followed by ZZ (two upper-case Zs). That saves the file (if you made any changes) and quits. Happy vi-ing!

-Mark



[ Reply to This | # ]
10.5: Restore Terminal's welcome message
Authored by: pwsloss on Nov 02, '07 10:15:29PM

True.
<esc> before any command to terminate addition of new text.
No colon with "ZZ"
Glad we cleared that up.




[ Reply to This | # ]
10.5: Restore Terminal's welcome message
Authored by: OlKentuckyShark on Nov 04, '07 02:50:39AM

Nope. Give it a try. He definitely meant echo.

That command will attempt to open a file called "I love vi and Unix!" and dump its contents to /etc/motd.

And unless such a file exists, /etc/motd will just end up being blank.



[ Reply to This | # ]
10.5: Restore Terminal's welcome message
Authored by: OlKentuckyShark on Nov 04, '07 02:52:27AM

Oops, meant for this to be a reply to MJCube above.



[ Reply to This | # ]
No, incorrect
Authored by: rorya on Nov 05, '07 08:43:15AM

Redirection occurring outside the context of sudo(8), will be done as the user who called sudo(8), rather than the user with the privileges of the user provided with sudo(8), such as the superuser in this case.

Therefore, since /etc is a directory owned by the superuser, you must include the redirect within sudo(8)'s context, for the write to succeed. So..:

sudo sh -c 'echo "I love vi and Unix!" > /etc/motd'

---
"Any sufficiently advanced technology is indistinguishable from magic" - Arthur C. Clarke



[ Reply to This | # ]
Re: No, incorrect
Authored by: MJCube on Dec 25, '07 07:01:48PM

Thanks for that explanation, rorya.



[ Reply to This | # ]
10.5: Restore Terminal's welcome message
Authored by: robogobo on Dec 27, '07 04:54:50AM

nerd alert! ;)



[ Reply to This | # ]