About Me

- A little contribution to the linux newbies.

Thursday, October 1, 2009

Linux Admin - command line Interview questions

following are some sample question that you can get during a Linux command line interview

Question : In this system there is following directory structure.
-> 1 x Dir (main directory) -> 10 x Sub-Dir -> 10 x files in each subdirectories
Find out which file in the directory was lastly modified.

Answer :
$ find -type f -mtime -1


Exp : this command will find the lastly modified(within last 24 hours) file in the directory structure

Question: How can you send email from command line ??

Answer:
$ "mail e-mail @domain.com"
Subject:
Type in the Body "the message " that you want to send

press a Dott (.) when you are done.

Cc: "Leave it blank "


you can also put some one on the Cc list too..


Question: How can you create exactly 1MB sized file from command line ?

Answer :

$ dd if=/dev/zero of=output.file bs=1024 count=1024


Question: How can you find the largest file in a directory structure ?

Answer :
$ find /home/ -printf "%s:%p\n"|sort -k1n|tail -1

This will get you the largest sized file from the directory structure.

Question: How can you check what shell are you currently using

Answer:
$ echo $SHELL

or

$ ps | grep `echo $$` | awk '{print $4}'

No comments:

Post a Comment