
mingetty Command in Linux
mingetty is a command used in Linux to manage virtual terminals and provide login prompts on these terminals. It is particularly useful in systems without a graphical user interface (GUI), and enables users to log in directly from the command line.
mingetty is lightweight and efficient, making it ideal for minimal setups where resources are limited. It replaces the traditional getty in many distributions, providing a streamlined way to handle terminal sessions.
Table of Contents
Here is a comprehensive guide to the options available with the mingetty command −
- How to Install mingetty Command in Linux?
- Syntax of mingetty Command
- mingetty Command Options
- Examples of mingetty Command in Linux
How to Install mingetty Command in Linux?
To get started with the mingetty on Linux, you'll need to install it as it doesn't come preinstalled on most systems. You can do this by using your distribution's package manager. For example −
On Debian-based systems (like Ubuntu), use −
sudo apt install mingetty
On Red Hat-based systems (like Fedora or CentOS), use −
sudo yum install mingetty
On Arch-based systems (like Manjaro), use −
sudo pacman -S mingetty
On SUSE-based systems (like openSUSE), use −
sudo zypper install mingetty
This way, you can ensure that mingetty is properly installed on your Linux system regardless of the distribution you're using.
Syntax of mingetty Command
The general syntax to use the mingetty command on Linux is as follows −
mingetty [options] tty
Where −
- options can include various flags to customize the command's behavior.
- tty specifies the terminal to connect to.
mingetty Command Options
Below are numerous options you can leverage with the Linux mingetty command
Options | Description |
---|---|
--noclear | Prevents clearing the screen before the login prompt. |
--nonewline | Omit the newline before displaying /etc/issue. |
--noissue | Skips outputting /etc/issue. |
--nohangup | Avoids calling vhangup() to disable writing to the tty by other applications. |
--nohostname | Excludes printing the hostname before the login prompt. |
--long-hostname | Displays the full hostname instead of truncating it at the first dot. |
--loginprog | Changes the login application. |
--nice | Adjusts the priority using nice(). |
--delay | Pauses for a specified number of seconds after startup. |
--chdir | Changes to a specified directory before calling the login program. |
--chroot | Executes chroot() with a specified directory. |
--autologin | Logs in a specified user automatically without prompting for credentials. |
--loginpause | Waits for any key before presenting the login prompt. |
Examples of mingetty Command in Linux
Check out these examples to see how the mgetty command can be used in a Linux context −
- Basic Terminal Connection
- Preventing Screen Clearing
- Automatic User Login
- Changing Directory Before Login
- Using a Custom Login Program
- Avoiding Newline Before /etc/issue
- Skipping /etc/issue Output
Basic Terminal Connection
You can kick things off with a straightforward terminal connection using −
mingetty tty1
This command initiates a login prompt on tty1, ready for user authentication.

Preventing Screen Clearing
To keep the current screen contents intact before the login prompt appears, try this −
mingetty --noclear tty1
This way, the screen remains unchanged before showing the login prompt on tty1.

Automatic User Login
For automatic login of a specific user without a credential prompt, use −
mingetty --autologin username tty1
This command allows the specified user to log in directly on tty1.

Changing Directory Before Login
To set a particular directory before the login program starts, opt for −
mingetty --chdir /home/username tty1
This ensures the working directory is set to /home/username before the login prompt on tty1.
Using a Custom Login Program
If you want to designate a different login application, consider −
mingetty --loginprog /usr/sbin/login tty1
This command modifies the login process to use the specified program on tty1.
Avoiding Newline Before /etc/issue
To omit the newline before displaying /etc/issue, use −
mingetty --nonewline tty1
This command keeps the login prompt immediately following the /etc/issue content on tty1.

Skipping /etc/issue Output
If you prefer not to display /etc/issue before the login prompt, execute −
mingetty --noissue tty1
This command bypasses the output of /etc/issue on tty1, going straight to the login prompt.

Note − When you use the command mingetty, it doesn't display output in the terminal as other commands might. Instead, it directly interacts with the terminal you specify (like tty1) and sets up a login prompt or performs the configured actions there.
If you want to see the effects of these commands, you would need to switch to the specified terminal (e.g., tty1). You can usually do this by pressing Ctrl+Alt+F1 through Ctrl+Alt+F6 on your keyboard.
Conclusion
The mingetty is a valuable command in Linux for managing virtual terminals and providing login prompts directly from the command line. It's efficient and lightweight, making it perfect for setups with limited resources. By learning its syntax and exploring various options, you can effectively use mingetty to enhance your terminal management.
Whether you're setting up automatic logins, adjusting directories, or customizing login programs, mingetty provides a flexible and powerful solution for your needs.