Monday, 12 December 2011

Interview Linux Question & Answers-PART 4

How to see the free memory in Linux?
/proc/meminfo   / free

How you will see a port is opened or not?
netstat –an |grep LISTEN   (or)  nmap ipaddress

What is Sticky bit ?
If the sticky bit is set for a directory, only the owner of the directory or the
owner of a file can delete or rename a file within that directory The sticky bit
is an access-right flag that can be assigned to files and directories on Unix systems.
The most common use of the sticky bit today is on directories, where, when set, items
inside the directory can be renamed or deleted only by the item's owner, the directory's
owner, or the superuser (Without the sticky bit set, a user with write and execute permissions
for the directory can rename or delete any file inside, regardless of the file's owner.)

What are the process states in Unix? 
As a process executes it changes state according to its circumstances. Unix processes have the following states:
Running : The process is either running or it is ready to run .
Waiting : The process is waiting for an event or for a resource.
Stopped : The process has been stopped, usually by receiving a signal.
Zombie : The process is dead but have not been removed from the process table.

How do you list currently running process? 

How do you stop a process?
kill pid

How do you find out about all running processes? 
ps -ag

How do you search for a string inside a given file? 
grep string filename

How do you search for a string inside a directory? 
grep string *

How do you search for a string in a directory with the subdirectories recursed? 
grep -r string *

How do you check the sizes of all users home directories (one command)?
a.    du -s
The du command summarizes disk usage by directory. It recurses through all subdirectories
and shows disk usage by each subdirectory with a final total at the end.

How do you check for the httpd.conf consistency and any errors in it? 
apachectl configtest

No comments:

Post a Comment