Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
I need a script that will tell me the day of the week for a file's modified date.
I have 2 lines of code, one that will tell me the day of the week for a specified date. The other will give me the file's last date modified.
date +%A --date='Jul 9'
ls -lart file.txt | cut -d" " -f6,7,8
What I need is the 2nd statements output to go into the --date= param of the first statement.
I found that you are supposed to use the `` marks to encapsulate a command to use its results as a parameter but when I do so I get errors. The errors seem to be coming from the " " (the deliminator for CUT).
with −l, show times using style STYLE: full−iso, long−iso, iso, locale, +FORMAT. FORMAT is
interpreted like ‘date’; if FORMAT is FORMAT1<newline>FORMAT2, FORMAT1 applies to
non−recent ﬁles and FORMAT2 to recent ﬁles; if STYLE is preﬁxed with ‘posix−’, STYLE takes
effect only outside the POSIX locale
Have you an alias for ls that is giving you this behaviour?
alias ls='ls --color=auto'
When I run those commands (the last two any way), I get:
date: invalid date `Jul'
When I modify the -f param of cut to be -f6,7,8 I get:
date: extra operand `8'
My ls -lart return the date as:
Jul 8 23:56
not like yours (2009-07-09 18:10)
The format in which ls displays dates is largely tied to
the locale you're using. You can get "sensible" date formats
by forcing them:
ls -l --time-style=long-iso
will yield the date display in Tredegars example (and basically
will on all machines I ever had my hands on - the concept of having
Month and Day for dates less than six months away and a different format
including the year for older ones is just mentally crippled and sick).