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

Red Hat Linux Interview Series 21

Q.) Explain the output : 

 

cat /proc/loadavg 

25.72 23.19 23.35 42/3411 43603

 

Bonus Q.) Where else do you see the first 3 data frequently ?

 

Q.) You need to use any combination of linux commands using pipe in a single line to just filter out the IP addresses ( eg. 192.x.x.x  and 127.0.0.1 ) from the ifconfig or ip a s command.

 

Q.)  A file contains a string “Chetan-Tiwary” . Your task is to replace the “-” with “:” ( without using vim/vi or echo or any text editor that has an interface) so that the string becomes “Chetan:Tiwary”.

 

 

Level - L2 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.

2 Replies
Trevor
Starfighter Starfighter
Starfighter
  • 9 Views

Bonus question of the first question:  Where else do you see the first 3 data frequently ?

 

Answer:  I'm going to take a wild guess - the output ot the uptime command.

 

 

 

Trevor "Red Hat Evangelist" Chandler
0 Kudos
Trevor
Starfighter Starfighter
Starfighter
  • 8 Views

That 3rd question is screaming at me as well, so I won't be able to ignore
it either:

A file contains a string “Chetan-Tiwary” . Your task is to replace the “-” with “:” ( without using vim/vi or echo or any text editor that has an interface) so that the string becomes “Chetan:Tiwary”.

 

To satisfy this request, that will involve my old friend - the sed utility.  Yes, I referred
to it as a utility because to me it's always been much more than just a command.
Okay, I won't get bogged down in that - call it a command if you must, that won't
change it's utility!!!

Here's the "command" that will be needed to accommodate the question:

sed  -i  's/Chetan-Tiwary/Chetan:Tiwary/g'  filename

I promise you, that every occurrence of the string "Chetan-Tiwary" that exists in 
"filename", will be replaced with the string "Chetan:Tiwary".  

Okay, that's all for this episode of "Replace That String".  Thanks Chetan for
all the wonderful batting practice!!!

 

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