cancel
Showing results for 
Search instead for 
Did you mean: 
Chetan_Tiwary_
Community Manager
Community Manager
  • 981 Views

Red Hat Linux Interview Series 30

Jump to solution

Q.) cat actors.txt 

Chetan_Tiwary__0-1730751140363.png

print the file with its line count as shown below :

1 : Tom Hanks
2 : Leonardo DiCaprio  ....likewise

 

 

Q.)  Write a Bash script that takes a single character as input from the user. The script should determine whether the input character is a vowel or a consonant. Adjust for both lowercase and uppercase condition.

 

Q.) As a system administrator, you need to script a way to quickly gather and display essential server metrics for routine monitoring. This information is crucial for assessing server health and performance.  Include the metrics like Date, Uptime, Memory Usage, Network interface along with IPs, CPU only report with 2 seconds interval and 2 times, top 5 processes by memory usage.

 

Bonus Q.) Write a Bash script that continuously displays a countdown starting from 0, incrementing by 1 in each iteration. The script should run indefinitely until manually terminated.

 

Level L1 and above

 

I'll be posting a series of Linux-related questions covering various skill levels. Feel free to share your insights and expertise. Your contributions will benefit learners at all stages, from those in current roles to those preparing for Linux interviews.

11 Replies
Chetan_Tiwary_
Community Manager
Community Manager
  • 318 Views

@Trevor This works like a charm !! great job and it is easily understandable for beginners as well!

Trevor
Starfighter Starfighter
Starfighter
  • 852 Views

Bonus Q.) Write a Bash script that continuously displays a countdown starting from 0, incrementing by 1 in each iteration. The script should run indefinitely until manually terminated.

Observation:  If the script is going to be counting down, shouldn't it be decrementing instead of incrementing   I'll have mine increment by 1 anyway - starting from 0!

 

Solution:

=================================

# This script will run until the cows come home, the electricity is turned off,
#  or which ever comes first  - unless there is manual intervention on the 
#  part of the user to terminate it!

val=0

while [ true ]
do
     echo The value of val is $val
     val=$((val+1))
     sleep 1
done

=====================================

 

 

Trevor "Red Hat Evangelist" Chandler
Join the discussion
You must log in to join this conversation.