Linux display or change a pre-login message – /etc/issue file

Q. How can I configure or change the Virtual Console login to display a pre-login message?

A. The file /etc/issue is a text file which contains a message or system identification to be printed before the login prompt. It may contain various @char and \char sequences, if supported by getty.

Just open file /etc/issue and change the text as per your requirements.

Procedure to change /etc/issue – pre login file

Login as the root user. Open a file
# vi /etc/issue
Append new text as follows:
Welcome to nixCraft Labs!
Today is \d \t @ \n

Save and close the file. \d, \t or \n will expand as follows on run time.

/etc/issue – escape code

The issue-file (/etc/issue or the file set with the -f option) may contain certain escape codes to display the system name, date and time etc. All escape codes consist of a backslash (\) immediately followed by one of the letters explained below.

  • \b : Insert the baudrate of the current line.
  • \d : Insert the current date.
  • \s : Insert the system name, the name of the operating system.
  • \l : Insert the name of the current tty line.
  • \m : Insert the architecture identifier of the machine, eg. i486
  • \n : Insert the nodename of the machine, also known as the hostname.
  • \o : Insert the domainname of the machine.
  • \r : Insert the release number of the OS, eg. 1.1.9.
  • \t : Insert the current time.
  • \u : Insert the number of current users logged in.
  • \U : Insert the string “1 user” or “ users” where is the number of current users logged in.
  • \v : Insert the version of the OS, eg. the build-date etc.

See also

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

🐧 11 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
11 comments… add one
  • vinayak Jul 31, 2007 @ 10:02

    can i please get a way to modify the appearences on linux?
    any thing related to changing the effects of the icons ..changing the mouse pointer colour..etc?

  • Greaty Jan 8, 2009 @ 19:28

    You are talking about the GUI (graphical user interface) and that depends on the distro you are using. If you are using Ubuntu (with gnome) you can play with compiz to change how the mouse and windows, and all that stuff behaves, if you are in a distro that uses kde, like kubuntu, slackware, etc you will have to look at kde window manager. Anyway read about window managers.

  • shantanu Apr 6, 2010 @ 13:00

    That great

  • Abhisek Sep 19, 2011 @ 10:14

    I am newly using linux programming. can anyone help me out of a program
    Write a shell script which gets executed the moment user login and should display message GOOD MORNING/ GOOD EVENING etc depending upon the time the user logs in.

    • Anshul Sep 22, 2011 @ 3:03

      i also wanted to do same ? did u found the answer(9457111030)

  • mullairamani Jul 26, 2012 @ 9:09

    shell script which gets executed the moment user login and should display message GOOD MORNING/ GOOD EVENING etc depending upon the time the user logs in.

  • osirisgothra Jan 28, 2013 @ 17:11

    Correction on the html, you put:
    U : Insert the string “1 user” or ” users” where is the number of current users logged in.

    i noticed in the source you put users but the isnt shown because it is considered to be a tag so it gets hidden, just thought you should know… oh yeah and i think you have to use something like > or something like that to get the greater-than and less-than signs to print when you put them in a form that makes it appear to be a tag (like that ) this comment i am hoping the leave a comment thing automatically does this for me cause I dont remember exactly which one to use :( ….if not just look at the source in plain text, you’ll get the idea…

    PS TO COMMENTERS OUT THERE: DONT FORGET TO SELECT+COPY your texts before hitting that submit button, it will save you alot of greif (and prevent you from going bald!!!)

    • osirisgothra Jan 28, 2013 @ 17:12

      ok so it didnt print them… ok i’l try this again:

      i meant for the >n< to be put up there, my message was a perfect example how this can h appen even when you EXPECT it not to… heheh..

  • jade Apr 22, 2013 @ 19:56

    I have repeatedly vi’d /etc/issue and changed the /ect/ssh/sshd_config files to show what banner to display and what path the banner is in. Argh..still nothing shows up except
    “CentOS 6.2
    Kernel /r /n /m”

    Drivin me nutz.

    I also tried /etc/

    What am I doin wrong.

    I have no network connectivigy and gdm is not installed. Can’t yum it.


  • nikita Aug 13, 2014 @ 15:10

    how can i print something on vcl after loggin out guys..

  • mishael Oct 21, 2014 @ 7:34

    how can hide these message that shown, and place the image instead of message?

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