Home
21.
How to reverse a string in unix?
Pretty easy. Use the [rev] command.
$> echo "unix" | rev
xinu
22.
How to remove the last line/ trailer from a file in Unix script?

Always remember that [sed] switch '$' refers to the last line. So using this knowledge we can deduce the below command:
$> sed -i '$ d' file.txt

23.
How to remove certain lines from a file in Unix?

If you want to remove line to line from a given file, you can accomplish the task in the similar method shown above.
Here is an example:
$> sed -i '5,7 d' file.txt
The above command will delete line 5 to line 7 from the file file.txt

24.
How to check the command line arguments in a UNIX command in Shell Script?

In a bash shell, you can access the command line arguments using $0, $1, $2, … variables, where $0 prints the command name, $1 prints the first input parameter of the command, $2 the second input parameter of the command and so on.

25.
How do you create special files like named pipes and device files?
The system call mknod creates special files in the following sequence.
1. kernel assigns new inode,
2. sets the file type to indicate that the file is a pipe, directory or special file,
3. If it is a device file, it makes the other entries like major, minor device numbers.

For example:
If the device is a disk, major device number refers to the disk controller and minor device number is the disk.