QA Graphic

BBEdit Command Line Tools

BBEdit has some cool command line tools

BBEdit has some shell commands which allows integration between the MacOS Shell and BBEdit. There are four commands:

  • bbedit - Allows you to export commands to be viewed/edited in BBEdit.
  • bbdiff - Makes it easy to compare two files.
  • bbfind - Use BBEdit powerful find feature to perform multi-file searches.
  • bbresults - Easily read formated error outputs in BBEdit results window.

Here are some creative ways to make use of the BBEdit command-line tools.

Four Sample BBEdit Commands

Directory Listing

List the current directory by file size (in Bytes). The results will display in BBEdit in a new window with the Unix Shell Script settings.

ls -lahS | bbedit -m "Unix Shell Script"

Largest Files on Your Computer

Thanks to alvinalexander.com on this tip "How to find the largest size file on your computer." I modified it so it outputs to BBEdit so that it's easier to read.

du -a * | sort -r -n | head -100 | bbedit -t "Top 100 Largest Size Files"

Find Files

A simple example which: Finds all the MP3 files and open the list in BBEdit with a window title called "MP3 Files." This has an extra bit of code to suppress

find / -name "*.mp3" 2>&1 | grep -v "Permission denied" | bbedit -t "MP3 Files"

Find Content

Use the bbfind command to search through files on your computer. In this case, search for the word "Confidential" in all the files in the /Users directory.

bbfind -nw "Confidential" /Users

That last command would be fun to run to see what files are marked Confidential on your computer.

 

About

Welcome to the BBEdit Blog, the official source of insights, tips, tricks, and inspiration for all users of BBEdit, the powerful text and code editor from Bare Bones Software. Whether you're a seasoned developer, a budding coder, or someone who just loves the precision of text editing, this blog is crafted for you.

Interested in getting BBEdit? Get it from Bare Bones' Website.

Schedule

SundayOpen Topic
MondayMedia Monday
TuesdayQA
WednesdayAffinity
ThursdayBBEdit
FridayMacintosh
SaturdayInternet Tools