Safe script workflow
- Read the script from top to bottom before running it.
- Check if it uses
sudo, and confirm every privileged command makes sense to you.
- Run on a test machine first when possible.
- Keep backups for files you might change (network configs, service configs, user data).
- Run one script at a time and verify output before moving on.
Glossary
- Bash: A command-line shell used to run commands and scripts.
- Script: A text file containing commands executed in sequence.
- sudo: Run a command with elevated privileges (administrator/root).
- chmod: Change file permissions (read/write/execute).
- chown: Change file owner and group.
- systemctl: Manage Linux services with systemd.
- journalctl: View systemd logs.
- nmcli: Command-line tool for NetworkManager.
- tar: Archive files/folders for backup and restore.
- firewalld: Firewall service managed with
firewall-cmd.
Troubleshooting quick fixes
-
permission denied
You may be missing execute permission. Run chmod +x script.sh then try again.
-
command not found
Install the required package (example: nmcli is usually from NetworkManager tools).
-
service not found
Confirm service name with systemctl list-unit-files --type=service.
-
network disconnected after change
Use the DHCP revert script in the library or reconnect from a local console.
-
archive restore failed
Verify file path, destination permissions, and test archive integrity with
tar -tzf backup.tar.gz.