Commands:
last -10 :shows last 10 successful logins
lastb -5 :shows last 5 failed login attempts
df -h :disk
dd if=/dev/zeros of=/dev/sd? bs=1M :zero a disk
free :free memory
cp :copy
ls -l
rm file :delete file
shutdown -h now : -r for reboot
uname -a :show name, linux info etc
w :shows logged in users
pgrep firefox :gets the PID of process (firefox in this case)
kill PID :kills the process
top :also may want to install atop and htop
:To remove old linux kernels
dpkg --list | grep linux-image :shows installed images
sudo apt-get purge linux-image-x.x.x-xx-generic :removes it
:Updates might fail if run out of inodes
df -i :shows inode usage
:Likely that too many linux-headers exist, such as /usr/src/linux-headers-#.#.#-#
sudo rm -rf linux-headers-#.#.#-#
ifconfig
arp-scan --interface=wlan0 --localnet : or eth0
ssh username@ip.address {-l root}
scp username@ip.address:filename filename :vice versa
nslookup {ip address}
If server set up with openssh-server, it will get attacked, mostly from china.
To block brute-force attacks, install iptables-persistent, then use it to save rules:
iptables -A INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --set
iptables -A INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 -j DROP