The mysystemreports script
This page was last updated on August 11, 2010.
Table Of Contents
- Introduction
- Requirements
- About the script
- See the script
- Get the script
- Use the script
- Obligatory Happy Ending
Introduction
This document gives a quick overview of the mysystemreports script.
Requirements
- Kubuntu or Ubuntu 8.04 (Hardy Heron) or earlier.
- An understanding of sudo. See https://help.ubuntu.com/community/RootSudo and http://www.psychocats.net/ubuntu/graphicalsudo for detailed information.
About the script
This is a simple Bash script that creates 6 reports on your hardware, boot-up messages, installed packages, etc. in a directory on your Desktop and lets you know what it’s doing while it runs. The reports it creates are:
- A list of installed packages.
- A list of currently loaded kernel modules.
- A list of your PCI buses and all devices connected to them.
- A report of the partitions on your computer.
- A copy of your boot-up messages.
- A list of your hardware.
Three of the commands (fdisk, dmesg and lshw) require root access to run properly, so you’ll be asked for your system password.
See the script
#!/bin/sh
###########################################################################
# STEP_1 - ABOUT THIS SCRIPT #
###########################################################################
STEP_1() {
echo "#####################################################################"
echo "# mysystemreports v0.3 #"
echo "# by Little Girl #"
echo "# http://mostlylinux.wordpress.com #"
echo "# Anyone may feel free to use and/or modify this script. #"
echo "# #"
echo "# WHAT THIS SCRIPT DOES: #"
echo "# #"
echo "# 1. This script creates reports on your hardware, boot-up #"
echo "# messages, installed packages, etc. #"
echo "# #"
echo "# 2. The reports will be placed on your Desktop in a directory #"
echo "# named MySystemReports and will have the current date and #"
echo "# time added to their names. #"
echo "# #"
echo "# 3. Three of these commands (fdisk, dmesg and lshw) require root #"
echo "# access to run properly. As a result, you will be asked for #"
echo "# your system password when running this script. #"
echo "#####################################################################"
echo
}
###########################################################################
# STEP_2 - HELP SECTION #
###########################################################################
STEP_2() {
echo "#####################################################################"
echo "# HOW TO USE THIS SCRIPT IN A TERMINAL: #"
echo "# #"
echo "# 1. Open a terminal window. #"
echo "# #"
echo "# 2. Change to the directory this script is in. For example: #"
echo "# #"
echo "# cd /home/Desktop #"
echo "# #"
echo "# 3. Type this command: #"
echo "# #"
echo "# bash mysystemreports #"
echo "# #"
echo "# HOW TO USE THIS SCRIPT FROM A SHORTCUT: #"
echo "# #"
echo "# 1. Right-click this script in your file manager. Change its #"
echo "# properties so that it's executable and runs in a terminal. #"
echo "# #"
echo "# 2. Create a shortcut to the script and place the shortcut #"
echo "# anywhere you like. #"
echo "# #"
echo "# 3. Use the shortcut to run the script. #"
echo "#####################################################################"
}
###########################################################################
# STEP_3 - CHECK FOR DESTINATION DIRECTORY. CREATE IT IF NECESSARY. #
###########################################################################
STEP_3() {
echo "Checking if MySystemReports directory exists on the Desktop..."
if [ -d ~/Desktop/MySystemReports ] ; then
echo "MySystemReports directory exists. Continuing..."
else
echo "Creating MySystemReports directory..."
mkdir ~/Desktop/MySystemReports
fi
}
###########################################################################
# STEP_4 - CREATE SYSTEM REPORTS IN THE DESTINATION DIRECTORY #
###########################################################################
STEP_4() {
echo "Creating 1st report - a list of installed packages..."
dpkg --get-selections > ~/Desktop/MySystemReports/MyPackages.txt--`date +%Y-%m-%d`
echo "Creating 2nd report - a list of currently loaded kernel modules..."
lsmod > ~/Desktop/MySystemReports/lsmod.txt--`date +%Y-%m-%d`
echo "Creating 3rd report - a list of my PCI buses and all devices connected to them..."
lspci -vv > ~/Desktop/MySystemReports/lspci.txt--`date +%Y-%m-%d`
echo "Creating 4th report - a report showing the partitions on my computer..."
sudo fdisk -l > ~/Desktop/MySystemReports/fdisk.txt--`date +%Y-%m-%d`
echo "Creating 5th report - a copy of my boot-up messages..."
sudo dmesg > ~/Desktop/MySystemReports/dmesg.txt--`date +%Y-%m-%d`
echo "Creating 6th report - a list of my hardware..."
sudo lshw -html > ~/Desktop/MySystemReports/lshw.html--`date +%Y-%m-%d`
}
###########################################################################
# STEP_5 - DISPLAY JOB DONE AND PROMPT USER TO CLOSE THE WINDOW #
###########################################################################
STEP_5() {
echo -n "Done! Press the Enter key to exit this script."
read keypress
}
###########################################################
# BEGIN THE SCRIPT #
###########################################################
###########################################################
# RUN THIS IF NO COMMAND LINE ARGUMENTS ARE USED #
###########################################################
if [ $# = '0' ]
then
STEP_1 | more
STEP_3
STEP_4
STEP_5
###########################################################
# RUN ONE OF THESE IF ONE COMMAND LINE ARGUMENT IS USED #
###########################################################
elif [ $# = '1' ]
then
###################################################
# Run this if a known argument is used #
###################################################
if [ "$1" = "-h" ]
then
STEP_2 | more
###################################################
# Run this if a known argument is used #
###################################################
elif [ "$1" = "--help" ]
then
STEP_2 | more
###################################################
# Run this if an unknown argument is used #
###################################################
else
echo "invalid argument"
fi
###########################################################
# RUN THIS IF MORE THAN ONE COMMAND LINE ARGUMENT IS USED #
###########################################################
else
echo "invalid number of arguments"
fi
Get the script
Download mysystemreports_v0.3.zip
Or:
- Copy the script above.
- Paste the copied script into a text editor.
- Save it as mysystemreports somewhere on your computer.
Use The Script
- Open a terminal window.
- Change to the directory the script is in. For example, if the script is on the Desktop, you would type this command:
- Press the Enter key.
- Run the script by typing this command:
- Press the Enter key.
- Type in your password when asked.
- When the script finishes running, press the Enter key and close the terminal window.
- The reports will be in the MySystemReports directory on your Desktop. You can move the directory to another location on your computer or keep it on your Desktop. Advanced users can modify the script so that it saves the files to a different location.
cd ~/Desktop
bash mysystemreports
Obligatory Happy Ending
And they all lived happily ever after. The end.
![]() |
The mysystemreporst script from http://mostlylinux.wordpress.com is Copyright © 2007 – 2011 by Little Girl, licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License, and offered free of charge without warranty of any kind, either expressed or implied. |


Great script!! I’ve modified it slightly to suit my #! install as “Desktop” is only visible in a file manager by default.
Thanks, cheers.
Comment by yakrider — December 23, 2010 @ 9:18 am
I’m glad you like it! Since it was written for Ubuntu/Kubuntu and both have the Desktop, that isn’t an issue for them. I suppose I could rewrite it to use a variable and then have the user make one edit to specify the path used by the variable. By the way, have you checked out the mysystemfiles script, which is the sister script to this one?
Comment by mostlylinux — December 23, 2010 @ 6:39 pm