This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Thursday, September 21, 2017

Very Basic Linux interview Questions and Answers - Linvirtshell

1. Command to list the files in a directory?

ls - list directory contents
ls -l (-l use a long listing format)

2. Command to list all the files in a directory, including the hidden files?


ls -a (-a, do not hide entries starting with .)

3. Command to find out all processes that are currently running?


 ps -f (-f does full-format listing.)

4. Command to find out the processes that are currently running or a particular user?


ps -au Myname (-u by effective user ID (supports names)) (a - all users)

5. Command to kill a particular process?


kill -9 23456 (process_id 23456) or kill -9 %8765 (job number 8765)
kill -9 -1 (Kill all processes you can kill.)
killall - kill processes by name most (useful - killall java)


6. Commands to view the contents of the file?


less filename
cat filename
more filename   
tail filename       -  can see the end of the file.
head filename    - can see the head of the file
vi filename
vim filename


7. Commands to use edit contents of the file?


vi  filename
vim  filename
nano filename
view  filename
visudo — edit the sudoers file


8. Command to view contents of a large log file?


tailf /var/log/messages ( last 10 rows)
less filename
head /var/log/messages  (first 10 rows)

9. How do you log in to a remote Unix box?


ssh  remote_server — OpenSSH SSH client (remote login program)


10.How do you get help on a UNIX terminal?


man command_name
info command_name (more information)

11.Command to list contents of a directory including all of its

subdirectories, providing full details and sorted by modification time?
ls -acl  filename
-a    all entries
-c    by time
-l     use a long listing format

12.How do you create a symbolic link to a file (give some reasons of doing so)?


ln - make links between files

Links create pointers to the actual files, without duplicating the contents of
the files. That is, a link is a way of providing another name to the same file.
There are two types of links to a file.

a.Hard link
b.Symbolic (or soft) link

13. What is a filesystem?


Sum of all directories called file system.
A file system is the primary means of file storage in UNIX.
File systems are made of inodes and superblocks.

14. Command to get file system usage?


df - report file system disk space usage.

15. How do you check the sizes of all users home directories (one command)?


du -sh /home/

du command summarize disk usage of each FILE, recursively for directories.

No comments:

Post a Comment