FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
Python One-Liners That Replace Entire Shell Scripts
How-ToTools

Python One-Liners That Replace Entire Shell Scripts

via Dev.to TutorialAlex Spinov4h ago

I used to write 50-line bash scripts for things Python does in one line. Here are 15 one-liners I use daily. File Operations Start a web server (current directory) python3 -m http.server 8080 Replaces: nginx config + setup for quick file sharing. Find duplicate files python3 - c " import os,hashlib; seen={}; [print(f ' DUPE: {f} ' ) for r,d,files in os.walk( ' . ' ) for f in files if (h:=hashlib.md5(open(os.path.join(r,f), ' rb ' ).read()).hexdigest()) in seen or seen.update({h:f}).__class__.__name__== ' NoneType ' and False] " Okay that's ugly. Here's the readable version: python3 << ' EOF ' import os , hashlib seen = {} for root , dirs , files in os . walk ( ' . ' ): for name in files : path = os . path . join ( root , name ) file_hash = hashlib . md5 ( open ( path , ' rb ' ). read ()). hexdigest () if file_hash in seen : print ( f ' DUPE: { path } == { seen [ file_hash ] } ' ) else : seen [ file_hash ] = path EOF Pretty-print JSON cat ugly.json | python3 -m json.tool Replaces: jq (w

Continue reading on Dev.to Tutorial

Opens in a new tab

Read Full Article
2 views

Related Articles

IntentCAD v0.8.0 — Thirteen EPICs, One Day
How-To

IntentCAD v0.8.0 — Thirteen EPICs, One Day

Dev.to • 7h ago

A Growing Position Doesn't Always Mean Fresh Buying — Here's How to Tell
How-To

A Growing Position Doesn't Always Mean Fresh Buying — Here's How to Tell

Dev.to Beginners • 8h ago

Tutorials Are Lying to You Here’s What Actually Works ?
How-To

Tutorials Are Lying to You Here’s What Actually Works ?

Medium Programming • 11h ago

Flutter Mistakes That Make Apps Slow ⚡
How-To

Flutter Mistakes That Make Apps Slow ⚡

Medium Programming • 12h ago

Welcome Thread - v370
How-To

Welcome Thread - v370

Dev.to • 12h ago

Discover More Articles