How to Run TCL File in Ns2
By reading this article, you can really get to know the required process of running a TCL file in network simulator 2 along with the guidance of our technical experts. Are you getting interested? Let’s start to glance!
Step: 1 Install TCL for Ns2 in Ubuntu
Initially, we have to install the TCL-8.5-dev for Ns2 in Ubuntu through executing the below mentioned commands in the terminal window.
sudo apt-get install tcl8.5-dev tk8.5-dev
![Installation of TCL for Ns2 in Ubuntu](https://www.ns2project.com/wp-content/uploads/2023/05/install-tcl-for-ns2-in-ubuntu.png)
Step: 2 Create Ns2 TCL File in Ubuntu
We have to create Ns2 simulation source code file in workspace location in Ubuntu and that has to be stored in the file extension .tcl. Then, the TCL file includes the code for node and network configuration with basic simulation parameters.
![Creation of Ns2 TCL File in Ubuntu](https://www.ns2project.com/wp-content/uploads/2023/05/create-ns2-tcl-file-in-ubuntu-1.png)
Step: 3 Run TCL File in Ns2
To run the TCL file in Ns2 in Ubuntu, we have to change the Tcl file location through the execution of below mentioned commands.
cd /home/research/Desktop/ns2_tcl_simulation
![Changing TCL File Location](https://www.ns2project.com/wp-content/uploads/2023/05/change-the-tcl-file-stored-location-1.png)
Then, we have to execute the main Tcl file through the implementation of the following commands.
sudo ./ns tcl_Main.tcl
![Run TCL File in Ns2](https://www.ns2project.com/wp-content/uploads/2023/05/run-tcl-file-in-ns2.png)
Finally, the acquire result of running the Tcl file in Ns2 and that to in the Ubuntu terminal.
![Result of Running Ns2 TCL File in Ubuntu](https://www.ns2project.com/wp-content/uploads/2023/05/result-for-run-ns2-tcl-file-in-ubuntu-1024x501.png)
By considering these as the reference, run your own TCL file in Ns2. Besides, if something looks like to be problematic, you are always cheered to avail our assistances.