Quantcast
Channel: Learning Linux Commands: sed
Viewing all articles
Browse latest Browse all 14

Linux command line basics for beginners: Part 2

$
0
0

Hello, and welcome to part two of our Linux command line series. You will learn some more interesting tips that you can use to master your system, so hold on to your seats, because here we go.

The tasks, part two

Setting date and time

I must confess, this was a task that I had to do a long time ago in front of a terminal and had no idea how to do it. That is because I was used to the Gnome way of doing that but at the time I had no Gnome. So what to do?

man date

, of course. Depending on the country you live in, the date format differs from other parts of the world. In the United States, the date/time format is of the form mm/dd/yy or mm/dd/yyyy, where m is month, d is day and y is year, either in two-digit format (e.g. 86 for 1986). Where I'm getting at is the fact that the way that you set your date with the date command may differ from the format you're used to (or what is used in your country). This paragraph will not be a manual page replacement, but it will help you set your system's date/time quickly, provided you have root privileges. If you simply type

date

with no other arguments/flags, it will show you the current date. To set the date, you should type something like

date [MMDDhhmm[[CC]YY][.ss]]

M is month, D is day, h is hour, m is minute, C is century (the first two digits of year, like 20 for 2012), Y is year and s stands for seconds. Therefore to set your date for example to "Fri Jul 6 13:45:50 2012" you would do:

# date 070613452012.50

Viewing all articles
Browse latest Browse all 14

Trending Articles