Written 1 Sep 2026. This is a how-to, not a product card.
See whether two files match byte for byte
After comm, compare two files byte for byte with cmp so you know if they match. You don't need extra software for this.
Compare sorted lists compared two sorted lists. Tonight you compare two files byte for byte: cmp. Cmp says whether two files match, or where the first difference is. Start with two tiny practice files. You are still only practicing in home on the computer. It does not need extra system software, htop, Grafana, or a NAS for this one job.
Skip until SSH already works
SSH from the couch should already get you a prompt. If sorted lists compared are what you want, that is compare sorted lists. If a line-oriented compare is what you want, that is see whether two files are the same. If a fingerprint is what you want, that is check a file fingerprint.
What this is
cmp compares two files byte for byte. You make two tiny practice files, then type cmp ~/cmp-a.txt ~/cmp-b.txt. Quiet output means they match. A short report means they differ, and where. It is not diff. Diff is line-oriented. It is not sha256sum. Sha256sum fingerprints one file. It is not comm. Comm compares sorted lists.
Practice cmp in home
SSH in. Make sure home is where you sit:
pwd
You want a path that ends in your login name. If not:
cd ~
Make two tiny matching files:
printf 'hello\n' > ~/cmp-a.txt
printf 'hello\n' > ~/cmp-b.txt
Compare them:
cmp ~/cmp-a.txt ~/cmp-b.txt
Quiet output means they match. Then change one:
printf 'hello!\n' > ~/cmp-b.txt
cmp ~/cmp-a.txt ~/cmp-b.txt
You want a short report that they differ, then the prompt back. That is enough for tonight. Practice only in home.
Debian and Ubuntu usually already have cmp. Don't make apt the job. If cmp is missing:
sudo apt install diffutils
Then stop. That install is not the lesson.
When you are done, throw the practice files away. Careful delete only. That is delete a file carefully. Skip rm -rf.
rm -i ~/cmp-a.txt ~/cmp-b.txt
Useful extras, still home only
Optional: silent, then print the exit status:
cmp -s ~/cmp-a.txt ~/cmp-b.txt; echo $?
0 means match. Non-zero means they differ. Don't make -s required.
Optional: list differing bytes:
cmp -l ~/cmp-a.txt ~/cmp-b.txt
Don't make -l required. You can stay on the default report.
Skip cmp piped into rm. Cmp compares. Rm deletes. Don't mix those jobs.
What this is not
This is not comm. That is compare sorted lists. It is not diff. That is see whether two files are the same. It is not sha256sum. That is check a file fingerprint. It is not join. That is match files on a shared field. It is not opening SSH to the internet. That is keep the computer on the house network. Don't forward port 22.
What next
Need sorted lists compared? Compare sorted lists. Need a line-oriented compare? See whether two files are the same. Need a fingerprint? Check a file fingerprint. Need the practice files gone? Delete a file carefully. Keep SSH on the house network: keep the computer on the house network. Don't forward port 22.
Skip
- Skip if SSH still fails. Finish SSH from the couch first.
- Skip huge dumps. Tonight: two tiny practice files.
- Skip cmp piped into
rm. Cmp compares. Don't mix delete into this drill. - Skip comm, diff, and sha256sum as tonight's job. Those pages already exist.
- Skip files under
/etc, SSH folders, or paths you don't own. Practice only in home. - Skip
rm -rf. Careful delete only: delete a file carefully. - Skip opening SSH to the internet so you can do this from a coffee shop. That is keep the computer on the house network. Don't forward port 22.
Sources
Debian: cmp(1). Ubuntu: cmp(1). Official pages only. For the login, see SSH from the couch. For line-oriented compare, see see whether two files are the same.