I've been at this all day now, reading every single type of different way to add these lines. It resulted in me being locked out of my profile because I set the .profile wrong. So I'll just ask the very simple question: What do I type in the command shell to get the following to work.

Please put /home/karl/ns-allinone-2.35/bin:/home/karl/ns-allinone-2.35/tcl8.5.10/unix:/home/karl/ns-allinone-2.35/tk8.5.10/unix
into your PATH environment; so that you'll be able to run itm/tclsh/wish/xgraph.


(1) You MUST put /home/karl/ns-allinone-2.35/otcl-1.14, /home/karl/ns-allinone-2.35/lib, 
    into your LD_LIBRARY_PATH environment variable.
    If it complains about X libraries, add path to your X libraries 
    If you are using csh, you can set it like:
        setenv LD_LIBRARY_PATH 
    If you are using sh, you can set it like:
        export LD_LIBRARY_PATH=

(2) You MUST put /home/karl/ns-allinone-2.35/tcl8.5.10/library into your TCL_LIBRARY environmental
    variable. Otherwise ns/nam will complain during startup.

After these steps, you can now run the ns validation suite with
cd ns-2.35; ./validate

For trouble shooting, please first read ns problems page 
http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive
for related posts.

I am supposed to add these to get my .tcl scripts to work as I keep recieving the error

**invalid command name "new"
    while executing
"new Simulator"
    invoked from within
"set ns [new Simulator]"
    (file "test.tcl" line 2)**"
Which is a result of my path varibles not being set correctly.

What do I type in my default 12.10 terminal to get this to work.

2 Answers 2


Running the following commands should set all the requested variables:

export PATH=$PATH:/home/karl/ns-allinone-2.35/bin:/home/karl/ns-allinone-2.35/tcl8.5.10/unix:/home/karl/ns-allinone-2.35/tk8.5.10/unix
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/karl/ns-allinone-2.35/otcl-1.14:/home/karl/ns-allinone-2.35/lib
export TCL_LIBRARY=/home/karl/ns-allinone-2.35/tcl8.5.10/library

You can either run these commands before running the scripts or add them to your .profile or .bashrc file to get them automatically run each time you log in.

To ensure that the environment variables get set correctly, use echo $VARIABLENAME, e.g. echo $PATH after the above commands. The output should contain the new stuff you entered into the variables.


I'm guessing:

export PATH=$PATH:/home/karl/.local/share/Trash/files/ns-allinone-2.35/bin:/home/karl/.local/share/Trash/files/ns-allinone-2.35/tcl8.5.10/unix:/home/karl/.local/share/Trash/files/ns-allinone-2.35/tk8.5.10/unix
export LD_PATH=$LD_PATH:/home/karl/.local/share/Trash/files/ns-allinone-2.35/otcl-1.14:/home/karl/.local/share/Trash/files/ns-allinone-2.35/lib

(I have never tried this, but the idea is to add the variables onto the end of your path and make them available to child processes)

  • Must I logout and login for this to take affect? Mar 9, 2013 at 22:37
  • No - in fact, you will need to run these commands each time you log in to reset them. (You may be able to fiddle with a .bashrc file or similar to make add them automatically on login)
    – davidgo
    Mar 9, 2013 at 22:38
  • Still getting the: "invalid command name "new" while executing "new Simulator" invoked from within "set ns [new Simulator]" (file "test.tcl" line 2)" issue :/ I looked this issue up, and it has to do with the otcl package not being found Mar 9, 2013 at 23:04
  • EDIT: I updated the question as my files where located in the rubbish bin, they are now where they are supposed to be, however still no luck with your commands :/ Mar 9, 2013 at 23:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .