Hi, everyone! Hope you're all having a nice life!
Example:
Also,
Pretty handy, if you ask me.
Source: https://www.commandlinefu.com/comma...ess-cheat-sheet-for-a-range-of-linux-commands
The tool: https://github.com/chubin/cheat.sh#command-line-client-chtsh
Code:
$ curl cheat.sh/<comamnd-to-search>
Bash:
$ curl cheat.sh/rsync
cheat:rsync
# To copy files from remote to local, maintaining file properties and sym-links
# (-a), zipping for faster transfer (-z), verbose (-v):
rsync -avz host:file1 :file1 /dest/
rsync -avz /source host:/dest
# To copy files using checksum (-c) rather than time to detect if the file has
# changed. (Useful for validating backups):
rsync -avc <src> <dest>
# To copy /src/foo folder into destination:
# This command will create /dest/foo if it does not already exist
rsync -auv /src/foo /dest
# To copy contents of /src/foo into destination:
# This command will not create /foo_bak/foo folder
rsync -auv /src/foo/ /foo_bak
# To copy file from local to remote over ssh with non standard port 1234 to
# destination folder in remoteuser's home directory:
rsync -avz -e "ssh -p1234" <source> <username>@<host>:<dest>
# Use the specified authentication key, instead of typing a password:
# (The key can be generated by ssh-keygen, and the public key should be placed
# in remote's authorized_keys, e.g. using ssh-copy-id)
rsync -avz -e "ssh -i ~/.ssh/id_rsa" <src> <dest>
# Log into remote as a user, but promote to root, to access privileged files:
rsync -avz --rsync-path="sudo rsync" user@<src> <dest>
# Rsync only symlinks and preserve them as symlinks (dont follow them):
find /path/to/files -type l -print | \
rsync -av --files-from=- /path/to/files user@targethost:/dest_path
tldr:rsync
# rsync
# Transfer files either to or from a remote host (not between two remote hosts).
# Can transfer single files, or multiple files matching a pattern.
# More information: <https://manned.org/rsync>.
# Transfer file from local to remote host:
rsync path/to/local_file remote_host:path/to/remote_directory
# Transfer file from remote host to local:
rsync remote_host:path/to/remote_file path/to/local_directory
# Transfer file in [a]rchive (to preserve attributes) and compressed ([z]ipped) mode with [v]erbose and [h]uman-readable [P]rogress:
rsync -azvhP path/to/local_file remote_host:path/to/remote_directory
# Transfer a directory and all its children from a remote to local:
rsync -r remote_host:path/to/remote_directory path/to/local_directory
# Transfer directory contents (but not the directory itself) from a remote to local:
rsync -r remote_host:path/to/remote_directory/ path/to/local_directory
# Transfer a directory [r]ecursively, in [a]rchive to preserve attributes, resolving contained soft[l]inks , and ignoring already transferred files [u]nless newer:
rsync -rauL remote_host:path/to/remote_directory path/to/local_directory
# Transfer file over SSH and delete remote files that do not exist locally:
rsync -e ssh --delete remote_host:path/to/remote_file path/to/local_file
# Transfer file over SSH using a different port than the default and show global progress:
rsync -e 'ssh -p port' --info=progress2 remote_host:path/to/remote_file p
Also,
Bash:
_ _ _ __
___| |__ ___ __ _| |_ ___| |__ \ \ The only cheat sheet you need
/ __| '_ \ / _ \/ _` | __| / __| '_ \ \ \ Unified access to the best
| (__| | | | __/ (_| | |_ _\__ \ | | |/ / community driven documentation
\___|_| |_|\___|\__,_|\__(_)___/_| |_/_/ repositories of the world
+------------------------+ +------------------------+ +------------------------+
| $ curl cheat.sh/ls | | $ cht.sh btrfs | | $ cht.sh lua/:learn |
| $ curl cht.sh/btrfs | | $ cht.sh tar~list | | Learn any* programming |
| $ curl cht.sh/tar~list | | | | language not leaving |
| $ curl https://cht.sh | | | | your shell |
| | | | | *) any of 60 |
| | | | | |
+-- queries with curl ---+ +- own optional client --+ +- learn, learn, learn! -+
+------------------------+ +------------------------+ +------------------------+
| $ cht.sh go/f<tab><tab>| | $ cht.sh --shell | | $ cht.sh go zip lists |
| go/for go/func | | cht.sh> help | | Ask any question using |
| $ cht.sh go/for | | ... | | cht.sh or curl cht.sh: |
| ... | | | | /go/zip+lists |
| | | | | (use /,+ when curling) |
| | | | | |
+---- TAB-completion ----+ +-- interactive shell ---+ +- programming questions-+
+------------------------+ +------------------------+ +------------------------+
| $ curl cht.sh/:help | | $ vim prg.py | | $ time curl cht.sh/ |
| see /:help and /:intro | | ... | | ... |
| for usage information | | zip lists _ | | real 0m0.075s |
| and README.md on GitHub| | <leader>KK | | |
| for the details | | *awesome* | | |
| *start here*| | | | |
+--- self-documented ----+ +- queries from editor! -+ +---- instant answers ---+
Source: https://www.commandlinefu.com/comma...ess-cheat-sheet-for-a-range-of-linux-commands
The tool: https://github.com/chubin/cheat.sh#command-line-client-chtsh
Last edited: