Monday, May 12, 2014

[Solved] Linux Commands Challenge : 001

Fancy your Linux skills ? Take this challenge and answer these simple 5 questions on Linux Commands.

Update : Added Solutions

Winner : Congratulations to Laxmeesha TV for getting the highest number [ 3 ] of correct solutions.


  1. Which Linux command would you use to replace all the occurrences of "Computer Science" in the file "subjects.list" with “CS”. Make sure you create a backup of the original file as well.
      • sed -i “.bkp” s/“Computer Science”/CS/g subjects.list

  2. What is the command to list all the hidden files of the present working directory ?
      • ls -la

  3. What is the command to list only the first two lines of subjects.list file ?
      • head -2 subjects.list

  4. Print the contents of subjects.list file in reverse order. [ Hint : Cats have tails ]
      • cat subjects.list | tail -r

  5. Which Bash command would you issue on a Linux machine to create a coredump of a running program. [ Hint : The flight was aborted due to bad weather ]
      • kill -6

1 comment:

  1. Here are the answers I think of..........

    Ans 1: sed s/Computer Science/CS/g subjects.list
    Ans 2: ls -la
    Ans 3: head -2 subjects.list
    Ans 4: tail -`wc -l subjects.list | cut -d ' ' -f 1` subjects.list | tac
    Ans 5: ulimit -c unlimited

    -Laxmeesh

    ReplyDelete