• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

e4defrag: command not found

by Deepika

The e4defrag command in Linux is a command-line utility that is used to defragment ext4 file systems. This command can be used to optimize the performance of an ext4 file system by rearranging the files and directories on the file system to improve the efficiency of read and write operations. The e4defrag command can defragment both regular files and directories, and it can be run on unmounted file system.

If you encounter the below error while running the command e4defrag:

e4defrag: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install e2fsprogs
Ubuntu apt-get install e2fsprogs
Alpine apk add e2fsprogs
Arch Linux pacman -S e2fsprogs
Kali Linux apt-get install e2fsprogs
CentOS yum install e2fsprogs
Fedora dnf install e2fsprogs
OS X brew install e2fsprogs
Raspbian apt-get install e2fsprogs

e4defrag Command Examples

1. Defragment the filesystem:

# e4defrag /dev/sdXN

2. See how fragmented a filesystem is:

# e4defrag -c /dev/sdXN

3. Print errors and the fragmentation count before and after each file:

# e4defrag -v /dev/sdXN

Filed Under: Linux

Some more articles you might also be interested in …

  1. dir Command Examples in Linux
  2. update-rc.d: command not found
  3. ledctl Command Examples in Linux
  4. sysctl setting for high load and prevent DDoS
  5. gimp: GNU image manipulation program
  6. A little trick: select a random file or line in the file with shuf
  7. ss: command not found
  8. pwd Command Examples in Linux
  9. dolt clone: Clone a repository into a new directory
  10. fswatch: A cross-platform file change monitor

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright