Feature request: Global commands like ping and traceroute

I think it would be convenient to have some commands/utilities available as globally available commands. Currently commonly used tools are spread in three different places:

/ping
/tool traceroute
/system telnet
/system ssh

I think these 4 tools should be available everywhere without explicitly having to point to the correct path. So for instance you should be able to:

[admin@MikroTik] /ip address> ping 1.2.3.4
[admin@MikroTik] /ip address> traceroute 1.2.3.4
[admin@MikroTik] /ip address> telnet 1.2.3.4
[admin@MikroTik] /ip address> ssh 1.2.3.4

instead of having to know that you must write:

[admin@MikroTik] /ip address> /ping 1.2.3.4
[admin@MikroTik] /ip address> /tool traceroute 1.2.3.4
[admin@MikroTik] /ip address> /system telnet 1.2.3.4
[admin@MikroTik] /ip address> /system ssh 1.2.3.4

It’s not a big deal, but it makes it much more user friendly for someone that has never been logged into a mikrotik before todo basic troubleshoting from it without knowing the full CLI syntax.

that wont be changed. The order that is active currently, allows you to run all the commands with “/” as prefix from anywhere.

like:

/ip address> /ip route print

or

/ip address> .. route print

that wont be changed.

and btw, you run /tool traceroute, not /traceroute

I’m not asking you to allow every single command to be allowed to be executed from everywhere. Of course that wouldn’t make sense.

What I’m asking for is the 4 most common tools, ping, traceroute, ssh and telnet should be available as global commands. Those are tools/applications, not configuration directives.

and btw, you run /tool traceroute, not /traceroute

That was exactly what I wrote, and one of the reasons I want traceroute available as a global command. Now you have to know that you must write “/tool traceroute” todo a simple traceroute, while ping is available as /ping.

It’s simply not very userfriendly. What is the reason for NOT allowing these tools as global commands?

I second this request. It is very reasonable.
Janisk your response implies that you did not even read what man asked.

if they were made global then they would be prefixed like :ping, :traceroute. The ICE commands I think they are called.

Even better would be a way to use the ‘alias’ command as well as have a profile script that could run when you login.

also i believe those commands are placed in the ‘advanced tools’ package so they are not even there normally.

Maybe it is possible to have aliases like in Cisco routers?

Example from Cisco router:

#sh aliases
Exec mode aliases:
c sh call active voice

#c ?
brief show brief version of active voice calls
called-number show only call with specific called number pattern
calling-number show only call with specific calling number pattern
compact show compact version of active voice calls

ROS implementation could be the following:

/system aliases add alias=/traceroute cmd=/tool traceroute
/system aliases remove 0
/system aliases print

janisk, is this approach acceptable ? Previously suggested one seems to be not.

ping, traceroute, ssh and telnet are all available even after disabling advanced-tools and rebooting on a ROS 3.20 at least.

And even if they were part of seperate package, what’s the problem with installing the global command when that package is installed.

Aliases is also a great idea for many other cases, however I’d still prefer to see these tools as real global commands, or maybe default installed aliases.

Does anyone have any good argument for why it would be a bad idea to have those tools easily available everywhere?

I think this would be the best way, and would give some nice flexability for people who frequently have to run different commands or scripts


/system aliases add alias=/updateip cmd=/system script run ChangeIP

/updateip

Yeah, that would be really nice. I will still argue that the aliases should then be global and therefor named without any prefixing slash, so your example would be like:

/system aliases add alias=updateip cmd=/system script run ChangeIP

updateip

If you happend to create an alias with a cmd name that is already valid in some contexts, the aliases should have preferance. That way you can create scripts to override cmds.

If the script could then also receive the path from where the cmd were executed as a global variable, you could even take diffrent actions depending on from where it was executed.

You should still always be able to use a absolut command by prefixing the command with the full path beginning with a slash so you can always remove an alias that is fucking things up for you.

To make it even more flexible one could allow creating both global aliases like:

/system aliases add alias=ping cmd=/ping
/system aliases add alias=updateip cmd="/system script run ChangeIP"

Or an alias that is only valid within a specific cmdpath like:

/system aliases add alias=print path="/ip route" cmd="/system scripte run myCustomRoutePrintScript"

As default I then think the following aliases should be installed to ease for everyone not used to the Mikrotik syntax like was my intention with the original post:

/system aliases add alias=ping cmd="/ping"
/system aliases add alias=traceroute cmd="/tool traceroute"
/system aliases add alias=ssh cmd="/system ssh"
/system aliases add alias=telnet cmd="/system telnet"

are you sure? what about alias like “ipv6” and when you install the ipv6 package, you couldn’t access the ipv6 menu. system commands should always be protected.

anyway, we will make something of all these ideas.

Hello Everybody.
Any updates about “alias command” ?
Is there a way for that?