Run Remote Commands with SSH 1
By adding commands at the end of the ssh command they will be issued at the remote machine and you will get back stdout and stderr results on the local machine.
ssh useraccount@boxname 'someCommand | someOtherCommand'
By adding commands at the end of the ssh command they will be issued at the remote machine and you will get back stdout and stderr results on the local machine.
ssh useraccount@boxname 'someCommand | someOtherCommand'
tail -n +2 someFile
*Notes: You MUST include the + sign or else the last 2 lines will be printed instead.
To remove N lines from the start of the file
tail -n +$M someFile
*NOTES: M = N + 1
You MUST include the + sign in-front of the number M or else the output will be the last M lines instead.
ifup eth0
*INFO: The default Ethernet device is disabled on boot but it can easily be enabled by just issuing the above command. (You still need to configure it depending on your system’s structure). In order to activate the Ethernet card you need to call the above command from the Terminal.
for i in $(seq $START $STEP $END); do echo "Iteration $i"; someCommand; someOtherCommand ; done
*INFO: $START: The starting value for the for loop, can be replaced by an integer.
$STEP: The step that the for loop is performing at the end of each iteration, can be replaced by an integer.
$END: The ending value for the for loop, can be replaced by an integer.
*NOTE: All kinds of bash for loops can be coded as above and made into one liners.