SysInfo Script

SysInfo : Track system Informations

This script gathers various system information such as disk usage, RAM usage, processes, IP addresses, last login details, SSH login information, and currently logged-in users.

Description


This content originally appeared on DEV Community and was authored by Anass Assim

SysInfo : Track system Informations

  • This script gathers various system information such as disk usage, RAM usage, processes, IP addresses, last login details, SSH login information, and currently logged-in users.

Image description

Description

The script utilizes several Linux commands to fetch and calculate system metrics, providing a snapshot of the system's current state.

Prerequisites

Before running the script, ensure you have bc installed. If you're using Debian or a Debian-based distribution (like Ubuntu), you can install it with:

sudo apt-get update
 sudo apt-get install bc

Installation

Clone the repository:

 git clone https://github.com/ciscoAnass/SysInfo.git
 cd SysInfo

Make the script executable:

chmod +x SysInfo.sh

Running the Script on Every Terminal Launch (Optional)

  • If you want the script to run every time you open a terminal session, you can append the script path to ~/.bashrc using the following command:
echo "~/SysInfo/SysInfo.sh" >> ~/.bashrc
  • This command appends the path to your script to the end of ~/.bashrc.

  • After appending, source ~/.bashrc to apply the changes:

source ~/.bashrc
  • Now, the script will run automatically every time you open a new terminal session.

Creating a Command Alias

  • If you want to create a command alias so you can execute the script by simply typing sysinfo, follow these steps:
echo "alias sysinfo='~/SysInfo/SysInfo.sh'" >> ~/.bashrc

-Source ~/.bashrc to apply the changes:*

source ~/.bashrc

Now, you can simply type sysinfo in your terminal to run the script.

Example Output

After running the script, you will see output similar to:

System Information of <current_date>

Usage of / :             <DiskPer> of <DiskCapacity>
Memory Usage :           <RAM>%
Memory Swap :            <Swap>%
Total Processes :        <Processes>
Root Processes :         <RootProcesses>
IPv4 address  :         <ipv4>
IPv6 address :          <ipv6>
Last Login :            <lastlog>

<ssh_info>

Logged Users :           <LoggedUsers>

Contributing

  • Contributions are welcome! Feel free to fork the repository and submit pull requests.


This content originally appeared on DEV Community and was authored by Anass Assim


Print Share Comment Cite Upload Translate Updates
APA

Anass Assim | Sciencx (2024-10-18T23:25:15+00:00) SysInfo Script. Retrieved from https://www.scien.cx/2024/10/18/sysinfo-script/

MLA
" » SysInfo Script." Anass Assim | Sciencx - Friday October 18, 2024, https://www.scien.cx/2024/10/18/sysinfo-script/
HARVARD
Anass Assim | Sciencx Friday October 18, 2024 » SysInfo Script., viewed ,<https://www.scien.cx/2024/10/18/sysinfo-script/>
VANCOUVER
Anass Assim | Sciencx - » SysInfo Script. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/10/18/sysinfo-script/
CHICAGO
" » SysInfo Script." Anass Assim | Sciencx - Accessed . https://www.scien.cx/2024/10/18/sysinfo-script/
IEEE
" » SysInfo Script." Anass Assim | Sciencx [Online]. Available: https://www.scien.cx/2024/10/18/sysinfo-script/. [Accessed: ]
rf:citation
» SysInfo Script | Anass Assim | Sciencx | https://www.scien.cx/2024/10/18/sysinfo-script/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.