Showing posts with label ps. Show all posts
Showing posts with label ps. Show all posts

Wednesday, September 26, 2012

Ninth session of Some of basic UNIX commands that are useful very frequently


Today we are going to discuss about one more important command in UNIX/LINUX based operating system that is used to kill processes that are running currently. It is some what like Task Manager in our windows based systems where task manager can be used to view/kill processes that are running currently instead this command is used only to kill processes.

kill -9 1234

Above command will kills process with process ID(PID) '1234'. You can get to know currently running process's PIDs by using 'ps' command that we discussed in our previous post. Below is sample output that a 'ps' command will show:



In above output, IDs that are present under heading 'PID' like '2660, 5796 and 4484'are PIDs similar to '1234' in out above kill example.

In our above example command '-9' that we used to kill process is signal that we are sending to kill process. There are several signals that we can send to kill process are below:




kill 4242

Above command will kill PID 4242 and exit gracefully.

kill -s SIGKILL 1414
kill -s KILL 1414
kill -s 9 1414
kill -SIGKILL 1414
kill -KILL 1414


All above commands are similar equal to above explained first example's -9 SIGKIL (i.e. forcefully kill 1414 process).

Please feel free to post your valuable comments. We will discuss about some more commands in our next posts.


Tuesday, September 25, 2012

Eighth session of Some of basic UNIX commands that are useful very frequently


Today we will discuss about some more useful commands in UNIX/LINUX based operating system.

If you want to see quickly what is the content of a file, then you can use below command to see the content of file in the same terminal you are working currently.

cat filename

Above command will display content of file named 'filename' present in current working directory in the terminal.

cat filename > /x/y.txt

Above command will copies content of file named 'filename' present in current working directory into file named 'y.txt' present in path '/x'.

cat filename1 filename2 > /x/y.txt

Above command will concatenate content of files named 'filename1'and 'filename2' present in current working directory into file named 'y.txt' present in path '/x'.

cat filename1 filename2

Above command will concatenate content of files and displays in the terminal. It doesn't modify original files instead it display both files content into terminal by concatenating.

One more important command that we are going to discuss today is 'ps'.

ps

Above command will display current processes which are running. This command is some what like a 'Task Manager' in windows where as the difference is in task manager we can kill process which we don't want to run but, here we can know process IDs by which we can delete the process using 'kill' command that we can discuss in our next post. This command will display lot of information about processes that are currently running.

ps -u

Above command will display current processes that are running in current log-in.

Please feel free to post your comments/queries. We can discuss some more useful UNIX/LINUX commands in our next post.