Let's say I have this command:
/sbin/ifconfig|grep inet|head -1|sed 's/\:/ /'|awk '{print $3}'
Is it possible to shorten this to let's say writing host in the command line?
Let's say I have this command:
/sbin/ifconfig|grep inet|head -1|sed 's/\:/ /'|awk '{print $3}'
Is it possible to shorten this to let's say writing host in the command line?
Yes, you can create shell alias, which is exactly what you need:
$ alias mycmd="/sbin/ifconfig|grep inet|head -1|sed 's/\:/ /'|awk '{print $3}'"
You probably want to have above alias permanent. To achieve this, add the above alias command to the ~/.bashrc file.