From df -h to BashSnippets: Travis’s Linux Journey

From df -h to BashSnippets: Travis’s Linux Journey

●27 ●53 ●145
calendar_today ago • schedule13 min read
📝 DEV STORY
BashSnippets Featuring: BashSnippets • Developer

Interviewed by: Mehadi Hasan

Developer: BashSnippets

Role: Linux and Bash Developer, Creator of BashSnippets

Project: BashSnippets

A developer does not always need a major product idea to start building something useful. Sometimes, the motivation comes from a small frustration repeated often enough that ignoring it becomes harder than solving it.

For Travis, that frustration was repeatedly searching for the same Bash commands. A disk-space check, a log-cleanup script, or a service watchdog would solve a problem temporarily, but the useful commands and fixes were easy to lose. He eventually started keeping them in a personal ~/scripts folder. That small collection became the foundation of BashSnippets, a free library of tested Bash scripts, practical Linux fixes, and explanations of why seemingly simple commands sometimes fail.

Today, BashSnippets focuses on a straightforward idea: a useful technical answer should do more than provide a command to copy. It should explain what can go wrong, how to reproduce the issue, and why the solution works.

Travis’s journey offers an interesting look at practical problem-solving, technical writing, debugging, and building a small developer resource without a large budget or complicated infrastructure.

From Ubuntu to a Personal Bash Script Library

Travis began using Linux with Ubuntu in 2013. Over time, he moved through Debian and Fedora as different jobs required different environments. He currently works with Kali Linux.

Bash became an essential part of his workflow because he kept repeating the same tasks manually. Disk-space checks, log cleanup, and service monitoring were among the things he found himself rewriting.

The turning point was not a major technical breakthrough. It was the realization that he had already searched for the same commands too many times.

His solution started as a personal collection of scripts. Instead of copying commands from forums and losing them again, he began documenting them properly, including the details that had caused problems in the first place.

He discovered that explaining a solution to someone else required a deeper understanding of it.

As he puts it:

"The moment you explain why the obvious one-liner fails, you have to actually understand it."

That principle eventually shaped the entire BashSnippets project. The goal became not simply collecting commands, but documenting the situations in which those commands are useful and the failure modes developers should understand before running them.

The 44.6 GB File That Taught an Important Debugging Lesson

One experience had a particularly strong influence on how Travis approaches technical problems.

In August, he deleted a 44.6 GB video file to recover disk space. After deleting it, he checked the system using two familiar Linux utilities: du and df.

The results did not match.

  • du showed approximately 44 GB less disk usage.
  • df showed only about 5 GB of recovered space.

At first, he repeatedly ran both commands, wondering which one was reporting the wrong information.

Neither was broken.

The difference came from what the two commands actually measure. du calculates space used by files and directories that can be accessed through the filesystem's directory structure. df reports filesystem block usage.

Deleting a file does not necessarily release its storage immediately. If a running process still has the file open, the filesystem keeps its blocks allocated until that process releases the file.

In Travis's case, the responsible process was tumblerd, the XFCE thumbnailer. It had been generating a preview and still held the deleted video file open.

Running:

pkill -x tumblerd

released the file's remaining storage.

The command:

lsof +L1

would have helped identify open files that had been deleted but were still held by running processes.

Travis documented the experience in a reproducible article on BashSnippets:

Linux lsof Command Examples

He also reproduced the behavior in a small tmpfs environment so that the figures in the article came from an actual test rather than memory.

The experience left him with a debugging principle that now influences much of his work:

"When two tools disagree, they're usually both right about different things."

Instead of assuming that one tool is incorrect, he investigates what each tool measures and looks for the underlying difference.

Building BashSnippets Without a CMS or a Large Budget

BashSnippets grew from a personal collection into a public resource for people who work with Linux and Bash.

The audience is primarily self-taught Linux users, system administrators, and people managing their own Linux machines or smaller servers. These users often need a practical solution quickly, but they also need enough explanation to understand what a script will do.

Travis noticed that many Bash answers online provide a one-line solution without explaining the conditions under which it might fail.

For example:

  • Cron jobs may fail because they run with a limited PATH.
  • df and du can report different disk usage.
  • A command that appears correctly quoted may still become dangerous when a variable is empty.
  • rsync can behave differently depending on whether the source path ends with a trailing slash.

BashSnippets is designed to address these situations with a script and an explanation of the failure mode.

The site was built without a content management system. Each snippet is stored as an MDX file in a Git repository, with frontmatter containing the title and tags, followed by the script and its explanation.

The current architecture uses:

  • Next.js 15 for the website.
  • Tailwind CSS for styling.
  • MDX for writing and maintaining individual snippets.
  • Git for version control.
  • Vercel for deployment.
  • A build process that checks metadata, generates a sitemap, and pings IndexNow to help search engines discover new pages.

The first version was a plain static site hosted on GitHub Pages. Travis later moved to Next.js when he wanted reusable templates, tags, and structured data without manually copying HTML for every page.

With the MDX approach, publishing a new page is relatively simple: create one file, write the script and explanation, commit it, and let the site redeploy.

The domain has been the only project cost so far. Travis has deliberately stayed within free hosting tiers because he wants to understand the configuration and limitations of each service before paying for additional resources.

That approach has also provided practical lessons.

One automated testing setup consumed approximately 750,000 of the 1,000,000 free monthly requests available under Vercel's free plan in only a few days. The problem was that a headless browser loading a page also prefetched every link on that page, multiplying the number of requests.

Nothing went down, but the experience forced him to change the testing approach.

It reinforced an important part of building a small project: free infrastructure can be useful, but understanding its limits is just as important as knowing how to use it.

Why Every BashSnippets Script Must Be Tested

One of the defining characteristics of BashSnippets is its emphasis on reproducibility.

Travis does not want to publish scripts simply because they look correct or because a command appears frequently in online discussions.

His rule is straightforward: if he cannot reproduce the problem, it does not get a page.

A useful snippet should:

  1. Run as written.
  2. Pass ShellCheck.
  3. Explain what it is about to do.
  4. Identify the failure mode it addresses.
  5. Explain the behavior that might surprise someone using it.

Newer pages include terminal output from real runs on his Kali Linux machine, using Bash 5.3. If a claim cannot be reproduced directly, he describes it as documented behavior rather than presenting it as something he personally observed.

The scripts also follow a consistent header structure that explains what breaks without the script, how to run it, and the use of:

set -euo pipefail

This helps establish a consistent approach to handling common shell-script errors.

Travis also prefers named variables over unexplained numbers and paths. Comments should explain why a particular line exists rather than simply restating what the command does.

For scripts that can modify files, the ability to preview changes is particularly important. The backup, synchronization, and find-and-replace scripts include dry-run options so users can inspect the expected changes before applying them.

The source code is also available in the BashSnippets GitHub repository, which is MIT-licensed.

This gives readers an opportunity to inspect the implementation before running a script on their own systems.

Small Bash Mistakes Can Cause Serious Problems

Some of the most useful BashSnippets articles focus on commands that look harmless but can produce unexpected results.

One example is:

rm -rf "$DIR/"*

At first glance, the command appears to be correctly quoted. However, if DIR is empty or unset, the resulting command can effectively become:

rm -rf /*

That is an extremely dangerous situation.

Travis explains how to guard against this type of mistake by using a parameter expansion such as:

${DIR:?}

This causes the script to fail when the required variable is empty or unset, rather than continuing with an unintended path.

He tested the behavior in a scratch directory using echo in front of the command, ensuring that the destructive operation itself was never executed.

Other common problems he highlights include:

Cron environment differences: A command that works in an interactive terminal may fail under cron because cron does not automatically use the same environment and PATH. Using full command paths or explicitly setting PATH can prevent these failures.

Rsync trailing slashes: The difference between src and src/ affects whether the source directory itself or its contents are copied.

Unquoted variables: Filenames containing spaces can be split into multiple arguments when variables are not quoted.

Unchecked exit codes: A backup script that fails silently can create a false sense of security.

His recommended habits include running ShellCheck, enabling strict mode, quoting variables, using dry-run options, and logging output so scheduled-task failures do not disappear unnoticed.

These are practical details that can make the difference between a script that works in a test terminal and one that behaves safely on a server.

A Debugging Process Built Around Reproduction

Travis's approach to debugging starts with a simple assumption: two apparently conflicting results may both be correct.

The next step is to reduce the problem until it can be reproduced in a controlled environment.

For filesystem issues, that might mean creating a scratch directory or using a small tmpfs. For scheduled tasks, he tries to reproduce the environment in which the command actually runs rather than relying on his interactive login shell.

Some of the tools he uses include:

  • env -i to test commands with a minimal environment.
  • systemctl status to inspect service status.
  • journalctl -u to review service logs.
  • lsof to identify open files and processes holding resources.
  • ps to inspect running processes.
  • /proc to investigate process information.

The objective is to observe what the system is actually doing.

This approach is particularly valuable when debugging cron jobs, systemd services, filesystem behavior, and processes that continue holding resources after a file has been removed.

Rather than immediately changing commands until something appears to work, he tries to understand the conditions that produced the unexpected result.

How Writing Changes the Way He Understands Technical Problems

For Travis, technical writing is not just a way to publish solutions. It is also part of the debugging process.

When he starts writing an explanation, he sometimes discovers that his initial understanding is incomplete. A statement that sounds correct in a draft may fail when he tries to reproduce it.

That sends him back to the terminal to test the behavior, investigate the details, and improve the article.

This process benefits both the reader and the author.

He has also changed how he structures technical explanations. Earlier, he often began with the story behind a problem. Over time, he learned that most readers want the exact answer first.

His current approach is to put the fix in the opening lines and place the explanation and background underneath.

That decision has become even more relevant as search engines and AI-powered tools increasingly provide answers directly from technical pages.

Travis noticed that BashSnippets pages sometimes appeared around positions five to seven in Bing search results while receiving very few clicks. At the same time, Copilot was citing the pages in its answers.

According to the site's Bing AI reporting, its pages received 546 Copilot citations between August and mid-November. The monthly figures included 37 citations in August and 248 in October. The sed find-and-replace page was the most frequently cited.

This changed how he thinks about technical content.

The exact answer needs to appear early, because that is the part search tools and AI assistants are most likely to extract. The deeper explanation still matters, but it should follow the direct solution.

Google indexing has been another challenge for the small site. Travis says that links from genuine articles have helped more than changes he can make to the site itself.

It is a reminder that useful technical content still benefits from being discovered and referenced by other writers.

Using AI as a Tutor, Not a Replacement for Testing

Travis also uses AI tools as part of his development workflow, but he has a clear distinction between assistance and verification.

He describes using AI as a tutor and a second pair of eyes. It helps explain unfamiliar behavior, review his work, and suggest possible fixes when he encounters an error.

However, he does not simply request a finished solution and publish it.

He runs every command himself and checks the actual output on his machine. The terminal results included in newer BashSnippets pages are based on what he personally tested.

His goal is to understand each step rather than blindly accept an answer.

That process can sometimes feel overwhelming, especially when a problem involves several interacting pieces. When that happens, he steps back and returns to the investigation later.

The same principle applies to his use of AI: suggestions can help guide the work, but testing and understanding remain his responsibility.

Experimenting With YouTube Shorts and TikTok

Alongside written tutorials, Travis has explored short-form developer content on YouTube Shorts and TikTok.

In early May, he published nine Shorts. The first received 288 views, while the best-performing video, featuring a disk-space warning script, reached approximately 800 views. Together, the videos received slightly more than 3,000 views.

The format was intentionally simple: a terminal, one command, and one unexpected result.

He learned that short-form content requires an immediate hook. Viewers may decide within the first two seconds whether to continue watching, so the surprising part of the demonstration needs to come first.

However, he also found that the most useful part of a technical explanation is often the hardest to fit into a 60-second video.

A short video can introduce the problem, but the written page can explain the underlying behavior and provide a tested solution.

He has currently paused the Shorts to concentrate on improving the written library.

Looking back, he also recognized that some of his early video hooks were exaggerated. One backup-related video used the line "I lost 6 months of work," although that had not actually happened.

That experience contributed to a stricter editorial standard: every technical page should begin with a real problem and a run he has actually performed.

What's Next for BashSnippets?

The next stage of BashSnippets will continue to focus on real problems that occur on Linux systems.

Travis plans to publish more pages built around one reproducible issue, one tested solution, and actual terminal output.

One specific area he wants to expand is Bash error messages. Planned topics include:

  • bad substitution
  • ambiguous redirect
  • syntax error near unexpected token
  • integer expression expected

Each page will focus on the exact error, the command or situation that produces it, and why Bash reports it.

Once enough of these explanations are available, he plans to build a Bash Error Message Decoder. The idea is to let users paste an error message and find the relevant explanation.

He also intends to keep the project's newsletter small and practical. Rather than sending frequent updates for their own sake, it will share something useful when a real problem occurs on one of his machines, perhaps twice a month.

The focus remains on making the library useful, reproducible, and easy to understand.

Advice for Developers Starting Small Projects

Travis's advice for people learning Linux or Bash is to start with the problems they already encounter.

There is no need to build complicated infrastructure before creating something useful. A folder containing scripts that solve recurring problems can be a perfectly good starting point.

When a command or script needs to be rewritten, document the solution. Include the part that was confusing, the condition that caused the problem, and the steps needed to reproduce the fix.

A Git repository and a free static hosting service can be enough to turn that personal collection into a public resource.

His advice captures the philosophy behind BashSnippets:

"Automate the thing that's annoying you right now. Future you will have different problems."

The project began because one Linux user was tired of searching for df -h again and again. It developed into a growing library by turning everyday frustrations into tested explanations that other developers can use.

The broader lesson is that useful developer projects do not always begin with a business plan, a large budget, or a complex technical stack. Sometimes they begin with a small problem, a willingness to investigate it properly, and the habit of writing down what you learn.

About BashSnippets and Travis

Travis creates BashSnippets, a free library of tested Bash scripts, Linux troubleshooting examples, and practical fixes for common command-line problems.

The project focuses on reproducible solutions, clear explanations, ShellCheck-tested scripts, and helping Linux users understand what happens when commands do not behave as expected.

Developer Stories is a CoderLegion interview series highlighting the people, ideas, projects, and engineering decisions behind software development.

Want more #devstories deep dives?

Join 5,992+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

From Kubernetes Security Blind Spots to Verifiable Evidence: How Arif Kurnaz Built Attestkeep

Mehadi Hasanverified - Nov 1

What Security Teams Want From AI Agents Before They Let Them Act Alone

Tom Smithverified - Nov 18

Cisco's Amy Chang: A Model's "Passport" Doesn't Tell You Where It Actually Came From

Tom Smithverified - Aug 27

From Cloud Engineering to Production AI: Avneet Bansal's Developer Journey | CoderLegion Developer

Mehadi Hasanverified - Nov 18

5 Days of Debugging Because of One Semicolon: Daniel Mgbechi's Journey from Frontend to Backend

Mehadi Hasanverified - Nov 15
chevron_left
6.3k Points • 225 Badges
24Posts
264Comments
341Connections
About Me:
I serve as the Content Manager at CoderLegion, where I oversee the quality, clarity, and a... Show more

Related Jobs

View all jobs →

Commenters (This Week)

4 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!