Now I can find them right away instead of having to google constantly!
How to create a
tar -czvf name-of-archive.tar.gz /path/to/directory-or-file
-c: Create an archive. -z: Compress the archive with gzip. -v: Display progress in the terminal while creating the archive, also known as “verbose” mode. The v is always optional in these commands, but it’s helpful. -f: Allows you to specify the filename of the archive.
How to extract that archive
tar -xzvf archive.tar.gz
Moving Files Between Computers
Copy file from a remote host to local host SCP example:
scp [email protected]_host:file.txt /local/directory/
Copy file from localhost to a remote host SCP example:
scp file.txt [email protected]_host:/remote/directory/
Copy directory from a remote host to local host SCP example:
scp -r [email protected]_host:/remote/directory/ /local/directory/
Copy directory from localhost to a remote hos SCP example:
scp -r /local/directory/ [email protected]_host:/remote/directory/
Copy file from remote host to remote host SCP example:
–r Recursively copy entire directories. Note that this follows symbolic links encountered in the tree traversal. -C Compression enable. Passes the -C flag to ssh to enable compression. -l limit – Limits the used bandwidth, specified in Kbit/s. -o sshoption – Can be used to pass options to ssh in the format used in sshconfig. -P port – Specifies the port to connect to on the remote host. Note that this option is written with a capital ‘P’. -p Preserves modification times, access times, and modes from the original file. -q Quiet mode: disables the progress meter as well as warning and diagnostic messages from ssh. -v Verbose mode. Print debugging messages about progress. This is helpful in debugging connection, authentication, and configuration problems.
Run Remote Commands Over SSH
ssh [email protected] -p 22 “cd ~/ && ls -l”