Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions System_check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash

# This script is for System Check Requirements

log_file="system_check_$(date +%Y-%m-%d).log"

# To start the log
{
echo "===== SYSTEM CHECK REPORT ====="
echo "Date: $(date)"
echo ""

# Disk usage
echo ">> Disk Usage:"
df -h
echo ""

# Warning if disk usage exceeds 80%
echo ">> Disk Usage Warnings (Above 80%):"
df -h | awk 'NR>1 {gsub("%","",$5); if($5 > 80) print "WARNING: " $1 " is at " $5 "% usage"}'
echo ""

# Memory usage
echo ">> Memory Usage (MB):"
free -m
echo ""

# CPU load
echo ">> CPU Load:"
uptime
echo ""

# Total running processes
echo ">> Total Running Processes:"
ps -e --no-headers | wc -l
echo ""

# Top 5 memory-consuming processes
echo ">> Top 5 Memory-Consuming Processes:"
ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%mem | head -n 6
echo ""

echo "===== END OF REPORT ====="

} > "$log_file"

echo "System check completed. Report saved to $log_file"
Binary file added _backup_20260401_153414.tar.gz
Binary file not shown.
28 changes: 28 additions & 0 deletions backup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# To make a directory

dir="Learning"
if [[ -z "$dir" ]]; then
echo "$dir: is a directory"
fi

# To check if a directory exists

if [[ ! -d "$dir" ]]; then
echo "Yes, the directory exists."
fi

# Creating timestamp

TIMESTAMP=$(date +"%Y%m%d_%H%M%S")

#Creating a Backup filename

BACKUP_NAME="${dir}_backup_${TIMESTAMP}.tar.gz"

echo "Backup: $BACKUP_NAME"

tar -czf "$BACKUP" "$dir"


1 change: 1 addition & 0 deletions bash-assignment
Submodule bash-assignment added at bd24f9
7 changes: 7 additions & 0 deletions file_manager.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#1/bin/bash

# This script is to create file

cat <<EOF > file.txt
This is for text
EOF
7 changes: 7 additions & 0 deletions logfile.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#1/bin/bash

# This script is to create file

cat <<EOF > file.txt
This is for text
EOF
42 changes: 42 additions & 0 deletions system_check_2026-03-30.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
===== SYSTEM CHECK REPORT =====
Date: Mon Mar 30 14:14:49 WAT 2026

>> Disk Usage:
Filesystem Size Used Avail Use% Mounted on
none 2.9G 0 2.9G 0% /usr/lib/modules/6.6.87.2-microsoft-standard-WSL2
none 2.9G 4.0K 2.9G 1% /mnt/wsl
drivers 699G 171G 528G 25% /usr/lib/wsl/drivers
/dev/sdd 1007G 1.6G 955G 1% /
none 2.9G 400K 2.9G 1% /mnt/wslg
none 2.9G 0 2.9G 0% /usr/lib/wsl/lib
rootfs 2.9G 2.7M 2.9G 1% /init
none 2.9G 488K 2.9G 1% /run
none 2.9G 0 2.9G 0% /run/lock
none 2.9G 0 2.9G 0% /run/shm
none 2.9G 76K 2.9G 1% /mnt/wslg/versions.txt
none 2.9G 76K 2.9G 1% /mnt/wslg/doc
C:\ 699G 171G 528G 25% /mnt/c
tmpfs 589M 8.0K 589M 1% /run/user/0

>> Disk Usage Warnings (Above 80%):

>> Memory Usage (MB):
total used free shared buff/cache available
Mem: 5883 349 5335 3 198 5374
Swap: 2048 0 2048

>> CPU Load:
14:14:49 up 1 day, 22:45, 1 user, load average: 0.03, 0.02, 0.00

>> Total Running Processes:
41

>> Top 5 Memory-Consuming Processes:
PID PPID CMD %MEM %CPU
14182 14083 /root/.vscode-remote-contai 0.9 0.0
308 1 /usr/bin/python3 /usr/share 0.3 0.0
707 1 /usr/libexec/packagekitd 0.3 0.0
216 1 /usr/bin/python3 /usr/bin/n 0.3 0.0
18872 1 /lib/systemd/systemd-resolv 0.2 0.0

===== END OF REPORT =====
Empty file added user_info.log
Empty file.
37 changes: 37 additions & 0 deletions user_info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

# This script is to collect user's data

read -p "Enter your name: " name

read -p "Enter your Age: " age

read -p "Enter your Country: " country

# Validating age to be numeric

if ! [[ "$age" =~ ^[0-9]+$ ]]; then
echo "Age must be numeric."
exit 1
fi

# Greeting message for the user

echo "Hello, $name you are $age years old, and you are from $country, welcome onboard."

# categorising the user based on their ages

if (( age < 18 )); then
category="Minor"
elif (( age <= 65 )); then
category="Adult"
else
category="Senior"
fi

# Handle missing input

if [[ -z "$name" || -z "$age" || -z "$country" ]]; then
echo "All fields (name, age, country) are required."
exit 1
fi