Archive
Helpful Unix Commands
Below are the helpful Unix commands I learned when we handled SHINE project, where part of our QA task is to checkout/update the latest SVN codes, run maven and jetty in order for us to setup a local build and run our Selenium scripts.
1. ps aux – ps short for “process status” displays all the currently-running processes in the terminal
aux is an option where:
“a” lists all processes on a terminal, including those of other users,
“u” adds a column for the controlling user for each process, and
“x” lists all processes without controlling terminals
2. grep – searches files or string that matches the given expression
e.g.
grep “id=inputaddress” *.pl – searches all files with “.pl” extension and returns files with string “id=inputaddress”
3. pipe “|” – allows you to execute number of commands in sequence
e.g.
ps aux | grep jetty – displays all the currently-running processes in the terminal and filters the jetty process
output:
exist 7712 0.0 0.0 8952 876 pts/0 S+ 18:21 0:00 grep –color=auto jetty
4. kill – sends termination signal, which requests that the process exit.
In our project we frequently used the command “kill -9″ everytime our scripts hang and Google taught me that there are several ways to kill a task. Based on our output in item #3 let’s try to kill the jetty process with process ID 7712:
e.g.
-9 and -KILL are options to send SIGKILL, a signal sent to a process to cause it to terminate immediately
kill -9 7712
kill -KILL 7712
-15 and -TERM are options for SIGTERM, a signal sent to a process to request its termination. This signal can do useful cleanup operations (e.g. saving configuration information to a file) before quitting
kill -15 7712
kill -TERM 7712
5. dpkg -L {package} – List where files/package are installed
e.g.
dpkg -L maven2 – list where Maven is installed
Recent Comments