Showing posts with label solaris. Show all posts
Showing posts with label solaris. Show all posts

Wednesday, 18 May 2011

How to Find and Stop a Stuck Process in Solaris

Sometimes an application in Solaris gets stuck when it does not exit properly. For example, you exit a GUI application in Solaris. When you try to start the application, nothing happens. The application was just working. What the heck?



Typically this is a symptom of an application that did not exit properly and is still running. So how do I find the application and stop it? Here's how.



(1) To look at all the running processes on Solaris use this command:

ps -ef



This gives you a big list of all running applications. However, we can make things a lot easier. Let us say firefox did not exit cleanly.



So to search just for firefox processes, use grep. For example:

ps -ef | grep firefox



This will show all the running firefox processes. Note the process number for each process. For example, process 5555 is stuck.



To stop it, use the kill command:

kill -9 5555



Repeat the kill command as necessary if there are other stuck processes.



To make sure the stuck process has been removed use ps with grep again.

ps -ef | grep firefox



There should only be a listing for your grep command line.



That's it.

Tuesday, 23 February 2010

Unix: Add a User Account in Solaris

Since it seems like I have to set up a new Solaris VM every year or two, adding a new user is a part of the process. So instead of having to look this up again, I thought I would write down the steps this time.



  1. Log into Solaris as root

  2. Type the following command to add a user:



    useradd -d /export/home/username -m -s /usr/bin/bash -c "User Full Name" username

  3. The -d option specifies where to create the users directory. The -m option actually creates the directory if it does not exist. The -s option sets your default command line shell. -c sets the users full name. The new username is the last option on the command line. This sets up the account, but does not set the password.

  4. To set the password type: passwd username

  5. When prompted enter the new password twice.

That's it. You should have a new user account all set up. Log out as root and you can log into your new account.