Question

UNIX help!!!! I need what the text would look like in the vi editor. also note...

UNIX help!!!! I need what the text would look like in the vi editor. also note this question has been posted before and the answers were all wrong!!

Write a shell script (bash or sh) that prints out the following lines/information:
Only your name may be hard coded, the rest must be obtained programmatically within the shell script.

Name: "Your name"

Hostname: "The computer's hostname"

Host IP: "The computer's IP number"

Default Gateway: "The computer's default gateway"

OS Version: "Whatever information on the OS version you can get programmatically"

Memory: "The amount of physical memory (not disk) the system has"

CPU Speed: "The CPU speed (in Hz not MIPS) the system thinks it has"

Disk space: "The amount of aggregate physical disk the system has"

A blank line (or two)

The shell script itself

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Script:

echo ""
echo "Name: John"
hostname=`hostname`
echo "Hostname: $hostname"
ip=`hostname -I`
echo "Host IP: $ip"
gateway=`/sbin/ip route | awk '/default/ { print $3 }'`
echo "Default Gateway: $gateway"
os_version=`uname -a`
echo "OS Version: $os_version"
memory=`cat /proc/meminfo | grep MemTotal | awk '{print $2 $3}'`
echo "Memory: $memory"
cpu_speed=`lscpu | grep 'CPU MHz' | awk '{print $3"MHz"}'`
echo "CPU Speed: $cpu_speed"
disk_space=`lsblk | awk 'NR>1{print $4}'|sed -n 1p`
echo "Disk space: $disk_space"
echo ""

Screenshots:

Script:

root@kali.-/ Documents# vi systeminfo -

echo n echo Name: John hostname-hostname echo Hostname: $hostname ip= hostname -1. echo Host IP: $ip gateway=/sbin

Test Run:

root@kali:-/Documents# sh system-info Name: John Hostname: kali Host IP: 192.168.44.133 Default Gateway: 192.168.44.2 os vers

Add a comment
Know the answer?
Add Answer to:
UNIX help!!!! I need what the text would look like in the vi editor. also note...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hi, I need help for solving Linux question. . 1.Using the proper text editor, create a...

    Hi, I need help for solving Linux question. . 1.Using the proper text editor, create a shell file called by (your name), your enrollment number, your program and the courses you study. Use the appropriate variables and display the above to the standard output (screen). . 2. Write A Shell Script to perform the following: Display the files and directories Print the date in 24 hour format Display the System id Display the current working directory Print the status of...

  • Subject. Internet & web design technology I need the questions number. 27, 28, 29,30,35,,37,39 , 40,43,45,49,50...

    Subject. Internet & web design technology I need the questions number. 27, 28, 29,30,35,,37,39 , 40,43,45,49,50 Please send me the correct answer The last page have 43,45,49,50 We were unable to transcribe this imageprotocol (32) t an application attempts to send a UDP do? message that exceeds the Maximum Transmission Unit (MTU), what will the Ip d) compress it le) expand MTU (b) truncate it (c) fragment n (a) reject it (33] Which is not true of the Transmission Controil...

  • i need help with a mips program to to covert roman numerals to real numbers Lab 4: Roman Numeral Conversion Part A: Due...

    i need help with a mips program to to covert roman numerals to real numbers Lab 4: Roman Numeral Conversion Part A: Due Sunday, 19 May 2019, 11:59 PM Due Friday, 24 May 2019, 11:59 PM Part B: Minimum Submission Requirements Ensure that your Lab4 folder contains the following files (note the capitalization convention): o Diagram.pdf o Lab4. asm O README.txt Commit and push your repository Lab Objective In this lab, you will develop a more detailed understanding of how...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT