Putting the workflow together
On this page
A teammate needs the error from a project log, together with the source that explains it. Sending only a pasted line loses its context. By the end, you can prepare a project handoff, transfer one archive, and check the bytes on the receiving machine.
Before you start
Section titled “Before you start”Finish Checksums and differences and Transferring files with SFTP, including their resets. Use ~/lab from the practice directory setup, and the prepared lab server.
Reserve local ~/lab/b15-workflow and remote ~/b15-workflow.tar.gz; both must be absent. The lab hostname labserver resolves in the prepared private network. Your addresses, fingerprints, transfer speeds, and listing dates will differ. The SSH banner in this container names a WSL2 kernel; your login banner names your own system and kernel.
This workflow uploads to a recreated lab server, whose key differs from earlier transfer exercises. If an earlier labserver entry remains, use the console verification and trust-reset procedure before starting SFTP.
Follow five stages to a checked handoff
Section titled “Follow five stages to a checked handoff”Organize the source and results separately. Locate the information before saving a result. Inspect the packaged project before transferring it. Finally, check the received archive on the remote machine.
Each stage has a replay from the same recorded workflow:
| Stage | Recorded commands |
|---|---|
| Organize | Create the local layout and input |
| Locate | Find the log and matching line |
| Save a result | Write and read the filtered result |
| Package | Archive, inspect, and hash |
| Transfer | Authenticate and upload |
Organize the local project
Section titled “Organize the local project”At the local shell, create the workspace:
mkdir ~/lab/b15-workflowcd ~/lab/b15-workflowmkdir -p report/inbox report/resultsUse your editor to write this synthetic log, including its final newline:
INFO startERROR sensor offlineINFO endThe recording uses printf to write the same text. Inbox holds the supplied input; results holds output you derive from it. This separation keeps a saved result from being confused with its source.
learner@rootvolt:~/lab$ mkdir ~/lab/b15-workflowlearner@rootvolt:~/lab$ cd ~/lab/b15-workflowlearner@rootvolt:~/lab/b15-workflow$ mkdir -p report/inbox report/resultslearner@rootvolt:~/lab/b15-workflow$ printf '%s\n' 'INFO start' 'ERROR sensor offline' 'INFO end' > report/inbox/events.loglearner@rootvolt:~/lab/b15-workflow$ Steps (8)
- Type
mkdir ~/lab/b15-workflow - Press Enter — Reserve the local workspace
- Type
cd ~/lab/b15-workflow - Press Enter — Enter the local workspace
- Type
mkdir -p report/inbox report/results - Press Enter — Separate the source notes from derived results
- Type
printf '%s\n' 'INFO start' 'ERROR sensor offline' 'INFO end' > report/inbox/events.log - Press Enter — Write the synthetic input log
Locate the relevant information
Section titled “Locate the relevant information”First locate the file, then locate the text inside it:
find report -type f -name '*.log'grep -n 'ERROR' report/inbox/events.logQuotes keep Bash from expanding the filename pattern before find sees it. Find searches names; grep searches contents. Grep’s -n adds a line number so you can return to the source entry.
learner@rootvolt:~/lab/b15-workflow$ find report -type f -name '*.log'report/inbox/events.loglearner@rootvolt:~/lab/b15-workflow$ grep -n 'ERROR' report/inbox/events.log2:ERROR sensor offlinelearner@rootvolt:~/lab/b15-workflow$ Steps (6)
- Type
find report -type f -name '*.log' - Press Enter — Locate the log by name under the project
- Output:
report/inbox/events.log - Type
grep -n 'ERROR' report/inbox/events.log - Press Enter — Locate the matching line with its line number
- Output:
2:ERROR sensor offline
Save a result you can check
Section titled “Save a result you can check”Keep only matching log text in the result file:
grep 'ERROR' report/inbox/events.log > report/results/errors.txtcat report/results/errors.txtThis grep omits -n because the result should contain the log entry itself. Redirection creates the result; it would replace an existing file at that pathname. Read the saved file rather than assuming a quiet command saved the intended text.
learner@rootvolt:~/lab/b15-workflow$ grep 'ERROR' report/inbox/events.log > report/results/errors.txtlearner@rootvolt:~/lab/b15-workflow$ cat report/results/errors.txtERROR sensor offlinelearner@rootvolt:~/lab/b15-workflow$ Steps (5)
- Type
grep 'ERROR' report/inbox/events.log > report/results/errors.txt - Press Enter — Save matching text without line-number decoration
- Type
cat report/results/errors.txt - Press Enter — Read the saved result before packaging
- Output:
ERROR sensor offline
Package the source and result
Section titled “Package the source and result”From the local workspace directory:
tar -czf report.tar.gz reporttar -tf report.tar.gzsha256sum report.tar.gzThe archive is outside report, so it cannot include itself. Its member list includes the source log and saved result. The digest describes this exact archive, including its stored metadata. Recreating an archive later can produce a different digest even if visible text is unchanged. Compare the transferred copy with this local archive.
learner@rootvolt:~/lab/b15-workflow$ tar -czf report.tar.gz reportlearner@rootvolt:~/lab/b15-workflow$ tar -tf report.tar.gzreport/
report/results/
report/results/errors.txt
report/inbox/
report/inbox/events.loglearner@rootvolt:~/lab/b15-workflow$ sha256sum report.tar.gz75d43560a9c0dc21899e880384d179f5e4b976880835963967077247aadde86c report.tar.gzlearner@rootvolt:~/lab/b15-workflow$ Steps (8)
- Type
tar -czf report.tar.gz report - Press Enter — Package the source and saved result together
- Type
tar -tf report.tar.gz - Press Enter — Inspect the archive members before transferring
- Output:
report/ report/results/ report/results/errors.txt report/inbox/ report/inbox/events.log - Type
sha256sum report.tar.gz - Press Enter — Record the local digest for remote comparison
- Output:
75d43560a9c0dc21899e880384d179f5e4b976880835963967077247aadde86c report.tar.gz
Read the server fingerprint through its console
Section titled “Read the server fingerprint through its console”On the trusted server console, check the identity and reserved destination before connecting:
ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pubtest ! -e ~/b15-workflow.tar.gz && printf 'Remote destination absent\n'learner@labserver:~$ ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub256 SHA256:jdEs6/lqiaafQBHCkrrMXQbBAh08WGvqo791Uqx9vO8 root@labserver (ED25519)learner@labserver:~$ test ! -e ~/b15-workflow.tar.gz && printf 'Remote destination absent\n'Remote destination absentlearner@labserver:~$ Steps (6)
- Type
ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub - Press Enter — Obtain the full server fingerprint independently
- Output:
256 SHA256:jdEs6/lqiaafQBHCkrrMXQbBAh08WGvqo791Uqx9vO8 root@labserver (ED25519) - Type
test ! -e ~/b15-workflow.tar.gz && printf 'Remote destination absent\n' - Press Enter — Confirm that the reserved upload will not overwrite a remote file
- Output:
Remote destination absent
Only use the destination if its absence check succeeds. The server gets a separate host key for this recording, so another lesson’s fingerprint cannot verify this capture.
Transfer to the verified server
Section titled “Transfer to the verified server”From the local shell in the workspace:
sftp learner@labserverCompare the entire ED25519 SHA256 fingerprint with the console value. If it differs, stop and investigate through the console. If it matches, answer yes and enter the lab password at the hidden password prompt. The prepared lab account uses learner as its password.
At sftp>, enter:
lpwdpwdput report.tar.gz b15-workflow.tar.gzbyelearner@rootvolt:~/lab/b15-workflow$ sftp learner@labserverThe authenticity of host 'labserver (172.19.0.2)' can't be established.
ED25519 key fingerprint is SHA256:jdEs6/lqiaafQBHCkrrMXQbBAh08WGvqo791Uqx9vO8.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yesWarning: Permanently added 'labserver' (ED25519) to the list of known hosts.
learner@labserver's password: Connected to labserver.
sftp> lpwdLocal working directory: /home/learner/lab/b15-workflow
sftp> pwdRemote working directory: /home/learner
sftp> put report.tar.gz b15-workflow.tar.gzUploading report.tar.gz to /home/learner/b15-workflow.tar.gz
report.tar.gz 100% 268 851.5KB/s 00:00
sftp> byelearner@rootvolt:~/lab/b15-workflow$ Steps (20)
- Type
sftp learner@labserver - Press Enter — Compare the complete fingerprint with the trusted console before accepting
- Output:
The authenticity of host 'labserver (172.19.0.2)' can't be established. ED25519 key fingerprint is SHA256:jdEs6/lqiaafQBHCkrrMXQbBAh08WGvqo791Uqx9vO8. This key is not known by any other names. Are you sure you want to continue connecting (yes/no/[fingerprint])? - Type
yesinto the running program - Press Enter — Accept the matching host identity
- Output:
Warning: Permanently added 'labserver' (ED25519) to the list of known hosts. learner@labserver's password: - Type the password (the terminal shows nothing)
- Press Enter — Authenticate to SFTP with the hidden lab password
- Output:
Connected to labserver. sftp> - Type
lpwdinto the running program - Press Enter — Identify the local source directory
- Output:
Local working directory: /home/learner/lab/b15-workflow sftp> - Type
pwdinto the running program - Press Enter — Identify the remote destination directory
- Output:
Remote working directory: /home/learner sftp> - Type
put report.tar.gz b15-workflow.tar.gzinto the running program - Press Enter — Upload the local archive into the remote home directory
- Output:
Uploading report.tar.gz to /home/learner/b15-workflow.tar.gz report.tar.gz 100% 268 851.5KB/s 00:00 sftp> - Type
byeinto the running program - Press Enter — Close SFTP and return to the local shell
| Side | Archive pathname |
|---|---|
| Local rootvolt | ~/lab/b15-workflow/report.tar.gz |
| Remote labserver | ~/b15-workflow.tar.gz |
Lpwd reports the local directory. SFTP’s pwd reports the remote directory. Put copies the local source into that remote home; bye returns to the local shell.
Verify the received bytes and reset the server
Section titled “Verify the received bytes and reset the server”Predict: does a completed upload prove that its archive contains the files you intended to send?
Run it, then compare with your guess
Open an SSH shell from the local prompt, then check the remote copy:
ssh learner@labserverAuthenticate with the hidden lab password again. This connection recognizes the host already accepted in SFTP. At the remote shell:
sha256sum ~/b15-workflow.tar.gztar -tf ~/b15-workflow.tar.gzrm ~/b15-workflow.tar.gztest ! -e ~/b15-workflow.tar.gz && printf 'Remote reset complete\n'exitlearner@rootvolt:~/lab/b15-workflow$ ssh learner@labserverlearner@labserver's password: Welcome to Ubuntu 24.04.5 LTS (GNU/Linux 6.18.33.1-microsoft-standard-WSL2 x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.learner@labserver:~$ sha256sum ~/b15-workflow.tar.gz75d43560a9c0dc21899e880384d179f5e4b976880835963967077247aadde86c /home/learner/b15-workflow.tar.gzlearner@labserver:~$ tar -tf ~/b15-workflow.tar.gzreport/
report/results/
report/results/errors.txt
report/inbox/
report/inbox/events.loglearner@labserver:~$ rm ~/b15-workflow.tar.gzlearner@labserver:~$ test ! -e ~/b15-workflow.tar.gz && printf 'Remote reset complete\n'Remote reset completelearner@labserver:~$ exitlogout
Connection to labserver closed.learner@rootvolt:~/lab/b15-workflow$ Steps (20)
- Type
ssh learner@labserver - Press Enter — Open a remote shell on the already verified host
- Output:
learner@labserver's password: - Type the password (the terminal shows nothing)
- Press Enter — Authenticate again to reach the remote shell
- Output:
Welcome to Ubuntu 24.04.5 LTS (GNU/Linux 6.18.33.1-microsoft-standard-WSL2 x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/pro To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. - Type
sha256sum ~/b15-workflow.tar.gz - Press Enter — Compare the complete remote digest with the local digest
- Output:
75d43560a9c0dc21899e880384d179f5e4b976880835963967077247aadde86c /home/learner/b15-workflow.tar.gz - Type
tar -tf ~/b15-workflow.tar.gz - Press Enter — Verify the remote archive has the intended members
- Output:
report/ report/results/ report/results/errors.txt report/inbox/ report/inbox/events.log - Type
rm ~/b15-workflow.tar.gz - Press Enter — Remove the uploaded archive on the server
- Type
test ! -e ~/b15-workflow.tar.gz && printf 'Remote reset complete\n' - Press Enter — Confirm the remote upload is absent
- Output:
Remote reset complete - Type
exit - Press Enter — Leave the remote shell before cleaning local files
- Output:
logout Connection to labserver closed.
No. Inspect the member list and compare the complete remote digest with the local package-stage digest. The matching values establish that the checked local archive arrived unchanged. The member list checks the intended names; neither check alone proves the source text was correct.
The wide checksum rows carry the same complete digest:
| Archive location | Captured SHA-256 digest |
|---|---|
Local report.tar.gz |
75d43560a9c0dc21899e880384d179f5e4b976880835963967077247aadde86c |
Remote b15-workflow.tar.gz |
75d43560a9c0dc21899e880384d179f5e4b976880835963967077247aadde86c |
Your archive digest will differ because tar records your files and their metadata. The local and remote values for your own transfer must match.
Reset the local machine
Section titled “Reset the local machine”The preceding replay removes the server copy. After exit returns to the local shell, remove only this exercise’s local files and the saved labserver host keys:
rm report/inbox/events.log report/results/errors.txtrmdir report/inbox report/results reportrm report.tar.gzcd ~/labrmdir ~/lab/b15-workflowls -a ~/.sshssh-keygen -R labserverssh-keygen -F labserver || printf 'No saved key for labserver\n'test ! -e ~/lab/b15-workflow && printf 'Local reset complete\n'learner@rootvolt:~/lab/b15-workflow$ rm report/inbox/events.log report/results/errors.txtlearner@rootvolt:~/lab/b15-workflow$ rmdir report/inbox report/results reportlearner@rootvolt:~/lab/b15-workflow$ rm report.tar.gzlearner@rootvolt:~/lab/b15-workflow$ cd ~/lablearner@rootvolt:~/lab$ rmdir ~/lab/b15-workflowlearner@rootvolt:~/lab$ ls -a ~/.ssh. .. known_hosts known_hosts.oldlearner@rootvolt:~/lab$ ssh-keygen -R labserver# Host labserver found: line 1
# Host labserver found: line 2
# Host labserver found: line 3
/home/learner/.ssh/known_hosts updated.
Original contents retained as /home/learner/.ssh/known_hosts.oldlearner@rootvolt:~/lab$ ssh-keygen -F labserver || printf 'No saved key for labserver\n'No saved key for labserverlearner@rootvolt:~/lab$ test ! -e ~/lab/b15-workflow && printf 'Local reset complete\n'Local reset completelearner@rootvolt:~/lab$ Steps (22)
- Type
rm report/inbox/events.log report/results/errors.txt - Press Enter — Remove only the disposable source and derived result
- Type
rmdir report/inbox report/results report - Press Enter — Remove the empty local project directories
- Type
rm report.tar.gz - Press Enter — Remove the local transfer archive
- Type
cd ~/lab - Press Enter — Return to the baseline directory
- Type
rmdir ~/lab/b15-workflow - Press Enter — Remove the empty workspace
- Type
ls -a ~/.ssh - Press Enter — Inspect the SSH directory before removing the labserver entry
- Output:
. .. known_hosts known_hosts.old - Type
ssh-keygen -R labserver - Press Enter — Remove only saved host keys for labserver
- Output:
# Host labserver found: line 1 # Host labserver found: line 2 # Host labserver found: line 3 /home/learner/.ssh/known_hosts updated. Original contents retained as /home/learner/.ssh/known_hosts.old - Type
ssh-keygen -F labserver || printf 'No saved key for labserver\n' - Press Enter — Confirm no saved key for labserver remains
- Output:
No saved key for labserver - Type
test ! -e ~/lab/b15-workflow && printf 'Local reset complete\n' - Press Enter — Confirm the local exercise reset is complete
- Output:
Local reset complete
The workspace absence test checks local project cleanup; the preceding lookup confirms removal of labserver’s saved keys. Leave the SSH directory and backup in place, as described in the SSH reset explanation.
Mistakes to recognize
Section titled “Mistakes to recognize”Packaging before saving the result. An archive captures files as they are when tar reads them. Saving a result afterward does not update that archive.
Checking the local pathname at the remote prompt. The same username does not mean the same filesystem. Read the host name in the shell prompt before verification or cleanup.
Try it yourself
Section titled “Try it yourself”Goal: Explain the smallest set of stages you must repeat if errors.txt was incomplete when the archive was created.
Hint
The uploaded archive contains the earlier saved bytes.
Solution
Correct and read the saved result, package again, inspect and hash that archive, then transfer and verify that exact copy. Checking the old remote archive again cannot include edits made after it was built. Keep the source log for tracing the correction.
- Organize inputs and results before searching and saving.
- Inspect and hash the archive you intend to send.
- Verify server identity before entering the account password.
- Check the remote copy and reset both machines separately.
Next, Practice: Archives and Everyday Workflow tests a maintenance handoff and archive recovery.
Further reading
Section titled “Further reading”- On Ubuntu:
man find,man grep,man tar,man sha256sum,man sftp, andman ssh. - GNU tar manual.
- GNU Coreutils SHA-2 utilities.
- Ubuntu SFTP manual and SSH manual.