Finding information in Linux

Linux Commands To Find Information

Linux is very flexible and people do all kinds of things with Linux so that it can be utilized in a best way possible depending on the environment. Linux allows some awesome command line tools and the list is huge but few recent ones I used, I’d like to share here for future reference and I might keep adding to this list as I encounter more.

grep – This basically allows you to find files and even lets you search text with in files. It is a pretty powerful command and gets used a lot especially by Linux Admins. I recently had a need where I needed to verify some information from a whole bunch of files in a directory and confirm if a specific IP Address is in any of the files. Opening each file and trying to find it was not an option. That is where grep saved the day.

grep -R “” /dir/next-dir/

This command basically allowed me to search for the IP Address in all files located in that directory. I was able to replace the IP Address with something else and searched for that as well. I’m sure it can be used in so many other ways depending on the situation and need.

netstat -an | grep PORTNUMBER | grep -i listen

This particular command basically allowed me to confirm if a specific port is open or not as I was trying to troubleshoot issues with connectivity to a particular system and firewall rules.

ip route get “ip-address”

This particular command allowed me to find out if there is a route available to a specific IP Address.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

WordPress SEO