Skip to content

Terminal - Command Line

explainshell

explainshell tool to describe part by part a command-line.

write down a command-line to see the help text that matches each argument

Cheat Sheet

  1. rsync
sh
# rsync
# (https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories)
#
# In short
rsync -az source destination

# Send a file to a remote server
rsync /path/to/source/file username@remote_host:/path/to/destination

# Send a directory to a remote server
rsync -a /path/to/source/directory username@remote_host:/path/to/destination

#  Get a file from a remote server
rsync remote_username@remote_host:/path/to/source/file /path/to/local_destination

# Options:
# -a: archive mode
# -r: recurse into directories
# -P: same as --partial + --progress (keep partially transferred files)
# https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories#using-other-rsync-options
# > This first flag provides a progress bar for the transfers,
# > and the second flag allows you to resume interrupted transfers:
  1. Get count of files in a directory

StackOverflow

sh
ls -1 | wc -l

Include hidden files

sh
find . ! -name . -prune -print | grep -c /