assignments
File / Directory / Link Check
Given a path, detect whether it's a file, directory, or symbolic link and perform the corresponding action.
If it’s a file:
Display the file contents.
Count and show the number of lines.
If it’s a directory:
List all files inside (optionally recursively or non-recursively; specify behavior in your implementation).
If it’s a symbolic link:
Indicate that it is a symlink and show the target.
Consider handling errors (non-existent paths, permission issues).
Check Services Running or Stopped
Given one or more service names (or identifiers), report whether each service is running or stopped.
Use platform-appropriate methods (e.g., systemctl on systemd Linux, service / init scripts, or OS-specific APIs).
For each service, print status (running/stopped/not found) and optionally exit codes or logs when available.
Handle permission requirements (may need elevated privileges).
Retain Recent 20 Files, Delete Others
In a given directory, keep the most recent 20 files and delete the rest.
Define "recent" (e.g., based on modification time).
Exclude directories (or define desired behavior for directories).
Provide a dry-run option to list files that would be deleted without deleting them.
Handle edge cases: fewer than 20 files, permission errors, and symlinks.
