1. How to find all the empty folders which are there in a filesystem?
# find /path -depth -empty -type d –print
# find /path -depth -empty -type d –print
Example:
[root@hostx ~]# find /etc -depth -empty -type d -print
/etc/skel/.mozilla/plugins
/etc/skel/.mozilla/extensions
/etc/opt
/etc/prelink.conf.d
/etc/logwatch/scripts
/etc/X11/sysconfig
/etc/rwtab.d
/etc/oddjob
/etc/jvm-commmon
/etc/racoon/certs
/etc/sasl2
/etc/subversion
/etc/dbus-1/session.d
/etc/gconf/gconf.xml.mandatory
/etc/dnsmasq.d
/etc/NetworkManager/VPN
/etc/NetworkManager/dispatcher.d
/etc/hal/fdi/preprobe
/etc/hal/fdi/information
.
.
[Output truncated]
.
[root@hostx ~]#
.
[root@hostx ~]#
[root@hostx ~]# cd /etc/sysconfig/pgsql
[root@hostx pgsql]# ls -la
total 16
drwxr-xr-x 2 root root 4096 Jan 12 2008 .
drwxr-xr-x 12 root root 4096 Jul 14 05:23 .. ß Nothing exists
[root@hostx pgsql]# cd /etc/pm/hooks
[root@hostx hooks]# ls -la
total 16
drwxr-xr-x 2 root root 4096 Jan 22 2009 . ß Nothing exists
drwxr-xr-x 5 root root 4096 Oct 12 2009 ..
[root@hostx hooks]#
How to search for hidden files which are there in a particular folder?
# find /path -type f -name ".*" -print
Example:
[root@hostx ~]# find /etc -type f -name ".*" -print
/etc/skel/.bash_profile
/etc/skel/.kde/Autostart/.directory
/etc/skel/.bash_logout
/etc/skel/.zshrc
/etc/skel/.bashrc
/etc/skel/.emacs
/etc/.pwd.lock
/etc/lvm/cache/.cache
/etc/news/.profile
[root@hostx ~]#
How to find empty files in a given folder ?
# find /path -type f -size 0 -print
Example:
# find /etc -type f -size 0 -print
/etc/wvdial.conf
/etc/cron.deny
/etc/security/opasswd
/etc/security/console.apps/xserver
/etc/motd
/etc/dumpdates
/etc/environment
/etc/.pwd.lock
/etc/lsb-release.d/core-3.0-noarch
/etc/lsb-release.d/core-3.0-amd64
How to search for hidden files which are there in a particular folder?
# find /path -type f -name ".*" -print
Example:
[root@hostx ~]# find /etc -type f -name ".*" -print
/etc/skel/.bash_profile
/etc/skel/.kde/Autostart/.directory
/etc/skel/.bash_logout
/etc/skel/.zshrc
/etc/skel/.bashrc
/etc/skel/.emacs
/etc/.pwd.lock
/etc/lvm/cache/.cache
/etc/news/.profile
[root@hostx ~]#
# find /path -type f -size 0 -print
Example:
# find /etc -type f -size 0 -print
/etc/wvdial.conf
/etc/cron.deny
/etc/security/opasswd
/etc/security/console.apps/xserver
/etc/motd
/etc/dumpdates
/etc/environment
/etc/.pwd.lock
/etc/lsb-release.d/core-3.0-noarch
/etc/lsb-release.d/core-3.0-amd64
find . -type f -name ".*" -maxdepth 1 -print
ReplyDelete