Skip to content

Linux & shell: Network basics & SSH

10 Linux & shell commands: Network basics & SSH. Click a command to see what each part does.

Index
10 items
Click a command to see what each part does.

Network basics & SSH10

  • ping -c 4 <host>Is a host reachable?

    What each part does

    1. pingsend ICMP echo requests
    2. -c 4stop after 4 packets (otherwise it runs until Ctrl+C)
  • ssh <user>@<host>Log in to a server

    What each part does

    1. sshsecure shell
    2. <user>@<host>remote user name and host name or IP
  • ssh -p <port> -i <key-file> <user>@<host>SSH with a port and a key file

    What each part does

    1. -p <port>remote port (default 22)
    2. -i <key-file>private key to use
  • ssh <user>@<host> "<command>"Run one command remotely

    What each part does

    1. "<command>"runs on the server, output comes back to you
  • ssh-keygen -t ed25519 -C "<email>"Create an SSH key

    What each part does

    1. ssh-keygengenerate a key pair
    2. -t ed25519key type (ed25519 is the modern default)
    3. -C "<email>"comment stored in the key, to recognise it

    Tip Creates ~/.ssh/id_ed25519 (private, keep secret) and id_ed25519.pub (public).

  • ssh-copy-id <user>@<host>Install your public key on a server

    What each part does

    1. ssh-copy-idappend your public key to ~/.ssh/authorized_keys on the server
  • wget <url>Download a file

    What each part does

    1. wgetdownload to the current folder (curl -O <url> does the same)
  • nc -zv <host> <port>Is a TCP port open?

    What each part does

    1. ncnetcat
    2. -zjust scan, send no data
    3. -vverbose: say "succeeded" or "refused"
  • traceroute <host>Path packets take to a host

    What each part does

    1. traceroutelist every hop (router) on the way; shows where it stops
  • ip aShow IP addresses

    What each part does

    1. ip ashort for ip address: every interface with its IPs

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…