Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4240688
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:11:57+00:00 2026-05-21T03:11:57+00:00

I need a linux bash script to know the time in seconds when a

  • 0

I need a linux bash script to know the time in seconds when a particular folder was modified.
Can someone please help me?

My current script below is getting the current time stamp and the last time the folder was modified, but i do not know how to proceed.

[root@cgf01 log]# more CheckLastCdr.sh 
#get current timestamp
current_time=`date` 

#get last CDR timestamp
last_cdr_time=`find /tmp/log/ -exec stat \{} --printf="%y\n" \; | sort -n -r | head -1`


echo $current_time
echo $last_cdr_time

when i run this script i am getting the following:

[root@cgf01 log]# ./CheckLastCdr.sh 
./CheckLastCdr.sh: line 6: 2011-04-05: command not found
Tue Apr 5 16:19:31 CEST 2011
2011-04-05 16:14:33.000000000 +0200

thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T03:11:58+00:00Added an answer on May 21, 2026 at 3:11 am

    If you want the number of seconds ago:

    echo $[$(date +%s)-$(stat --printf "%Y" /tmp/log)]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to know about Epoll On linux System. Could you recommend manual or
Does anyone know an elegant way to initiate a bash script (to run on
I need a tool/script to fetch network card configurations from multiple Linux machines, mostly
I have a Bash script that repeatedly copies files every 5 seconds. But this
How can I get the ip address of a server in linux? I need
I need to run a Linux CLI command and get its stdout output from
I need a software to manage configurations of linux servers in one central location.
I need to write a Red Hat Linux command line tool that launches a
We need to capture live video and display easily on Linux. We need a
I need to test a serial port application on Linux, however, my test machine

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.