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

Red Hat Linux Interview Series 18

Q.) How will you add a SCSI Device without rebooting the VM ?

 

Q.) Write a BASH shell script to reverse the word “redhat”.

 

Q.) Why is UDP faster than TCP ? 

 

Bonus Q.) Can TCP and UDP sockets use the same port?

 

 

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.

5 Replies
shura
Flight Engineer
Flight Engineer
  • 455 Views

Nice question!

Q.) Write a BASH shell script to reverse the word “redhat”.

1) Simplest answer:

#!/bin/bash
echo tahder

2) Simple answer:

#!/bin/bash
echo redhat | rev

3) Ordinary answer:

#!/bin/bash
var="redhat"
copy=${var}
len=${#copy}
for((i=$len-1;i>=0;i--)); do rev="$rev${copy:$i:1}"; done
echo "$rev"

Chetan_Tiwary_
Community Manager
Community Manager
  • 444 Views

@shura good job!

0 Kudos
Trevor
Starfighter Starfighter
Starfighter
  • 391 Views

How will you add a SCSI Device without rebooting the VM ?

Here's the secret sauce:

#  echo "- - -"  >  /sys/class/scsi_host/host#/scan

Note:  Replace host# with the actual information, such as host1.  This scsi_host 
(host#) information can be found by using the following command:

      #  ls   /sys/class/scsi_host

Finally, ensure that your device has been added by executing the following command:

      #  cat /proc/scsi/scsi
      -  This will show all the devices that the system knows about - inclulding the
           newly added scsi device.


That's it.  You're done!

Trevor "Red Hat Evangelist" Chandler
Trevor
Starfighter Starfighter
Starfighter
  • 391 Views

Why is UDP faster than TCP?

 

TCP has speed limits posted along the network - UDP doesn't!!!!  That's one reason
anyway.  Here's more:

     -  UDP doesn't require a connection to be established before sending data

     -  UDP doesn't require a "handshake", or check, to verify if data was received
         properly  -  non-existent acknowledge packet (ACK).  

     -  UDP uses a smaller packet header (fixed at 8 bytes) than the TCP header
         (at least 20 bytes)
 
     -  UDP has no flow control limit (i.e. no speed limit)  -  the german autobahn vs.
          a neighborhood street
 
Without speed restrictions, along with any concerns for precautions, UDP should be
faster than TCP!  However, this comes with a price. Well, that's another topic, for
another day.
 
Trevor "Red Hat Evangelist" Chandler
Trevor
Starfighter Starfighter
Starfighter
  • 388 Views

Can TCP and UDP sockets use the same port?

 

You better believe it!!!   

Not that this was asked, but what makes this possible is some information in
that all important Layer 4 header.  

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