• 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. openfortivpn Command Examples in Linux
  2. Oracle OS watcher (OSWatcher) – Understanding oswiostat
  3. How to take mailbox backup of Zimbra Account from CLI
  4. logsave Command Examples in Linux
  5. CentOS / RedHat : Beginners guide to log file administration
  6. tcptraceroute Command Examples in Linux
  7. How to Disable VNC Server from Xinetd in CentOS/RHEL 7
  8. cpulimit: command not found
  9. CentOS / RHEL 6 : How to list or install only security updates with yum
  10. What is an equivalent of which on the Windows command line?

You May Also Like

Primary Sidebar

Recent Posts

  • ctags: Generates an index (or tag) file of language objects found in source files for many popular programming languages
  • csvtool: Utility to filter and extract data from CSV formatted sources
  • csvstat: Print descriptive statistics for all columns in a CSV file
  • csvsql: Generate SQL statements for a CSV file or execute those statements directly on a database

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright