If you are using a remote server with SSH and you wish to get a large file off the Internet to the remote server easily, you may use the wget command to download it directly to the server instead of having to download it at home and then upload it again. That is silly. Use the wget command like this to fetch the file.
ubuntu ~ $ wget https://cdn.kernel.org/pub/linux/kernel/v4.x/testing/linux-4.4-rc5.tar.xz
This makes much more sense than the aforementioned method of downloading and then uploading files. Remote Windows servers with web upload forms I am looking at you. Just right-click on the link and choose to “Copy Link Location”, then paste it into the terminal as shown above and download the file directly to the remote server. Nice huh? This makes things much easier and faster. I have tried to upload large files to a Windows server online using the web upload forms, but it would just give and error once it got to 90% uploaded. This way works much better. An SSH connection is preferable for any kind of remote administration. Linux is a multi-user operating system and it is meant to be used over a network. The Internet is perfect for this, connecting over this world-wide network to a machine in another country seems like magic, but it does work.
There is a nice man page for SSH here, this explains everything that you need to know to get your head around using this to securely connect to remote machines.
Some useful Linux networking commands.
This command will return only the IP address of the host. Very useful in a script.
ubuntu ~ $ hostname -i 172.31.20.16
Querying for all local IP addresses on the host.
ubuntu ~ $ hostname -I 172.31.20.16 10.8.0.1
This simple script will ping Google and will check the return value of the ping command to see if the Internet is up or not.
ping -c 1 google.com if [ "$?" == "0" ]; then; echo "Hi." else echo "The Internet is down." fi
This is yet another way to get IP address information from the host. This lists active IP addresses on the host network adapters.
ubuntu ~ $ ip a | grep inet inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host inet 172.31.20.16/20 brd 172.31.31.255 scope global eth0 inet6 fe80::4d6:3aff:fea8:8213/64 scope link inet 10.8.0.1 peer 10.8.0.2/32 scope global tun1194
The nslookup command is used to retrieve DNS information about a certain host. This returns the DNS servers that service that website/host.
ubuntu ~ $ nslookup facebook.com Server: 172.31.0.2 Address: 172.31.0.2#53 Non-authoritative answer: Name: facebook.com Address: 220.127.116.11
Use netstat to list all Internet connections from your machine. Here I am listing all of the listening connections on my cloud instance.
ubuntu ~ $ netstat -l Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 localhost:mysql *:* LISTEN tcp 0 0 *:ssh *:* LISTEN tcp 0 0 *:https *:* LISTEN tcp6 0 0 [::]:ssh [::]:* LISTEN udp 0 0 *:bootpc *:* udp 0 0 *:10995 *:* udp 0 0 *:2302 *:* udp 0 0 *:2303 *:* udp 0 0 *:2304 *:* udp 0 0 *:2305 *:* udp6 0 0 [::]:13242 [::]:* Active UNIX domain sockets (only servers) Proto RefCnt Flags Type State I-Node Path unix 2 [ ACC ] SEQPACKET LISTENING 1171791 /run/udev/control unix 2 [ ACC ] STREAM LISTENING 73100 @/com/ubuntu/upstart unix 2 [ ACC ] STREAM LISTENING 8809 /var/run/dbus/system_bus_socket unix 2 [ ACC ] STREAM LISTENING 9104 /var/run/acpid.socket unix 2 [ ACC ] STREAM LISTENING 640253 /var/run/mysqld/mysqld.sock