Thursday, 25 February 2016 13:15

File transfer from console to console

Written by 
Rate this item
(0 votes)

Different methods for transferring files to and from linux consoles

FTP, SCP, etc

This page is always updated and may change without any notice.  It is a personal collection of links, information, tips & tricks, and guides for the given subject as I explore new ideas and projects.



  • -P specifies what port to use (default is 22)

Recieve remote file to local host

scp remote_user@remote_host:/path/to/remote/file /path/to/local/file


Copy local file to remote host

scp /path/to/local/file remote_user@remote_host:/path/to/remote/file

example: scp -P2222 ~/router_scripts/ adminman@router:/tmp/mnt/data/scripts/




enable jffs partition on the router

Create services-start script, this will run the script in a separate process after the router starts

nano services-start

copy & paste below


# start script
/bin/sh /jffs/scripts/ &


Transfer it to the /jffs/scripts partition on your router

scp -P2222 /home/superuser/router_scripts/services-start  adminman@router:/jffs/scripts/services-start


Make the script


copy&paste below


# Script to monitor and restart wireless access point when needed
maxPloss=10 #Maximum percent packet loss before a restart

restart_networking() {
        # Add any commands need to get network back up and running
        #logger "autoreboot: rebooting..."
while true; do
#give time in between runs
        sleep 120
        # First make sure we can resolve google
        if ! $(ping -q -w5 > /dev/null 2>&1); then
                #Make a note in syslog
                logger "autoreboot: Network connection is down, restarting network ..."
        # Initialize to a value that would force a restart
        # (just in case ping gives an error and ploss doesn't get set)
        # now ping google for 10 seconds and count packet loss
        ploss=$(ping -q -w10 | grep -o "[0-9]*%" | tr -d %) > /dev/null 2>&1
        if [ "$ploss" -gt "$maxPloss" ]; then
                #logger file /tmp/syslog.log
                logger "autoreboot: Packet loss ($ploss%) exceeded $maxPloss, restarting network ..."


Make all of the scripts in the /jffs/scripts directory executable

chmod +x /jffs/scripts/*



You can view








Read 2334 times Last modified on Friday, 04 March 2016 01:37
Algis Salys

Creator and owner of  Linux enthusiast, electronics tinkerer, and likes to spend time in the workshop building and creating new projects.