
- Kali Linux Tutorial
- Kali Linux - Home
- Installation & Configuration
- Information Gathering Tools
- Vulnerability Analyses Tools
- Kali Linux - Wireless Attacks
- Website Penetration Testing
- Kali Linux - Exploitation Tools
- Kali Linux - Forensics Tools
- Kali Linux - Social Engineering
- Kali Linux - Stressing Tools
- Kali Linux - Sniffing & Spoofing
- Kali Linux - Password Cracking Tools
- Kali Linux - Maintaining Access
- Kali Linux - Reverse Engineering
- Kali Linux - Reporting Tools
- Kali Linux Useful Resources
- Kali Linux - Quick Guide
- Kali Linux - Useful Resources
- Kali Linux - Discussion
What is the Linux Equivalent to DOS Pause?
We know that the Pause command in DOS is used to suspend execution of the batch files and it then displays the message
Strike a key when ready ...
It should also be noted that some versions of DOS also allow a comment to be entered on the same line as PAUSE.
Example
We can make use of the Pause command in a scenario where we want to suspend the execution of a batch file and display the message “Insert Code”, by typing the following command in the terminal
pause Insert Code
So, that was all about the Pause command in DOS, but we want to know how we can achieve the same thing in Linux, since Linux by default doesn’t provide the pause command utility.
There are different approaches we can go for in order to achieve the exact same behavior as of the Pause command, the first and the most common approach is to make use of the read command.
Let’s first learn a few things about the read command.
Read command in the Linux system is used to read from a file descriptor. The read command then splits the line into words.
Syntax
read [options] [name ...]
We can replace the options placeholder in the syntax shown below with the following options mentioned in the table below
-a array assign the words read to sequential indices of the array variable ARRAY, starting at zero -d delim continue until the first character of DELIM is read, rather than newline -e use Readline to obtain the line -i text use TEXT as the initial text for Readline -n nchars return after reading NCHARS characters rather than waiting for a newline, but honor a delimiter if fewer than
The command that is equivalent to DOS Pause is mentioned below
read -n1 -r -p "Press any key to continue..." key
In the above command there are certain flags that are used. These are −
-n1 − It is used to specify that it only waits for a single character.
-r − Used to put it into raw mode, which is necessary as if we somehow press something like backlash, it doesn’t register until you hit the next key.
-p − it specified the prompt.
key − the key argument is only necessary if you want to know which key they pressed
- Related Articles
- What is the Certainty Equivalent Method?
- What is equivalent ratio?
- What is the C++ equivalent of sprintf?
- What is the MySQL SELECT INTO Equivalent?
- What is Python equivalent of the ! operator?
- What is the Java equivalent to MySQL's smallint?
- What is the C# equivalent to Java's isInstance()?
- CSS pause property
- What is the equivalent of EXCEPT in MySQL?
- What is the PHP stripos() equivalent in MySQL?
- How to pause an ABAP program?
- C# Program to Pause a Thread
- MS-DOS Layered Structure
- The ratio equivalent to 3:7 is
- What is the equivalent of SQL “like” in MongoDB?
