Getting files in and out

Your home directory is the point of the account. Here is how to get things into it and out of it.

Copying single files: scp

Run these on your own machine, not on the shell:

scp notes.txt yourname@shell.shadowsquad.org:~/
scp yourname@shell.shadowsquad.org:~/logs/bot.log .
scp -r site/ yourname@shell.shadowsquad.org:~/public_html/

The colon is what makes it a remote path. scp file host: with nothing after the colon means "your home directory there".

Interactive transfers: sftp

sftp yourname@shell.shadowsquad.org

You get a prompt with ls, cd, get, put, mkdir and rm. Prefix a command with llls, lcd — to run it on your local machine instead. get -r and put -r handle directories.

If you would rather drag and drop, any SFTP client (FileZilla, WinSCP, Cyberduck, or your file manager's "Connect to server") works: protocol SFTP, host shell.shadowsquad.org, port 22, your username, and your SSH key or password.

Syncing a directory: rsync

rsync only sends what changed, resumes cleanly, and is the right tool the moment you are copying the same tree more than once:

rsync -avz --progress site/ yourname@shell.shadowsquad.org:~/public_html/
rsync -avz yourname@shell.shadowsquad.org:~/logs/ ./logs-backup/
rsync -avz --delete site/ yourname@shell.shadowsquad.org:~/public_html/

--delete makes the destination match the source exactly, including removing files. Run it once with -n (dry run) before you trust it.

Note the trailing slashes: site/ means "the contents of site", site means "the directory site itself". This is the single most common rsync mistake.

Archives

tar czf backup.tar.gz mybot/           # create a gzipped tarball
tar xzf backup.tar.gz                  # extract it
tar tzf backup.tar.gz | head           # look inside without extracting

zip -r site.zip public_html/           # zip, for people on Windows
unzip site.zip

Always look inside an archive before extracting it — a tarball that unpacks fifty files into your current directory instead of one folder is a rite of passage nobody enjoys.

Finding out where your space went

usage                  # your total, against your plan
du -sh ~/*             # size of each thing in your home directory
du -sh ~/.* 2>/dev/null  # and the hidden ones, which is usually the answer
ncdu ~                 # interactive: browse the tree by size, delete in place
tree -L 2 ~            # see the shape of it

The usual culprits are a bot's log file that nobody rotated, a ~/.cache that grew for a year, and the build directory left over from compiling something.

Getting in without a password

Generate a key on your own machine, once:

ssh-keygen -t ed25519 -C "you@yourlaptop"
cat ~/.ssh/id_ed25519.pub

Paste the public key — the whole single line, starting ssh-ed25519 — into the SSH keys page. It is installed on the box within a minute.

Do not use ssh-copy-id here: ~/.ssh/authorized_keys is written by the system from the keys in the panel, so anything you add to the file by hand is overwritten the next time your keys sync. The panel is the place to add and remove them.

Once a key works, add this to ~/.ssh/config on your own machine and never type any of it again:

Host shadow
    HostName shell.shadowsquad.org
    User yourname
    IdentityFile ~/.ssh/id_ed25519

Then ssh shadow, scp file shadow:~/, rsync -avz site/ shadow:~/public_html/.

« All guides