Skip to content

fs_usage MacOS command

The fs_usage command in MacOS is a powerful tool for monitoring file system activity in real-time. It allows users to track various file operations such as file opens, reads, writes, and closes, as well as network filesystem activity. By providing detailed information about the processes and files involved in these operations, fs_usage can be a valuable tool for troubleshooting performance issues, identifying the source of disk I/O bottlenecks, and monitoring system activity. This command can be especially useful for system administrators, developers, and advanced users who need to analyze file system behavior and diagnose potential problems on their Mac systems. With its ability to display data continuously and filter information based on specific criteria, fs_usage offers a flexible and customizable solution for monitoring file system activity and gaining insights into the inner workings of your MacOS system.

Terminal window
fs_usage [options] [parameters]
OptionDescription
-fDisplay File access information
-wDisplay Accumulated write data
-rDisplay File Attributes
-dDisplay Disk Information
-sDisplay write data rate
-cDisplay kext and app bundleid
-vDisplay verbose output
ParameterDescription
file_pathSpecify a specific file or directory path to monitor
PIDSpecify the Process ID to monitor
Terminal window
fs_usage

Displays a live stream of file system activity, showing system calls made by processes.

Terminal window
fs_usage -p PID

Filters the fs_usage output to show only file system activity related to a specific process ID.

Track File System Activity for a Specific Directory

Section titled “Track File System Activity for a Specific Directory”
Terminal window
fs_usage /path/to/directory

Monitors file system activity for a specific directory, displaying file operations within that directory.

Display Detailed Information with Time Stamps

Section titled “Display Detailed Information with Time Stamps”
Terminal window
fs_usage -t

Enables timestamps in the fs_usage output, providing detailed information about file system activity with time references.

Monitor Operations with Specific File Extension

Section titled “Monitor Operations with Specific File Extension”
Terminal window
fs_usage -f extension

Filters the fs_usage output to show file system operations involving files with a specific extension.

Terminal window
fs_usage > fs_usage_output.txt

Redirects the fs_usage command output to a text file for further analysis and review.

:::tip
When using the fs_usage command in MacOS, make sure to carefully read the available options and their respective values in the command's documentation to understand and utilize the command effectively.
:::
### How do I use fs_usage in MacOS?
To use the fs_usage command in MacOS, execute the following command:
```bash
fs_usage

What is the purpose of the fs_usage command in MacOS?

Section titled “What is the purpose of the fs_usage command in MacOS?”

The fs_usage command in MacOS is used to display file system activity in real-time.

How can I filter the output of fs_usage by process ID?

Section titled “How can I filter the output of fs_usage by process ID?”

To filter the output of fs_usage by process ID, use the following command:

Terminal window
fs_usage -f process <process_id>

How can I monitor a specific file with fs_usage?

Section titled “How can I monitor a specific file with fs_usage?”

To monitor a specific file with fs_usage, use the following command:

Terminal window
fs_usage -f filesys <file_path>

How do I use fs_usage to track disk activity in MacOS?

Section titled “How do I use fs_usage to track disk activity in MacOS?”

To track disk activity in MacOS using fs_usage, execute the following command:

Terminal window
fs_usage -f diskio

Can I save the output of fs_usage to a file?

Section titled “Can I save the output of fs_usage to a file?”

Yes, you can save the output of fs_usage to a file by using the following command:

Terminal window
fs_usage > output.txt

How can I adjust the update interval of fs_usage output?

Section titled “How can I adjust the update interval of fs_usage output?”

To adjust the update interval of fs_usage output, use the following command:

Terminal window
fs_usage -I <interval_in_seconds>

Is there a way to display timestamps with the fs_usage output?

Section titled “Is there a way to display timestamps with the fs_usage output?”

Yes, you can display timestamps with the fs_usage output by using the following command:

Terminal window
fs_usage -t
  1. Monitoring file system activity
  2. Troubleshooting file system-related issues
  3. Analyzing disk usage and performance
  4. Capturing file system-related events for analysis