Skip to content

Unix Command Cheatsheet

Daisho Komiyama edited this page Jan 22, 2023 · 5 revisions

List active ports

lsof -i -P -n | grep LISTEN

-i = internet files or sockets

Print processes on port 3000

lsof -i tcp:3000

-i = internet files or sockets

Kill a process running on a particular port (e.g., 8080)

kill -9 $(sudo lsof -t -i:8080)

Grep

grep -ir "console" .

-i = case insensitive
-r = search recursively)\

zgrep FILE

(search inside gzip file)

Find running node process

ps aux | grep node

(a = show processes for all users, u = display the process's user/owner, x = also show processes not attached to a terminal)

Clone this wiki locally