UNIX-1.8 ps, netstat, kill, pidof, fuser, awk commands


Make sure to subscribe to my channel for more videos on UNIX, Perl and SQL.
facebook: facebook.com/fuzicast
twitter: @fuzicast
youtube: youtube.com/yuejdesigner85

ps -fu username – displays all processes started by user
ps -ef – display all processes running
ps -ef | grep ‘pname’ – look for specific process
netstat -t – see all tcp connections
netstat -an – see all network connections
netstat -c – netstat will execute every second
netstat -p – display processes that use these connections
kill pid – kills process by pid
kill -9 pid – force kill process by pid
& – execute process in background
free – show memory usage, alternatively use top
pidof command – shows process id for running process/command
fuser -vu dir – displays all processes that are using dir, along with owner id of processes
echo “hello world” | awk ‘{ print length($1) }’ – prints length of field
echo “hello world” | awk ‘{ print substr($1, 3) }’ – prints llo, substring function
echo “hello world” | awk ‘{sub(regex, replacement); print}’ – replace pattern on line and print
echo “HELLO world” | awk ‘{ print tolower($1) }’ – lower case field 1
echo “hello world” | awk ‘{ print toupper($1) }’ – upper case field 1

Advertisements