Linux / Unix: Find and Delete All Empty Directories & Files

How do I find out all empty files and directories on a Linux / Apple OS X / BSD / Unix-like operating systems and delete them in a single pass?

Find and delete all empty directories:

$ find /path/to/dir -empty -type d -delete

Find and delete all empty files:

find /path/to/dir -empty -type f -delete

Reference:
http://www.cyberciti.biz/faq/howto-find-delete-empty-directories-files-in-unix-linux/

 

Collecting Ubuntu Linux System Information

For new computer or Laptop or server, I need to collect the information about its hardware. This is also useful when you need to replace a disk or memory with a vendor. In order to replace hardware you need all information in advance.

Display the system’s host name:

$ hostname

Display the system’s DNS domain name:

$ dnshostname

 

Find the system serial number, manufacturer of the system and model name:

$ sudo dmidecode -s system-serial-number
$ sudo dmidecode -s system-manufacturer
$ sudo dmidecode -s system-product-name
$ sudo dmidecode | more

OR use the lshw command:

# lshw | more
$ sudo lshw -short

Display information about installed hardware

$ sudo lsdev

Find the system CPU info

$ cat /proc/cpuinfo

Find the system main memory (RAM) info. Show statistics about memory usage on the system including total installed and used RAM:

$ less /proc/meminfo

Find the Ubuntu Linux distribution version and related information:

$ lsb_release -a

Find the system kernel architecture (32 bit or 64 bit):

$ uname -m
$ getconf LONG_BIT
$ arch

Show all installed disks and size:

# fdisk -l | grep '^Disk /dev'

Display SCSI devices (or hosts) and their attributes on Linux:

$ lsscsi

Find the system PCI devices information:

$ lspci
$ lspci -vt
$ lspci | grep -i 'something'
$ lspci -vvvn| less

Find the system USB devices information:

$ lsusb
$ lsusb -vt

Find the system Wireless devices information:

$ iwconfig
$ watch -n 1 cat /proc/net/wireless
$ wavemon

Find the system audio devices information:

$ lspci | grep -i audio

Display the system drivers (modules):

$ sudo lsmod
$ sudo modinfo {driver_name}
$ sudo modinfo kvm

Display the list of running services:
### SYS V ###

$ sudo service --status-all

OR
## UPSTART ##

$ sudo initctl list

Find out if service is enabled:
## UPSTART ##

$ sudo initctl status service-name
$ sudo initctl status smbd

OR
## SYS V

$ sudo service serviceName status
$ sudo service nginx status