Linux bash commands collections.

(611 hits) 16 Dec 2018 in Server Administration by Dario Mindoro


For all the tasks, projects that I am doing specially jumping from several programming languages I admit that I cannot remember all those commands when it come to Linux server so I took these notes below as my cheat sheet, I'll keep updating this page whenever I have something to add.

Software

To list the installed software type

rpm -qa | less
rpm -qa {software-name}
yum list | less
yum list {software-name}

To remove a software use rpm or yum command as follows

rpm -e {software-name}
yum remove {software-name}

System

reboot command

# /sbin/reboot

or

# /sbin/shutdown -r now    

Check OS version

cat /proc/version    

or

cat /etc/issue

Network

 check port used and who is listening

netstat -tnlp

Rerouting on linux iptables

iptables -A PREROUTING -t nat -p tcp -d 75.xx.xxx.xx --dport 80 -j REDIRECT --to-port 8064 

Disable firewall or iptables

# service iptables save
# service iptables stop
# chkconfig iptables off

Files

find file size in folders
du -hs * | sort -rh | head -5

Find Files by extension with size
find vhosts/ -name "*.log" -type f -printf "%s %p\n" | sort -nr | head -10

find vhosts. -name "*.log" -type f

Make file executable:

chmod +x file


Tagged in : Linux, Bash

avatar
Author :
Dario Mindoro

Author of Mindworksoft.com, Full-stack developer, interested in media streaming, automation, photography, AI, and digital electronics