Showing posts with label LINUX. Show all posts
Showing posts with label LINUX. Show all posts

Friday, June 11, 2010

How to: UNIX List just directories or directory names

Display or list all directories

Type the following command:
$ ls -l | grep `^d'

You have current dir containing set of directories which contain files.
One file can reside in many directories.
Write script which returns number of unique file names in
all the subdirectories of a current dir.

ls -R | grep -v "^d" | sort -u

Display or list only files

Type the following command:
$ ls -l | grep -v `^d'

Tuesday, June 8, 2010

FEW LINUX COMMANDS RELATED TO PROCESS

For this purposeUse this CommandExamples*
To see currently running process ps$ ps
To stop any process by PID i.e. to kill processkill    {PID}$ kill  1012
To stop processes by name i.e. to kill processkillall   {Process-name}$ killall httpd
To get information about all running processps -ag$ ps -ag
To stop all process except your shellkill 0$ kill 0
For background processing (With &, use to put particular command and program in background)linux-command  &$ ls / -R | wc -l &
To display the owner of the processes along with the processes  ps aux$ ps aux
To see if a particular process is running or not. For this purpose you have to use ps command in combination with the grep command ps ax | grep  process-U-want-to see
For e.g. you want to see whether Apache web server process is running or not then give command$ ps ax | grep httpd
To see currently running processes and other information like memory and CPU usage with real time updates.top
See the output of top command.

$ top


Note 
that to exit from top command press q.
To display a tree of processespstree$ pstree

* To run some of this command you need to be root or equivalnt user.

Friday, May 14, 2010

MAKEFILES

Compiling your source code files can be tedious, specially when you want to include several source files and have to type the compiling command everytime you want to do it.
Well, I have news for you... Your days of command line compiling are (mostly) over, because YOU will learn how to write Makefiles.
Makefiles are special format files that together with the make utility will help you to automagically build and manage your projects.



Read this article on the below link->
http://mrbook.org/tutorials/make/