Useful UNIX commands

Here are a few very useful UNIX commands that save my life from time to time 😉

Order files by size

> ls -lS

Will list the content of the current folder, ordering files by size from largest to smallest.

Find files larger than 1Gb

find ./ -size +1G -exec ls -l {} \;

This is particularly useful to find a log file that is not rotated. Some environments are broken when a file reaches 2Gb…

Block a remote IP address

iptables -A INPUT -p all -s $IP_ADDRESS -j DROP

Be careful not to block your own IP address, the only way to get out of this one would be to access the server from another IP address or get physical access to it.

1 thought on “Useful UNIX commands

Leave a Reply

Your email address will not be published. Required fields are marked *