Tag Archives: list

Counting files in Linux is fairly easy by simply listing the files using ls and then using the wc application. Both the ls application and the wc application are core Linux applications and should be installed by default on your server. One thing that I had forgotten how to do was how to count all files in a specific directory as well as all files in each sub directories. The second method I will display below is not 100% accurate because it will count sub directories twice however it is likely you just need a round about method to get an idea of how many files and sub directories you are working with. Below I describe first how to count all files and directories within a single directory and second how to count all the files, sub directories, and files within the sub directories via a Linux shell or command prompt.

I was working on a presentation this morning and as I was writing I realized I did not have a quick fast way to make a list of all the internal Ips on a LAN (Local Area network). Many of the tools I use including nmap, nessus and nexpose will accept a list of ips so I decided to whip up a quick dirty shell script to get the job done. I may clean it up in the future but for now it does its job. This is meant to work on Backtrack 4 but in its current state it will work on any Debian based distro. As always with any code found on the internet you use this at your own risk. Also I am sure this can be done better but like I said it was a 10 minute fix.

Earlier today I was upgrading some packages on a CentOS Linux server and was curious what applications were actually installed with the coreutils RPM package. I knew that this was one of the main RPM packages that had a ton of various applications installed with it however I was not sure specifically which ones. Below are some examples of how to use RPM to find out exactly what is installed with a specific RPM package.

Typically the “which” command is installed by default though depending on what Linux distribution and what packages you decided to install there is a possibility the command is not installed. Installing which is easy on any distribution as the package is literally just called “which”. Below is a brief explanation of the error you could get if which is not installed and information on how to install the which package using the yum package manager on CentOS.