Multiple choice general knowledge science & technology

Which of the following command you can use to list the first five records of a directory location say /app/unix/dir when your current location is /tmp/user?

  1. ls -l /tmp/user | head -5 /app/unix/dir

  2. ls -l /app/unix/dir | head -5

  3. ls /app/Unix/dir | Head +5

  4. ls /app/unix/dir | head +5

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The correct approach is to first list the target directory (/app/unix/dir) with 'ls -l', then pipe that output to 'head -5' to show only the first 5 lines. Option A incorrectly lists the current directory instead of the target. Options C and D have incorrect syntax for head command (should be -5, not +5).