date command

Recently, I switched from MS-Windows based web-server to CentOS Linux based Apache web-server. All user uploaded files are stored in /var/www/uploads/ directory. Is there command that can give me a list of files that have been added to the filesystem at /var/www/uploads/ in last 7 days on Linux/Unix-like oses?

{ 5 comments }

I need to create a log file using the following format:

myapp_monday.log
myapp_tuesday.log
….

myapp_sunday.log

How do I create log filename with day of the week in it under Linux or Unix operating systems?

{ 1 comment }

I‘m using the date +’%D_%T’ to store Unix system date and time in a shell variable called $_now:

_now=”$(date +’%D_%T’)”
echo $_now

Outputs:
01/20/12_16:10:42

I’d like to replace / and : with _. I’m aware of the following sed command:

sed ‘s/\//_/g
> s/:/_/g’ <<<"$_now"

Outputs:
01_20_12_16_14_09

How do I specify two pattern within the same sed command to replace | and : with _ so that I can get output as 01_20_12_16_10_42?

{ 4 comments }

I recently noticed that one of my UNIX servers was about 4 hours behind the correct time. I wanted to correct the date and time manually. How do I set date and/or time under UNIX operating systems using command line options?

{ 5 comments }

I want to increment the date under UNIX or Linux operating system while writing shell scripts. For example Apr/27/2011 should be incremented as Apr/28/2011 and so on. How do I increment a date in UNIX or Linux shell?

{ 3 comments }

How do I get the current date in Unix or Linux shell scripting and store it into a shell variable? How do I print the current date using Unix shell script?

{ 1 comment }

Linux: Bash Get Time

by on October 27, 2010 · 2 comments

How do I get the system time in BASH? How can I get the Linux system using bash shell?

{ 2 comments }