HowTo: Temporarily Switch Off SELinux Enforcement

To temporarily switch off SELinux enforcement, you can use the setenforce command. This command changes the mode of SELinux enforcement on the fly, without requiring a reboot or restart of any services. Here’s an example of how to temporarily switch off SELinux enforcement: # Set SELinux to permissive mode setenforce 0 In this example, setenforce … Read more

Linux / Unix Shell Script: Get Current User Name

You can get the current user name in a Linux or Unix shell script by using the whoami command or by accessing the $USER environment variable. Here’s an example using the whoami command: #!/bin/bash current_user=$(whoami) echo “The current user is: $current_user” And here’s an example using the $USER environment variable: #!/bin/bash current_user=$USER echo “The current … Read more

Linux List All Users In The System Command

You can use the getent command to list all the users in a Linux system. The getent command retrieves entries from various administrative database sources, including the password database which stores information about the users on the system. Here’s an example of how to use the getent command to list all the users in the … Read more

UNIX: Recursive Delete Directory / Files

To recursively delete a directory and all of its contents in Unix-like systems, you can use the rm command with the -r (or –recursive) option. Here’s an example of how to use the rm command to delete a directory called “example_dir” and all of its contents: rm -r example_dir The -r option tells rm to … Read more