Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Linux bye Command

Linux bye Command

Linux Command Reference Linux Command Reference

bye The command is typically used to exit the current shell session or terminal window.

When you finish your work and want to close the terminal window or exit a remote login, you can use bye to end the session.

Although bye is not a standard Linux command, but in some environments (such as certain shells or specific terminal emulators), it is used as exit or logout an alias, used to end the current session.

In FTP mode, typing bye interrupts the current connection and ends the FTP session.

Syntax

bye


bye How to use the command

Basic Usage

Type in the terminal bye and press Enter to exit the current shell session. For example:

bye

After running the above command, the current shell session will end, the terminal window may close, or you will return to the login screen (in the case of a remote login).

The difference between exit and logout and

Customization bye Command

If you want to use the bye command on your system, but it is not predefined, you can customize it in the following ways:

1. Create an alias: You can bye to exit or logout as an alias. For example, in ~/.bashrc add the following to the file:



alias bye='exit'

Then run source ~/.bashrc to make the changes take effect. In this way, every time you type bye , what actually executes is exit command.

2. Create a script: You can also create a simple script file named byeand place it in your PATH directory included in your environment variable. For example:



#!/bin/bash

exit

Save as bye file and give it execute permission:



chmod +x bye

Then move the file to /usr/local/bin or another PATH directory included in:



sudo mv bye /usr/local/bin/

In this way, you can use the bye command anywhere.

Notes


Linux Command Reference Linux Command Reference