
tnameserv Command in Linux
The tnameserv command in Linux starts a naming service. It can be used as a substitute for the orbd (Object Request Broker Daemon) command. The orbd is a daemon used in CORBA systems. It helps manage how different parts of a distributed system find each other and talk to each other.
The tnameserv command helps programs in a distributed system find each other by name: kind of like a phonebook for programs.
Table of Contents
Here is a comprehensive guide to the options available with the tnameserv command −
- Prerequisites of tnameserv Command
- Syntax of tnameserv Command
- How to Use the tnameserv Command in Linux?
- How to Access the tnameserv Service Remotely?
Prerequisites of tnameserv Command
The tnameserv is included with the Java Development Kit (JDK). Make sure Java is installed on the Linux system. To verify the installation, run the following command −
java -version

If it is not installed, then install using the following commands −
To install Java on Ubuntu, Kali Linux, Raspberry Pi OS, Debian, and other Debian-based distributions, use the following command −
sudo apt install default-jdk
On Fedora, use the following command −
sudo dnf install java-latest-openjdk-devel
Syntax of tnameserv Command
The syntax of the tnameserv command in Linux is as follows −
tnameserv -ORBInitialPort [nameserverport]
In the above syntax, the -ORBInitialPort option tells tnameserv to listen on a specific port for incoming connections. The [nameserverport] argument is used to specify the port number.
How to Use the tnameserv Command in Linux?
To start the naming service on the default port (900), use the tnameserv command without any options −
sudo tnameserv

To stop the service, press the CTRL + C keys.

To start the naming service on port 1050, run the following command −
sudo tnameserv -ORBInitialPort 1050

To start it in the background, use the following command −
sudo nohup tnameserv -ORBInitialPort 1050 > /dev/null 2>&1 &
This ensures the process continues running even after the terminal is closed. If it is started in the background, to stop it, find its PID using the command given below −
ps -ef | grep tnameserv

Now, kill the process using the kill command followed by PID −
sudo kill 12546
How to Access the tnameserv Service Remotely?
To access the service from a remote system, run the Java program using the following syntax −
java <javaprogram> -ORBInitialHost <IP> -ORBInitialPort <port>
Replace the <javaprogram> with the name of the Java program that requires the CORBA Naming Service. Pass the -ORBInitialHost and -ORBInitialPort options to specify the host IP address and the port number of the naming service.
Conclusion
The tnameserv command in Linux is used to start a naming service that helps programs in a distributed system locate and communicate with each other. It serves as an alternative to the Object Request Broker Daemon (ORBD) in CORBA-based systems. Included with the Java Development Kit (JDK), tnameserv can be run on a specified port and accessed remotely by configuring the appropriate host and port options.
In this tutorial, we explained the tnameserv commandâs syntax, usage, installation requirements, and how to connect from other systems.