Linux--date commands, directory-related commands

Source: Internet
Author: User
Tags parent directory set time what date

One, date order1. Date command

Command format:

date [OPTION] ... [+format] # Displays the current system time;

Show time format (date ' +%y,%m,%d,%h,%m,%s '):

format Formats meaning
%y,%y Years
%m Month
%d Day
%H When
%M Score of
%s Seconds

%u Weeks

date [MMDDHHMM[[CC]YY][.SS]] # Set system time

    • MM: Monthly
    • DD: what date
    • HH: Hours
    • MM: Minutes
    • YY: two-digit year
    • CCYY: four-bit year
    • . SS: Seconds

Two types of clocks for Linux:

    • System clock: The timing of the CPU's operating frequency by the Linux kernel;
    • Hardware clock: hwclock: Display hardware clock

Options:

    • -S,--hctosys # Set system time from hardware clock
    • -W,--SYSTOHC # Set hardware clock from current system time
1 Exercise: Date command2 3 What is the day of the week? 4 #Date ' +%u '5 6 set the current system time? 7 #Date 111213142015.168Set time: November 12, 2015 Thursday 13:14:16CST9 TenShow today's date, shaped like: 08/15/15?  One #Date ' +%d ' A  -Displays the current time, shaped like: 16:01:21?  - #Date ' +%t '
View Code2. Cal Command

The Cal # command is used to view the current calendar,

Cal-y 2008 # View 2008 Year calendar

Ii. Directory-related commands

Main directory, home directory:

    • Root:/root
    • Normal User:/home/username
    • User's home directory: ~
a.cd Command
Command meaning
Cd Switch to the current user's home directory (/home/user directory), when the user logs in, the default directory is the user's home directory.
CD ~ Switch to the current user's home directory (/home/user directory)
Cd. Switch to current directory
Cd.. Switch to Parent directory
CD- Access to the directory where you last came
b.pwd Command

Displays the current directory.

c.ls Command

Command format:ls [OPTION] ... [FILE] ...

Options:

    • -A,--all: Displays all files, including hidden files;
    • -L: Displaying file details in a list
    • -H: Display file size in a humane way with-l
    • -D: Displays the relevant properties of the directory itself, usually with-l;
    • -R,--reverse: Reverse Display
    • -R,--recursive: recursive display
    • -ll <==>-alh

The meaning of the information in the picture:

d.cat Command

Print the contents of a file to the screen

Command format:cat [OPTION] ... [FILE] ...

Options:

    • -E: Display line terminator $
    • -N: Numbering each line displayed
e.file Command

View File types

Format:file/path/to/somewhere

third, System Management class command

1, Shutdown: Halt, Poweroff

2. Restart: reboot

    • -F: Force, do not call shutdown
    • -P: Power off

Shutdown

Instruction format:shutdown [OPTION] ... Time [MESSAGE]

Options:

    • -r:reboot
    • -h:halt
    • -c:cancel

Set Time:

    • Now: Immediately
    • +m: The relative time representation, since how long after the order was submitted; for example +3;
    • HH:MM: Absolute time, indicating the specific time;

3. User login Information View command:

    • WHOAMI: Displays the current login valid user;
    • Who: All current logon sessions of the system;
    • W: all current login sessions and the operation of the system;

Linux--date commands, directory-related commands

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.