Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-09-2012, 12:10 AM   #1
LQ Newbie
Registered: Nov 2012
Posts: 1

Rep: Reputation: Disabled
Question Linux Prompt user/Greeting

I can't seem to get this right.
Lets say I have root privileges and I wanted:
a ) edit the user prompt to show "linux1234$" whenever they log-in.
b ) Show a message for users upon logging in.

I know a) has something to do with editing PS1. but how to only apply the change for users?

b ) I know there are or is a file that will enable me to accomplish this, but which or what are they?

I'm pretty new to this, so any help or guidance will be appreciated.

Thanks in advance...
Old 11-09-2012, 07:34 AM   #2
Senior Member
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Linux Mint, Ubuntu
Posts: 1,576

Rep: Reputation: 349Reputation: 349Reputation: 349Reputation: 349
Here's where I'd start:
For individual users, ~/.bashrc.
For everyone, /etc/bashrc (or /etc/bash.bashrc, depending on distro)
Old 11-09-2012, 08:31 AM   #3
Senior Member
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
(1) In order to set user prompt, add following 2 lines at the end of /home/<user>/.bashrc file as follow (for bash):
export prompt
For c shell or ksh, do change the syntax to set prompt="linux1234$" and append the same in .cshrc or .kshrc file. Also if 1234 is command number, then use, prompt="linux\!$"

(2) To set a greeting message, just add your message in /etc/issue or /etc/motd file.

Last edited by shivaa; 11-09-2012 at 08:33 AM.
Old 11-09-2012, 09:09 AM   #4
Registered: Sep 2012
Posts: 48

Rep: Reputation: Disabled
There are actually 2 questions:
How to set prompt and how to shoe some message to the user.
There is simple script /etc/profile.d/
PS1=`hostname|cut -d. -f1`:'['${USER}']''$PWD: '
if [ "$TERM" != "dumb" ]; then
if [ -f /etc/motd -a -s /etc/motd ]; then
cat /etc/motd

Then you can update /etc/motd if you want it to be shown at login time.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
greeting to linux community lami's Linux - Newbie 2 10-11-2012 02:09 PM
greeting linux user... dudastt Member Intro 1 02-07-2012 07:30 AM
Greeting to you all LQ User..... crytek80 Member Intro 2 09-24-2010 05:45 AM
SMB, user prompt , I can not conect to linux from windows. fabianCastle Linux - General 3 05-05-2003 08:12 PM
Sending Greeting mail to new user ranjit001 Linux - Networking 1 01-02-2001 11:58 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:45 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration