• Home
  • Shell
    • Emacs
    • Perl
    • screen
    • sed
  • Ubuntu
    • VNC
  • Web Development
    • Javascript
    • Joomla
    • MySQL
    • osTicket
  • Windows
    • Gimp

Posts tagged example

MAN PAGE> ‘date’ (8.4)

Jan30
2013
Written by Scott Rowley

Note that this man page is regarding date version ‘date (GNU coreutils) 8.4’, your mileage may vary when using other versions.

I’m going to expand this section to include examples of every entry from the man page. Note that some examples include additional commands to demonstrate the information we are working with.

NAME
date — print or set the system date and time

SYNOPSIS
date [OPTION]… [+FORMAT]
date [-u|–utc|–universal] [MMDDhhmm[[CC]YY][.ss]]

DESCRIPTION
Display the current time in the given FORMAT, or set the system date.

-d, –date=STRING
display time described by STRING, not ‘now’

date
Wed Jan 30 10:08:18 CST 2013
date -d "1 year ago"
Mon Jan 30 10:08:33 CST 2012

-f, –file=DATEFILE
like –date once for each line of DATEFILE

cat years.txt
1 year ago
2 years ago
3 years ago
date -f years.txt
Mon Jan 30 10:19:17 CST 2012
Sun Jan 30 10:19:17 CST 2011
Sat Jan 30 10:19:17 CST 2010

READ MORE »

Posted in BASH - Tagged BASH, cat, date, Format, man, man page, page, shell, time

AWK> Useful examples

May26
2011
Written by Scott Rowley

Just a starter page that will grow as I find useful awk commands to share.

Convert Linux .txt to Windows .txt
Replace the end of a line with a carriage. Useful for converting .txt files from Linux to Windows.

awk 'sub("$", "\r")' linuxfile.txt > windowsfile.txt

Convert Windows .txt to Linux .txt
And the reverse. Useful for converting .txt files from Windows to Linux.

awk '{ sub("\r$", ""); print }' windowsfile.txt> linuxfile.txt
Posted in BASH - Tagged awk, convert, linux, list, sub, txt, Windows

BASH> ‘find’ examples

Nov12
2010
Written by Scott Rowley

This will be a growing list as I find commands I need…

Find files of .ext that are 0 bytes and rm them.

find . -name "*.ext" -size 0 -exec rm {} \;
Posted in BASH - Tagged BASH, byte, find, rm, shell

Corrections? Questions? Comments?

Find an error?
Everything work out great for you?
Have some feedback?
Like to see something added to the article?

PLEASE leave us a comment after the article and let us know how we are doing, or if something needs corrected, improved or clarified.

Thank you!
- The Management

Advertisement

Sudo Bash
By Geeks - For Geeks

Back to Top