semanage Verified current stable Not installed?

Semanage / Delete User Defined File Labeling Rule Linux

Delete User Defined File Labeling Rule Linux

Use the semanage command to delete a user-defined file labeling rule for SELinux contexts.

$
Terminal
sudo semanage fcontext -d '</mnt/share(/.*)?>'

When To Use

This command is used to remove specific SELinux file labeling rules.

Warning

Destructive operation. Confirm the target path and keep a backup before executing.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
sudo semanage fcontext -d '</mnt/share(/.*)?>'

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
Removing context for '/mnt/share':

Context removed successfully.

Command Breakdown

What each part is doing

sudo
Base Command
The executable that performs this operation. Here it runs Semanage before the shell applies any redirect operators.
-d
d| delete
The value supplied for d| delete.
</mnt/share(/.*)?>
mnt share( .*)?
The value supplied for mnt share( .*)?.
-d
Command Option
Tool-specific option used by this command invocation.

How To Run

Execution path

  1. Step 1

    Run the command with sudo privileges.

  2. Step 2

    Specify the -d or --delete option to remove the rule.

  3. Step 3

    Provide the path pattern for the file context to delete.

Alternative Approaches

Comparable commands in other tools

Alternative tools that share the "manage-files" operation intent.