Unix commands

Network Check listening ports: netstat -plnt Sniff the network on a port or ip-address: tcpdump port <portnr> tcpdump src/dst <ip-addr> Check the network performance: iftop (-n) (network perfomance) iftop -bNP -i eth0 ifstat System activity Check all processes from a user and press c for the full path names: top -u <username> Memory: vmstat cat … Continue reading “Unix commands”

Network

Check listening ports:

netstat -plnt

Sniff the network on a port or ip-address:

tcpdump port <portnr>
tcpdump src/dst <ip-addr>

Check the network performance:

iftop (-n) (network perfomance)
iftop -bNP -i eth0
ifstat

System activity

Check all processes from a user and press c for the full path names:

top -u <username>

Memory:

vmstat
cat /proc/meminfo

Hard disks:

iostat

Processors:

lscpu
cat /proc/cpuinfo

User activity

Logged on users:

w

Last logged on users:

last

I/O Performance

Check what drive you want to monitor:

lsblk

Once the drive is know you can start the monitoring, for this you can use iotop or iostat:

iostat -dxm 5 <device>
iostat -dxm 5 | grep <device>

These commands will provide extensive information for a specific device. The refresh will be done every 5 seconds, you can increase or decrease this number.

Processes

Check the running processes:

ps -ef

This command will show a list of information about every process currently running.

VI

Command Result
i Insert text
r Replace character
x Remove character
dd Remove line
yy Copy line
p Paste line
V Virtual select text
G Go to end of file
H Go to start of file
ZZ Save file and exit
dw Remove a word
c<number>w Remove the following x words
:q! Do not save file and exit
:g/^#/d Remove all lines starting with a #
:s/<search>/<replace>/g Find/replace
:sort Sort the selected content
:%sort Sort all the lines alphabetically