Unix commands

Find Largest Directories in Linux

If you want to display the biggest directories in the current working directory, Some of you would like to display the above result in human readable format. i.e you might want to display the largest files in KB, MB, or GB. 1arrow-up-right

du -hs * | sort -rh | head -5

What is running on this port?

Using netstat Command

netstat (network statistics) command is used to display information concerning network connections, routing tables, interface stats and beyond.2arrow-up-right

netstat -ltnp | grep -w ':80'

Using lsof Command

lsof command (LiSt Open Files) is used to list all open files on a Linux system2arrow-up-right

lsof -i :80

Find a file

To find all files in current directory3arrow-up-right:

# find . -name "*.yaml"

and to delete all of those files 5arrow-up-right:

Find a directory

To find all directory from the current location 6arrow-up-right

and to delete this folders 7arrow-up-right:

Find a file that contains a string

find files from here that contain "text-to-find"4arrow-up-right

Last updated