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.
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"
@shura good job!
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!
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).
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.
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.