I Aliased 'syscheck' to 7 Lines of Bash and Now I Run It on Every Server I SSH Into

Leader 1 5 34
calendar_todayschedule3 min read

Every time I SSH into a server, the first thing I want to know is: how's it doing?

Not a deep dive. Not a monitoring dashboard. Just the basics: how long has it been running, how much RAM is left, is the disk getting full, what's the IP. Five things that take five separate commands to check — hostname, uptime, free, df, hostname -I — and I'm tired of typing all five every single time.

So I put them in one script and aliased it to syscheck. Now I SSH in, type one word, and know the state of the machine in 2 seconds.


The Script

#!/bin/bash
# Quick System Info Report
# Prints key stats at a glance.
# Alias to 'syscheck' in your .bashrc for fast access.

echo "=== Quick System Check ==="
echo "Host    : $(hostname)"
echo "Uptime  : $(uptime -p)"
echo "RAM     : $(free -h | awk '/Mem/{print $3"/"$2}')"
echo "Disk /  : $(df -h / | awk 'NR==2{print $3"/"$2}')"
echo "IP      : $(hostname -I | awk '{print $1}')"
echo "========================="

Output looks like:

=== Quick System Check ===
Host    : my-server
Uptime  : up 3 days, 4 hours
RAM     : 1.2G/2.0G
Disk /  : 8.3G/25G
IP      : 192.168.1.42
=========================

Seven lines. No dependencies. Every command used here ships pre-installed on every Linux distribution I've ever touched.


What Each Line Actually Does

hostname — prints the machine name. Obvious, but when you're managing 4 servers with different roles, seeing "staging-web" vs "prod-db" at the top saves you from running the wrong command on the wrong box.

uptime -p — the -p flag gives you human-readable output like "up 3 days, 4 hours" instead of the default uptime output which includes load averages and the current time and is harder to parse at a glance.

free -h | awk '/Mem/{print $3"/"$2}'free -h shows memory in human-readable format (GB instead of bytes). The awk part grabs the "used" and "total" columns from the "Mem:" line and formats them as 1.2G/2.0G. You see at a glance whether you're at 60% RAM or 95%.

df -h / | awk 'NR==2{print $3"/"$2}' — same idea but for disk. df -h / checks the root partition, and awk pulls used and total. If this says 23G/25G you know you need to clean up soon.

hostname -I | awk '{print $1}' — prints the machine's IP address. The awk grabs just the first one in case there are multiple network interfaces.


The Alias Setup (The Part That Makes It Worth It)

The script is useful. The alias is what makes you actually use it.

nano ~/.bashrc

Add at the bottom:

alias syscheck='/home/user/syscheck.sh'

Or if you want the whole thing inline without a separate file:

alias syscheck='echo "=== Quick System Check ===" && echo "Host    : $(hostname)" && echo "Uptime  : $(uptime -p)" && echo "RAM     : $(free -h | awk '"'"'/Mem/{print $3"/"$2}'"'"')" && echo "Disk /  : $(df -h / | awk '"'"'NR==2{print $3"/"$2}'"'"')" && echo "IP      : $(hostname -I | awk '"'"'{print $1}'"'"')" && echo "========================="'

Then reload:

source ~/.bashrc

Now type syscheck on any terminal session on that machine and you get the full report instantly. I put this in .bashrc on every server I set up. It's the first thing I configure after SSH key access.


Extending It

Add CPU load:

echo "CPU     : $(top -bn1 | grep 'Cpu(s)' | awk '{print $2}')% used"

Add the top 3 processes by memory:

echo "Top RAM : $(ps aux --sort=-%mem | awk 'NR<=4{print $11}' | tail -3 | tr '\n' ' ')"

Add the OS version:

echo "OS      : $(cat /etc/os-release | grep PRETTY_NAME | cut -d'"' -f2)"

I keep the base version minimal on purpose. When I need deeper visibility, I have separate scripts for CPU and RAM monitoring and disk space warnings. syscheck is the quick glance. Those are the deep dive.


Where This Fits in the Workflow

I SSH into a server. I type syscheck. If everything looks normal, I do whatever I came to do. If RAM is at 95% or disk is nearly full, I investigate before touching anything else.

It's the 2-second sanity check that prevents the "oh no, why is everything slow" surprise 20 minutes into a debugging session when you finally think to check resources and realize the disk filled up an hour ago.


Full script, alias setup, and more extension ideas:

bashsnippets.xyz/snippets/quick-system-info-report.html

🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

How I Built a React Portfolio in 7 Days That Landed ₹1.2L in Freelance Work

Dharanidharan - Feb 9

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelskiverified - Mar 19

TypeScript Complexity Has Finally Reached the Point of Total Absurdity

Karol Modelskiverified - Apr 23

My Nginx Died at 2 AM and Nobody Noticed for 6 Hours. Now I Have a Watchdog Script

BashSnippets - May 21

I Packaged the Scripts I Copy to Every New Server Into a $9 Toolkit. Here's What's In It and Why.

BashSnippets - Jun 9
chevron_left
2.2k Points40 Badges
North Americabashsnippets.xyz
24Posts
24Comments
3Connections
Linux user who got tired of Googling the same bash commands every time I sat down at a terminal. Sta... Show more

Related Jobs

View all jobs →

Commenters (This Week)

2 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!