ruk·si

Commands
Network

Updated at 2013-11-19 00:33

This note is about network related commands on Unix machines. These work on most distributions, but sometimes you need to install the program.

Ports

# List processes that use port 80.
lsof -i :80

Retrieve Files

# One file.
wget http://startup-class.s3.amazonaws.com/simple.sh
# Entire website.
wget -r -np -k -p http://www.stanford.edu/class/cs106b

Copy Files To Other Host

# Copies files between hosts.
# r = recursive copy
# i = identity file
# Secure CoPy <LOCAL_TARGET> <REMOTE_HOST>:<REMOTE_TARGET>
scp -r -i ~/.ssh/id_amazon.pem ./local/* ec2-user@66.213.210.164:/remote/dir

Single Request

# Example install file.
curl https://install.meteor.com | less
# With Variables.
GHUSER="defunkt"
GHVAR="orgs"
curl -i https://api.github.com/users/$GHUSER/$GHVAR # with variables

Single Package

ping google.com