Pages

Friday, November 1, 2013

Find Machine Name using an IP Address in Windows or Linux

Find Machine Name using an IP Address in Windows or Linux



C:\Users\Homer>nslookup 10.50.2.100
Server:  windc.ad.simpson.org
Address:  10.50.2.70
*** windc.ad.simpospn.org can't find 10.50.2.100: Non-existent domain

C:\Users\Homer>nbtstat -a 10.50.2.100
Local Area Connection:
Node IpAddress: [10.12.4.29] Scope Id: []
    Host not found.


MyLinux:/ # nslookup 10.50.2.100;
Server:         10.50.2.70
Address:        10.50.2.70#53
** server can't find 175.2.50.10.in-addr.arpa.: NXDOMAIN


MyLinux:/ # smbclient -L 10.50.2.100
Enter root's password: 
Connection to 10.50.2.100 failed (Error NT_STATUS_CONNECTION_REFUSED)


MyLinux:/ # host 10.50.2.100
Host 175.2.50.10.in-addr.arpa. not found: 3(NXDOMAIN)

Find largest files

Type the following command at the shell prompt to find out top 10 largest file/directories:
# du -a /var | sort -n -r | head -n 10

If you want more human readable output try:
$ cd /path/to/some/where
$ du -hsx * | sort -rh | head -10

Where,
  • du command -h option : display sizes in human readable format (e.g., 1K, 234M, 2G).
  • du command -s option : show only a total for each argument (summary).
  • du command -x option : skip directories on different file systems.
  • sort command -r option : reverse the result of comparisons.
  • sort command -h option : compare human readable numbers. This is GNU sort specific option only.
  • head command -10 OR -n 10 option : show the first 10 lines.
The above command will only work of GNU/sort is installed. Other Unix like operating system should use the following version (see comments below):
 
for i in G M K; do du -ah | grep [0-9]$i | sort -nr -k 1; done | head -n 11
 

This is also a good one ... here this returns the top 40:
find  -type f -printf '%s %p\n'| sort -nr | head -40



also see: http://linuxcountry.blogspot.com/2013/05/find-and-sort-all-files-by-size-save.html