Common command line

Posted 04/07/2020 | Views 258
Common command line

Mac - Linux 

Find and kill a process
kill $(ps aux | grep '[p]ython' | awk '{print $2}')

Details on its workings are as follows:

  • The ps gives you the list of all the processes.
  • The grep filters that based on your search string, [p] is a trick to stop you picking up the actual grep process itself.
  • The awk just gives you the second field of each line, which is the PID.
  • The $(x) construct means to execute x then take its output and put it on the command line. The output of that ps pipeline inside that construct above is the list of process IDs so you end up with a command like kill 1234 1122 7654.

Source: Stackoverflow


Find and kill fail package of Maven 

find ~/.m2 -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;

List all running process

ps -ef

Kill process on port 

lsof -i :8080
kill -9 <PID>


lsof -ti :8080 | xargs kill

Run jar file 

java -jar <file.jar>


Extract war file 

jar -xvf <file.war>

Clean and update Eclipse configuration for project 

mvn eclipse:clean
mvn eclipse:eclipse

Post Comments

Bài viết xem nhiều
4 more random CSS3 progress bars Make some CSS3 progress bars (3 Part Series) 1)...
Views 279 | Posted 04/07/2020
Build an amazing Job Search App using React In this article, we will build a beautiful Job...
Views 268 | Posted 04/07/2020
Common command line
Common command line Mac - Linux Find and kill a process   kill $(ps...
Views 258 | Posted 04/07/2020
Do you have a "uses" page? We all are particular about the software and...
Views 251 | Posted 04/07/2020
15 Python PROJECT IDEAS: BEGINNER TO EXPERT [WITH FREE TUTORIAL] Python is an amazing programming language to...
Views 246 | Posted 04/07/2020