Neat alias commands for your Linux/FreeBSD or MacOS.
remember DOS tree — on unix that is just a one-liner
Neat alias commands for your Linux/FreeBSD or MacOS.
remember DOS tree — on unix that is just a one-liner
There was the tree command. And the awesome XTREE GOLD. who remembers that?

sceeenshot form Winworld
Instead of installing apps or stuff from Homebrew , apt, or dnf — you probably have all you need for such a tool with just a few alias and sharp commands. But it isn’t a TUI. And especially on MacOS — if you come from Windows on Linux Mint — the finder is well, not the best part of MacOS in my opinion. But the best part of Mac OS — is the terminal. So, here are some file oriented alias and subroutines you can put into .zshrc/.bashrc — should work for all 3 major Unix flavors.
- Directory-Only Tree
alias dirtree="find . -type d | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
Intent: Display only directories in a tree-like structure. Focus on directory hierarchy without file clutter. Uses the the sed pattern and filters for directories only.
me@Mac src % pwd
/Users/jon2allen/github/chatybot/src
me@Mac src % dirtree
.
|____chatybot.egg-info
|____chatybot
| |____tinydb1
| | |______pycache__
| |____audio_providers
| | |______pycache__
| |______pycache__
- extcount
extcount() {
find . -type f | rev | cut -d. -f1 | rev | tr '[:upper:]' '[:lower:]' | \
awk '/\// {print "(no extension)"; next} {print "."$1}' | \
sort | uniq -c | sort -nr | awk '{printf "%6d %s\n", $1, $2}'
}
Intent: Count and rank files by their extension. Quickly identify which file types dominate a project. The command uses awk, sort, uniq toextract the extension (or filename if no extension), then counts and sorts. This should be universal — MacOS, FreeBSD, Linux.
me@Mac chatybot % extcount | grep chatdsl
39 .chatdsl
me@Mac chatybot % extcount | head
5061 .pyc
5059 .py
947 (no
520 .h
320 .pyi
265 .txt
102 .so
61 .f90
57 .md
53 .typed
me@Mac chatybot % cd src
me@Mac src % extcount
45 .pyc
22 .py
5 .txt
1 (no
1 .toml
1 .chatdsl
- classic tree
tree='find . -print | sed -e '\''s;[^/]*/;|____;g;s;____|; |;g'\'
Intent: Uses find + sed to create visual output from directory structure, like class tree command in DOS.
me@Mac src % tree
.
|____chatybot.egg-info
| |____PKG-INFO
| |____SOURCES.txt
| |____entry_points.txt
| |____requires.txt
| |____top_level.txt
| |____dependency_links.txt
|____chatybot
| |____audio_file_manager.py
| |____chat_config.toml
| |____tinydb1
| | |______init__.py
| | |______pycache__
| | | |______init__.cpython-314.pyc
| | | |____corpus_manager.cpython-311.pyc
| | | |____corpus_manager.cpython-314.pyc
| | | |______init__.cpython-311.pyc
| | |____corpus_manager.py
| |____config_manager.py
| |____image_manager.py
| |____extract_code.py
| |______init__.py
| |____audio_providers
| | |____local_provider.py
| | |______init__.py
| | |____mistral_provider.py
| | |______pycache__
| | | |____base.cpython-314.pyc
| | | |____base.cpython-311.pyc
| | | |____mistral_provider.cpython-311.pyc
| | | |____mistral_provider.cpython-314.pyc
| | | |____openai_provider.cpython-314.pyc
| | | |____openai_provider.cpython-311.pyc
| | | |______init__.cpython-314.pyc
| | | |____local_provider.cpython-311.pyc
| | | |____local_provider.cpython-314.pyc
| | | |______init__.cpython-311.pyc
| | |____openai_provider.py
| | |____base.py
| |____pattern.py
| |______pycache__
| | |____image_generator.cpython-314.pyc
| | |____config_manager.cpython-314.pyc
| | |____pattern.cpython-311.pyc
| | |____main.cpython-311.pyc
| | |____image_generator.cpython-311.pyc
| | |____config_manager.cpython-311.pyc
| | |____pattern.cpython-314.pyc
| | |____main.cpython-314.pyc
| | |____audio_engine.cpython-311.pyc
| | |____chatybot_app.cpython-311.pyc
| | |____chatybot_app.cpython-314.pyc
| | |____audio_engine.cpython-314.pyc
| | |____audio_file_manager.cpython-314.pyc
| | |____logging_manager.cpython-314.pyc
| | |____chatydb.cpython-311.pyc
| | |____image_manager.cpython-314.pyc
| | |____logging_manager.cpython-311.pyc
| | |____chatydb.cpython-314.pyc
| | |____image_manager.cpython-311.pyc
| | |____audio_file_manager.cpython-311.pyc
| | |____buffer_manager.cpython-314.pyc
| | |______init__.cpython-314.pyc
| | |____chatdsl_parse.cpython-311.pyc
| | |____chat_config.cpython-314.pyc
| | |____audio_provider.cpython-314.pyc
| | |____extract_code.cpython-311.pyc
| | |____audio_provider.cpython-311.pyc
| | |____extract_code.cpython-314.pyc
| | |______init__.cpython-311.pyc
| | |____buffer_manager.cpython-311.pyc
| | |____chatdsl_parse.cpython-314.pyc
| |____chatdsl_parse.py
| |____chatybot_app.py
| |____chatydb.py
| |____logging_manager.py
| |____audio_engine.py
| |____main.py
| |____audio_provider.py
| |____buffer_manager.py
| |____macro.chatdsl
| |____image_generator.py
- extsize
extsize() {
find . -type f -exec du -k {} + | \
awk '{
# Get the filename from the path
split($2, path, "/");
file = path[length(path)];
# Extract extension
if (file ~ /\./) {
split(file, parts, ".");
ext = "." tolower(parts[length(parts)]);
} else {
ext = "(no extension)";
}
# Accumulate size (du -k gives kilobytes)
size[ext] += $1;
}
END {
for (e in size) {
printf "%10d KB %s\n", size[e], e;
}
}' | sort -nr
}
Intent: list aggregate size of all files of a certain extension. Extensive use of awk.
On MacOS — this gave me insight into dylib which I was not aware of until today days old. And that I have a lot of them dylib files. Google it, now!
me@Mac chatybot % extsize | head
103384 KB .dylib
92136 KB .pyc
71908 KB .py
49480 KB .so
32976 KB .txt
22464 KB (no extension)
13308 KB .png
8308 KB .jpg
6080 KB .h
2648 KB .mp3
- tree_no_git. -> avoid listing .git entries and others
alias tree_no_git='find . \( -name '\''.git'\'' -o -name '\''.svn'\'' -o -name '\''.hg'\'' -o -name '\''node_modules'\'' -o -name '\''__pycache__'\'' -o -name '\''venv'\'' -o -name '\''.mypy_cache'\'' \) -prune -o -print | sed -e '\''s;[^/]*/;|____;g;s;____|; |;g'\'
Intent: The same as tree, but reducing random noise from .git and other caches… can be tailored by editing the .svn or other dir names to exclude.
me@Mac chatybot_feb_2026 % pwd
/Users/me/github/chatybot_feb_2026
me@Mac chatybot_feb_2026 % ll .git
total 48
drwxr-xr-x 12 jon2allen staff 384B Apr 27 18:10 .
drwxr-xr-x 33 jon2allen staff 1.0K Mar 2 21:20 ..
-rw-r--r--@ 1 jon2allen staff 361B Apr 27 18:10 config
-rw-r--r-- 1 jon2allen staff 73B Mar 2 20:37 description
-rw-r--r-- 1 jon2allen staff 25B Mar 2 20:37 HEAD
drwxr-xr-x 16 jon2allen staff 512B Mar 2 20:37 hooks
-rw-r--r-- 1 jon2allen staff 5.7K Mar 2 20:44 index
drwxr-xr-x 3 jon2allen staff 96B Mar 2 20:37 info
drwxr-xr-x 4 jon2allen staff 128B Mar 2 20:37 logs
drwxr-xr-x 4 jon2allen staff 128B Mar 2 20:37 objects
-rw-r--r-- 1 jon2allen staff 184B Mar 2 20:37 packed-refs
drwxr-xr-x 5 jon2allen staff 160B Mar 2 20:37 refs
jon2allen@Mac chatybot_feb_2026 % tree_no_git
.
|____dsl_template.chatdsl
|____LICENSE.md
|____tps+20260227_180325.csv
|____fruit
| |____fruit.py
| |____notes_fruit.py
|____tps+20260227_180046.csv
|____nanjing5.chatdsl
|____REFACTORING_REPORT.md
|____chatdsl_bnf.txt
|____pyproject.toml
|____cpp_create_dsl.prompt
|____chatybot.log.20260222_170859
|____fibo.chatdsl
|____chatybot.log.20260227_152517
|____pascal_test2.chatdsl
|____test_refactor.py
|____README.md
|____tps+20260227_175923.csv
|____sonnet
| |____chroma_2.py
| |____extract2.py
| |____notes_extract1.py
| |____extract1.py
| |____notes_extract2.py
| |____notes_chroma_2.py
|____tps+20260227_180217.csv
|____test1_prompt.txt
|____.gitignore
|____tps+20260227_175852.csv
|____.chat_history
|____cleanhouse.sh
|____dsl_prompt_jan_9_2026.prompt
|____tps+20260227_180249.csv
|____dsl_test
| |____chatbot_requirements.txt
| |____test7_variable_substitution.chatdsl
| |____test5_script_execution.chatdsl
| |____notes.txt
| |____test6_multiline_input.chatdsl
| |____test3_file_bank.chatdsl
| |____test4_prompt_engineering.chatdsl
| |____test10_error_handling.chatdsl
| |____test1_basic_commands.chatdsl
| |____test9_streaming_logging.chatdsl
| |____template.txt
| |____test8_conditional_logic.chatdsl
| |____test_master.chatdsl
| |____test.txt
| |____conditional_test.txt
| |____test2_file_handling.chatdsl
| |____test_script.txt
|____chatybot_spec_jan_2025.txt
|____polish_dishes.chatdsl
|____src
| |____chatybot
| | |____chat_config.toml
| | |____tinydb1
| | | |______init__.py
| | | |____corpus_manager.py
| | |____config_manager.py
| | |____extract_code.py
| | |______init__.py
| | |____chatybot_app.py
| | |____chatydb.py
| | |____logging_manager.py
| | |____main.py
| | |____buffer_manager.py
- recent -> find files that have been created in x many dayss
# Usage: recent [path] [days]
recent() { find "${1:-.}" -type f -mtime "-${2:-1}" | sed -e 's;[^/]*/;| ;g'; }
Intent: search for files recently created in ≤ days. grep for the ones you want.
me@Mac chatybot % recent . 1 | grep chatdsl
| | accuracytest.chatdsl
| chatdsl_bnf.txt
| | | chatdsl_parse.py
- bigfiles — find all files of a certain size
# Usage: bigfiles [path] [size] (e.g., 10M, 1G, 1000k)
bigfiles() { find "${1:-.}" -type f -size "+${2:-10M}" -print0 | xargs -0 ls -lh | sed -e 's/^/[BIG] /'; }
Intent: Find those big suckers and wrangle them into submission.
me@Mac chatybot % bigfiles
[BIG] -rw-r--r-- 1 jon2allen staff 28M Apr 20 16:25 ./imagine_debug_20260420_162425.txt
[BIG] -rw-r--r--@ 1 jon2allen staff 15M Apr 27 18:15 ./test_audio/venv/lib/python3.14/site-packages/pyarrow/libarrow_compute.2400.dylib
[BIG] -rw-r--r--@ 1 jon2allen staff 19M Apr 27 18:15 ./test_audio/venv/lib/python3.14/site-packages/pyarrow/libarrow_flight.2400.dylib
[BIG] -rw-r--r--@ 1 jon2allen staff 44M Apr 27 18:15 ./test_audio/venv/lib/python3.14/site-packages/pyarrow/libarrow.2400.dylib
Thee are those dylib items again… hmmm… more resarch needed.
So, you have all you need as one might say!. The last 2 show you how to put in parameters
These don’t have to be alias — they can exist as functions
sample .zshrc:
extsize() {
find . -type f -exec du -k {} + | \
awk '{
# Get the filename from the path
split($2, path, "/");
file = path[length(path)];
# Extract extension
if (file ~ /\./) {
split(file, parts, ".");
ext = "." tolower(parts[length(parts)]);
} else {
ext = "(no extension)";
}
# Accumulate size (du -k gives kilobytes)
size[ext] += $1;
}
END {
for (e in size) {
printf "%10d KB %s\n", size[e], e;
}
}' | sort -nr
}
invtree() { find "${1:-.}" -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g' | awk '{a[i++]=$0} END {for (j=i-1; j>=0;) print a[j--] }'; }
alias tree_no_git="find . \( -name '.git' -o -name '.svn' -o -name '.hg' -o -name 'node_modules' -o -name '__pycache__' -o -name 'venv' -o -name '.mypy_cache' \) -prune -o -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
recent() { find "${1:-.}" -type f -mtime "-${2:-1}" | sed -e 's;[^/]*/;| ;g'; }
bigfiles() { find "${1:-.}" -type f -size "+${2:-10M}" -print0 | xargs -0 ls -lh | sed -e 's/^/[BIG] /'; }
Just my opinion… This is more nimble and quicker than using a GUI tool to zero in on your storage and files.

AI generated — tree with file leaves, and dir branches.
Enjoy your alias commands!
메타데이터
- post_id
- 031e48bd783d
- slug
- neat-alias-commands-for-your-linux-freebsd-or-macos-031e48bd783d
- url
- https://medium.com/@jallenswrx2016/neat-alias-commands-for-your-linux-freebsd-or-macos-031e48bd783d
- canonical_url
- https://medium.com/@jallenswrx2016/neat-alias-commands-for-your-linux-freebsd-or-macos-031e48bd783d
- author_url
- https://medium.com/@jallenswrx2016
- status
- ok
- fetched_at
- 2026-06-14 11:28:49