• 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

fakeroot: command not found

by Deepika

“fakeroot” is a command-line tool in Linux-based systems that allows a user to run a command in an environment that mimics root privileges for file manipulation. This means that a user can execute commands as if they were the root user, without actually having root access.

The main use of fakeroot is to create a package or a package-like environment while running as a normal user, allowing the user to create files with permissions and ownership that would normally require root access. This is useful for creating Debian packages, for example, as the package maintainer does not need to run the process as root.

Fakeroot uses the LD_PRELOAD mechanism to intercept system calls that change the file ownership and permissions, and redirects them to an internal library. This library keeps track of the changes and applies them when the command finishes.

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

fakeroot: command not found

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

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

fakeroot Command Examples

1. Start the default shell as fakeroot:

# fakeroot

2. Run a command as fakeroot:

# fakeroot -- command command_arguments

3. Run a command as fakeroot and save the environment to a file on exit:

# fakeroot -s path/to/file -- command command_arguments

4. Load a fakeroot environment and run a command as fakeroot:

# fakeroot -i path/to/file -- command command_arguments

5. Run a command keeping the real ownership of files instead of pretending they are owned by root:

# fakeroot --unknown-is-real -- command command_arguments

6. Display help:

# fakeroot --help

Filed Under: Linux

Some more articles you might also be interested in …

  1. dvc add: Add changed files to the index
  2. How to uninstall rhythmbox-plugins from Ubuntu
  3. dstat: command not found
  4. hcitool Command Examples in Linux
  5. eslint: A pluggable linting utility for JavaScript and JSX
  6. hostapd Command Examples
  7. “go mod” Command Examples
  8. jq: command not found (JSON CLI Parser)
  9. expr: Evaluate expressions and manipulate strings
  10. How to Check vendor of installed RPM packages in Linux

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