-
Notifications
You must be signed in to change notification settings - Fork 0
/
ifetch.sh
executable file
·65 lines (59 loc) · 3.62 KB
/
ifetch.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
# Function to display the Linux logo in colored ASCII art
print_linux_logo() {
echo -e "\e[1;35m _ _ _ _ _ "
echo -e "\e[1;35m | | | | (_) | (_) "
echo -e "\e[1;35m | |__ | |___ __ _ _ _ ___ ___ | |_ _ __ _ ___ __"
echo -e "\e[1;35m | '_ \| __\ \ /\ / / | | | | | / __|/ _ \ | | | '_ \| | | \ \/ /"
echo -e "\e[1;35m | |_) | |_ \ V V / | | | |_| \__ \ __/ | | | | | | |_| |> < "
echo -e "\e[1;35m |_.__/ \__| \_/\_/ |_| \__,_|___/\___| |_|_|_| |_|\__,_/_/\_\ "
echo -e "\e[1;35m "
echo -e "\e[1;35m "
}
# Function to display system information with icons
print_system_info() {
# Username and operating system name
echo -e "\e[1;32m┌──────────────────────────────────────────────────────────────────────┐"
echo -e "│\e[1;32m👤 $(whoami)@$(uname -n) │"
echo -e "├──────────────────────────────────────────────────────────────────────┤"
# System information
if command -v lsb_release &>/dev/null; then
echo -e "│\e[1;34m💻 OS: $(lsb_release -d -s | sed 's/"/\\"/g') │"
elif [ -e /etc/os-release ]; then
echo -e "│\e[1;34m💻 OS: $(grep "^PRETTY_NAME" /etc/os-release | cut -d "=" -f 2 | tr -d '"' | sed 's/"/\\"/g') │"
else
echo -e "│\e[1;34m💻 OS: N/A │"
fi
# Other system information
if command -v hostname &>/dev/null; then
echo -e "│\e[1;34m🏠 Host: $(hostname) │"
fi
if command -v uname &>/dev/null; then
echo -e "│\e[1;34m🐧 Kernel: $(uname -r) │"
fi
if command -v uptime &>/dev/null; then
echo -e "│\e[1;34m⏲️ Uptime: $(uptime -p | sed 's/up //') │"
fi
if command -v package_count &>/dev/null; then
echo -e "│\e[1;34m📦 Packages: $(package_count) │"
fi
if command -v free &>/dev/null; then
echo -e "│\e[1;34m💾 Memory: $(free -h | awk '/^Mem:/ {print $3 " / " $2}') │"
fi
echo -e "\e[1;32m└──────────────────────────────────────────────────────────────────────┘"
}
# Function to count installed packages
package_count() {
if command -v pacman &>/dev/null; then
pacman -Qq | wc -l
elif command -v dpkg &>/dev/null; then
dpkg-query -f '${binary:Package}\n' -W 2>/dev/null | wc -l
elif command -v rpm &>/dev/null; then
rpm -qa 2>/dev/null | wc -l
else
echo "N/A"
fi
}
# Display Linux logo and system information
print_linux_logo
print_system_info