Networking

Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.

Applications

Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.

Data

Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.

Monitoring

Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Commands & Shells

Executing commands with ‘find’

Submitted by on November 21, 2005 – 11:47 pm One Comment

To executes commands with ‘find’ use the ‘-exec’ option. Example:

find /var - type f -name "*.log" -mtime -2 -exec ls -als {} ;

English translation: Find files in /var that end with “.log” and have been modified in the past two days. Run “ls -als” on the found files.

Sample output of the above command on a Solaris 8 box:

hostname# find /var -type f -name "*.log" -mtime -2 -exec ls -als {} ;
1392 -rw-r--r--   1 root     other     700056 Nov 21 23:40 /var/log/magstar_atl.log
   4 -rw-rw-rw-   1 perf     perf        1335 Nov 21 00:15 /var/opt/perf/logs/sitedailyora_startup.log
  76 -rw-r--r--   1 root     other      38716 Nov 21 23:30 /var/yp/ypxfr.log
7328 -rw-r--r--   1 root     other    3742300 Nov 21 11:47 /var/VRTSvcs/log/engine_A.log

Instead of “ls -als” in the above example you can substitute any command or a script name.

Print Friendly, PDF & Email

One Comment »

  • Elijah luv says:

    I use web page http://my.naukri.com/manager/createacc2.php?othersrcp=11499&wExp=N And I use jquery console. On the jquery console I execute the two commands mentioned below. The commands selects user “city” location in the html form. The command works successfully alternate times – that is commands execute and select the city correctly when run first time, but fail next time, and succeed next time and so on. Why?

    The commands are (to be run one after another and in batch mode):

    $(‘#inpcityContainerDD’).click()
    $(‘#cityContainerDD a[rel=06]’).click()

Leave a Reply

%d bloggers like this: