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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • 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. CentOS / RHEL 6 : How to change the verbosity of debug logs during booting
  2. Linux OS Service ‘acpid’
  3. backlight_control Command Examples in Linux
  4. extundelete Command Examples in Linux
  5. Linux OS Service ‘o2cb’
  6. atop Command Examples in Linux
  7. “VDO Status: Out of space” – Error while creating a VDO disk
  8. Linux Interview Questions – Linux Printing (CUPS)
  9. How to install CentOS / RHEL 7 on RAID Partition
  10. addr2line Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • nixos-rebuild Command Examples in Linux
  • nixos-option: Command Examples in Linux
  • nixos-container : Command Examples in Linux
  • nitrogen Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright