Tuesday, October 8, 2013

Non interactive ftp for Linux users

FTP. Yes, people are still using it.

  1.  non interactive ftp login:
    $ ~/.netrc
    machine server_name/ip
    login username
    password password


    $ chmod 600 ~/.netrc
    Now you can simply ftp to said machine and it will auto-login.

  2.  Copying a file to the ftp server:
    • echo put FILE.ext | ftp server_name
      or
    •  curl -T FILE.ext ftp://server_name --user username:password

Wednesday, October 2, 2013

Checking your NIC is connected using bash

A simple yet effective way to test your network adapters connection status using  command line.

Requires: ethtool


# ifconfig -a|grep eth|while read line;do echo ${line%% *} && ethtool ${line%% *}|grep Link;done