conman Command in Linux



The conman is a Linux command that you can use to connect to remote consoles managed by the conmand daemon. The conman command allows you to access and manage multiple consoles from a single interface.

You can use this command in different modes such as for monitoring mode (read-only), interactive mode (read-write) and broadcast mode (write-only). Console names can be matched using glob patterns or regular expressions. This tool is pretty helpful for system administrators who need to manage several remote systems efficiently.

Table of Contents

Here is a comprehensive guide to the options available with the conman command −

How to Install conman Command in Linux?

conman utility is not preinstalled on Linux systems, however, you can install this package directly from the default system’s package manager. For Linux distributions like Ubuntu, Kali Linux or Debian, you can install the conman package from the apt command provided below −

sudo apt install conman
Installation conman Command in Linux

On other Linux distributions like CentOS and Fedora, you can install common package from the yum command given below −

sudo yum install conman

After you are done with conman installation, you can use the below-given command to confirm the package is successfully installed on Linux −

Confirmation of conman Installation

Syntax for conman Command in Linux

The basic syntax to use the conman command in Linux is given below −

conman [options] console

Here’s a brief explanation of the components −

  • conman − The command itself.
  • [options] − Optional command-line options that modify the behavior of conman.
  • console − The specific action or task you want to perform using conman.

Different Options Available for conman Command

With conman, you can use different options, which are provided the table given below −

Option Description
-b Broadcasts to multiple consoles (writer-only).
-d Host Set the server destination, default is 127.0.0.1:7890.
-e Char Define the escape character, default is [&].
-f Force a connection, even if it means taking over an existing one.
-F File Load console names from a specified file.
-h Shows help information.
-j Join an existing connection for console-sharing.
-l File Save connection output to a specified file.
-L Display license details.
-m Monitor the connection in read-only mode.
-q Query the server about specific consoles.
-Q Suppress informational messages for a quieter output.
-r Use regex to match console names instead of glob patterns.
-v Enable verbose mode for more detailed output.
-V Show version information.

Escape Characters Supported by conman Command

The conman command supports the following escape characters, assuming the default escape character is "&".

Tag Description
&? Show a list of available escape sequences.
&. End the connection.
&& Send a single escape character.
&B Send a serial-break to the remote console.
&F Change from read-only to read-write mode using ‘force’.
&I Show connection details.
&J Change from read-only to read-write mode using ‘join’.
&L Replace the last 4KB of console output.
&M Switch from read-write to read-only mode.
&Q Toggle quiet mode to show or hide informational messages.
&R Reset the node linked to this console.
&Z Suspend the client.

Examples of conman Command in Linux

Let’s explore some examples of conman command in Linux system −

  • Monitor Mode
  • Broadcast Mode
  • Query Mode
  • Join Mode
  • Force Mode

Monitor Mode

If you want to monitor a console in read-only mode, you can use the conman command with -m flag followed by the console name. For example, the following command will monitor the console named "ttyS0" in read-only mode.

conman -m ttyS0

Broadcast Mode

You can also broadcast data to multiple consoles in write-only mode using the conman command with -b option followed by the console names. The output won’t be sent back to the client. For example, to broadcast a message to consoles "ttyS1" and "ttyS2", use the below-given command −

conman -b ttyS1,ttyS2

Query Mode

With conman command on Linux, you can also search for specific consoles based on patterns or names. For example, to query for consoles matching "pts/0" and save the output to a file, use the following command −

conman -q pts/0 > console_query.txt

Join Mode

You can also share console access with existing clients having write privileges. It is possible by using the -j option with the conman command followed by the console name. For example, to join the console named "ttyUSB0", run the below-given command −

conman -j ttyUSB0

Force Mode

If you want to steal console access from existing clients with write privileges, you can use the -f option with the conman command and console name in the end. For example, to force write-access to the console "ttyS3", you can use the below-given command −

conman -f ttyS3

Conclusion

conman utility helps simplify the remote console management on Linux systems. Whether you are monitoring consoles, broadcasting messages, or querying specific consoles, conman is a valuable tool for system administrators. You must explore its various options and escape sequences to enhance your console management experience.

Advertisements