Unix commands : Top 10 frequently asked interview questions

In most of banks, the unix or linux is prefered application hosting platform, compare to the windows. It is always added advantage for candidate to be familiar with unix commands. These are basic unix commands which are sometime asked to candidate for checking his\her unix skills.  These questions are mainly related to log search, find commands and unix processes. These commands are very handy if we are investigating any issue in production\uat. As application developer we must have came across these unix commands. Mostly questions are not asked in depth and they just confirm your familiarity with unix commands. These are most frequently asked unix commands in interview.

1) How to find hidden files in current directory?

   $ ls -lrta

2) How to find current running processes in unix server?

  $ ps -ef

and if we want to find specific process we can use 'grep' with pipe
  $ ps -ef | grep -i 'application'

3) How to find process which is taking maximum memory in server?
  $ top
  top command tell us about cpu usage , process id and other details. below is output of top command

4) How to find Exception in log files available in current directory and how to find number of occurrence?
   $ grep 'Exception' log1.txt | wc -l

5) find all files in current and subdirectories which contains 'log' name?

   $ find . -name 'log'

6) How do you access command line arguments from within a shell script?

Arguments passed from the command line to a shell script can be accessed within the shell script by using a $ (dollar sign) immediately followed with the argument's numeric position on the command line.

7) How to tails last 200 lines of any log fine?
    $ tail -200f filename.txt

8) How to find remaining disk space in unix\linux server?

    $ df -kl

df -kl
Filesystem   1024-blocks      Used Available Capacity  iused    ifree %iused  Mounted on

/dev/disk0s2   244277768 153679844  90341924    63% 38483959 22585481   63%   /

9) How to make any script file executable?
    $chmod 755 *.sh

10) How to kill process in unix server?
    $ kill -9 #pid
these #pid can be found using ps -ef command.

BASIC Unix Command List
  • ls --- lists your files
    ls -l --- lists your files in 'long format', which contains lots of useful information, e.g. the exact size of the file, who owns the file and who has the right to look at it, and when it was last modified.
    ls -a --- lists all files, including the ones whose filenames begin in a dot, which you do not always want to see.
    There are many more options, for example to list files by size, by date, recursively etc.
  • more filename --- shows the first part of a file, just as much as will fit on one screen. Just hit the space bar to see more or q to quit. You can use /pattern to search for a pattern.
  • mv filename1 filename2 --- moves a file (i.e. gives it a different name, or moves it into a different directory (see below)
  • cp filename1 filename2 --- copies a file
  • rm filename --- removes a file. It is wise to use the option rm -i, which will ask you for confirmation before actually deleting anything. You can make this your default by making an alias in your .cshrc file.
  • diff filename1 filename2 --- compares files, and shows where they differ
  • wc filename --- tells you how many lines, words, and characters there are in a file
  • chmod options filename --- lets you change the read, write, and execute permissions on your files. The default is that only you can look at them and change them, but you may sometimes want to change these permissions. For example, chmod o+r filename will make the file readable for everyone, and chmod o-r filename will make it unreadable for others again. Note that for someone to be able to actually look at the file the directories it is in need to be at least executable. 
  • File Compression
    • gzip filename --- compresses files, so that they take up much less space. Usually text files compress to about half their original size, but it depends very much on the size of the file and the nature of the contents. There are other tools for this purpose, too (e.g. compress), but gzip usually gives the highest compression rate. Gzip produces files with the ending '.gz' appended to the original filename.
    • gunzip filename --- uncompresses files compressed by gzip.
    • gzcat filename --- lets you look at a gzipped file without actually having to gunzip it (same as gunzip -c). You can even print it directly, using gzcat filename | lpr
  • printing
    • lpr filename --- print. Use the -P option to specify the printer name if you want to use a printer other than your default printer. For example, if you want to print double-sided, use 'lpr -Pvalkyr-d', or if you're at CSLI, you may want to use 'lpr -Pcord115-d'. See 'help printers' for more information about printers and their locations.


Directories, like folders on a Macintosh, are used to group files together in a hierarchical structure.
  • mkdir dirname --- make a new directory
  • cd dirname --- change directory. You basically 'go' to another directory, and you will see the files in that directory when you do 'ls'. You always start out in your 'home directory', and you can get back there by typing 'cd' without arguments. 'cd ..' will get you one level up from your current position. You don't have to walk along step by step - you can make big leaps or avoid walking around by specifying pathnames.
  • pwd --- tells you where you currently are.

  • We are covering here -'Java garbage collection interview questions' or 'Java memory interview questions' in d...
  • Java util.collections is one of the most important package in java and the important of this package can be understand by...
  • Java Concurrency interview question - In year 2004 when technology gurus said innovation in Java is gone down and Sun Microsystems [Now Or...
  • 'Java investment bank interview' generally contains 'Java Design Pattern' questions. If you want to be a professional Java ...

    1. Nice questions..This might be useful questions to you ...164 Core Java Interview Questions.

      1. Tks very much for your post.

        Avoid surprises — interviews need preparation. Some questions come up time and time again — usually about you, your experience and the job itself. We've gathered together the most common questions so you can get your preparation off to a flying start.

        You also find all interview questions at link at the end of this post.

        Source: Download Ebook: Ultimate Guide To Job Interview Questions Answers:

        Best rgs

    2. Excellent all questions are very use full and important one Thank you.

    3. Tks very much for your post.

      Avoid surprises — interviews need preparation. Some questions come up time and time again — usually about you, your experience and the job itself. We've gathered together the most common questions so you can get your preparation off to a flying start.

      You also find all interview questions at link at the end of this post.

      Source: Download Ebook: Ultimate Guide To Job Interview Questions Answers:

      Best rgs

    4. Latest Govt Bank Jobs Recruitment Notification 2016

      Thanks for writing such a good article, I stumbled onto your website and read a few articles. I like your way of writing......................

    5. Most important command for developers. Every Developers must know these command


    6. Hi Nice Blog

      Before facing job interview we should prepare for it and best thing is that we should know type of question and frequently asked questions and after doing such small thing we can grab that job.

    7. This blog awesome and i learn a lot about programming from here.The best thing about this blog is that you doing from beginning to experts level.

      Love from

    8. You’ve written nice post, I am gonna bookmark this page, thanks for info. I actually appreciate your own position and I will be sure to come back here.
      minecraft 2 , minecraft , minecraft 2 download , minecraft 2 baixar

    9. Your website is wonderful, let alone the content material
      interview preparation online

    10. Thank you for such a sweet tutorial - all this time later, I've found it and love the end result. I appreciate the time you spent sharing your skills.
      Run 3

    11. I just see the post i am so happy the post of information's.So I have really enjoyed and reading your blogs for these posts.Any way I’ll be subscribing to your feed and I hope you post again soon.

      digital marketing course in chennai
      software testing training in chennai

    12. Given so much info in it, These type of articles keeps the users interest in the website, and keep on sharing more .
      java training in chennai

    13. This information is stunning. I really inspired with your post writing style & how continuously you describe this topic. After reading your post, I feel very happy about it and I love learning more about this topic. Please keep update like this excellent post.
      Engineering Colleges, ECE Engineering Colleges in Chennai

    14. nice post for sharing Java article. its really helpful for me. keep shring on updated tutorials????????????????

    15. The given information was very excellent & Great tips, and awesome way to get exert tips from everyone, not only i like that post all peoples like that post, because of all given information was wonderful and it's very helpful for me.
      Interior Decorators in Chennai
      Home Interior Designers in Chennai
      Home Interiors in Chennai

    16. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in IBM Endpoint Manager 9.2 Platform Fundamentals, kindly contact us http://www.maxmunus.com/contact
      MaxMunus Offer World Class Virtual Instructor led training on IBM Endpoint Manager 9.2 Platform Fundamentals. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
      For Demo Contact us.
      Nitesh Kumar
      E-mail: nitesh@maxmunus.com
      Skype id: nitesh_maxmunus
      Ph:(+91) 8553912023

    17. This comment has been removed by the author.

    18. Excellent and very cool idea and the subject at the top of magnificence and I am happy to this post..Interesting post! Thanks for writing it.What's wrong with this kind of post exactly? It follows your previous guideline for post length as well as clarity.
      Java Training in Chennai