The Linux foundation of Cloud Computing

Source: Internet
Author: User
Tags diff time zones local time rfc uuid

File Management Commands

Ls-l

The first column is the file type

-: Normal file

C: Character file

L: Link

P: Pipeline File

B: Block device

Ls-m

Comma separated

[Email protected] ~]# ls-m/var/

ADM, cache, crash, db, empty, games, Gopher, Kerberos, LIB, local, lock, log, mail, NIS, opt, preserve, run, spool,

TMP, VAR, YP

LS--time=atime

Access time

--time=ctime

Modification time

--full-time

Detailed Access time

[[email protected] ~]# ls--full-time

Total 16

-RW-------. 1 root root 1163 2017-10-23 22:53:42.398974266 +0800 anaconda-ks.cfg

-rw-r--r--. 1 root root 2017-09-09 12:34:08.001916663 +0800 a.txt

-rw-r--r--. 1 root root 2017-09-09 12:34:27.883915853 +0800 b.txt

Drwxr-xr-x. 2 root root 4096 2017-10-23 23:05:44.724975372 +0800 initial_repo_backup

[Email protected] ~]#

-R

List all subdirectory tiers at the same time

-H

Output the list file size in human format

--sort time

Sort by Time

--sort size

Sort by size

RmDir

Delete Empty Directory

Rmdir-p

Delete a multilevel empty directory


Additions and deletions except users

Useradd User Name


passwd User Name

Add Password to User


Userdel User Name

Delete User

-R Delete Home directory


Date

-R,--rfc-2822

Output date and time in RFC 2822 format. Example:mon, 2006 12:34:56-0600

-U

UTC (Universal time coordinated)

Same as the GMT meaning

CST is our own standard time.

Date [+format]

[Email protected] ~]# date +%c

Mon-Oct 05:37:33 PM EDT

[Email protected] ~]#


%s calculates the current elapsed time, starting January 1, 1970 0:0

%j show the day of the year%M minutes (00-59)

[Email protected] ~]# date +%d

10/24/17

[Email protected] ~]# date +%a

Tuesday

[Email protected] ~]# date +%h

14

[Email protected] ~]# date +%h%d

1410/24/17

[Email protected] ~]#


Example: 1. View August 15, 1945 is the day of the week (the current time is 2017-10-24)

[[email protected] ~]# date-d " -72 year-2 month-9 Days"

Wed 15:01:16 CST 1945

[Email protected] ~]#

2. View August 15, 2045 is the day of the week (the current time is 2017-10-24)

[[email protected] ~]# date-d "+28 years-2 months-9 Days"

Tue 15:30:11 CST 2045

[Email protected] ~]#


Hwclock Hardware Clock

Hwclock-w SYSTOHC

Hwclock-s Hctosys


Tzselect Time zone selection

[Email protected] ~]# Tzselect

Please identify a, so, time zone rules can be set correctly.

Please select a continent or ocean.

1) Africa

2) Americas

3) Antarctica

4) Arctic Ocean

5) Asia

6) Atlantic Ocean

7) Australia

8) Europe

9) Indian Ocean

Pacific Ocean

One) None-i want to specify the time zone using the Posix TZ format.

#?


Timedatectl Show The time

[Email protected] ~]# Timedatectl

Local time:tue 2017-10-24 15:36:43 CST

Universal time:tue 2017-10-24 07:36:43 UTC

RTC Time:tue 2017-10-24 07:36:43

TIMEZONE:N/A (CST, +0800)

NTP enabled:n/a

NTP Synchronized:no

RTC in local Tz:no

DST active:n/a

[Email protected] ~]#

Display the time zones supported by the system

[Email protected] ~]# Timedatectl List-timezones | More

Africa/abidjan

Africa/accra

Africa/addis_ababa

Africa/algiers

........

Set the current time zone

[Email protected] ~]# Timedatectl set-timezone Asia/shanghai

[Email protected] ~]#

Set Current system time

[[email protected] ~]# timedatectl set-time "2017-9-9 12:00:00"

[[Email protected] ~]# Date

Sat Sep 9 12:00:01 CST 2017

[Email protected] ~]#

Sets whether NTP time synchronization is turned on (provided the NTP server is turned on)

[[email protected] ~]# Timedatectl set-ntp True



Cat [Options] File name

-B Displays the number of rows when displaying the contents of a file

-N Display file contents including blank lines

-S merges multiple empty rows into one empty row output


More [options] file name

+ lines are displayed directly starting with the given number of rows

-S compresses multiple empty rows into a blank line

-p clear the screen and then display


Head [options] File

-N < rows > Displays the first specified line of the file

-C < bytes > Displays the contents of the first n bytes of a file

-Q does not output the contents of the file header

-V Output File header contents

[Email protected] ~]# head-10-v/etc/fstab

==>/etc/fstab <==


#

#/etc/fstab

# Created by Anaconda on Mon Oct 23 14:49:30 2017

#

# Accessible filesystems, by reference, is maintained under '/dev/disk '

# See mans Pages Fstab (5), Findfs (8), mount (8) and/or Blkid (8) for more info

#

UUID=DEBEB2CD-B005-4C53-87E9-8F78A4A33C00/EXT3 Defaults 1 1

Uuid=732a5dec-be83-4581-bba0-29395eed3552/boot XFS Defaults 0 0

[Email protected] ~]#


tail [options] File

-F Loop Read

-C < bytes > Displays the contents of the first n bytes of a file

-Q does not output the contents of the file header

-N < rows > Specify the number of rows displayed

-V Output File header contents


diff [Options] file1 file2

Display information:

A is required for additional

D is required to delete

C for need to modify

[Email protected] ~]# diff a.txt B.txt

4d3

< D

7c6

< This is what we want

---

> know that ' s tough

[email protected] ~]# cat A.txt

A

B

C

D

1

2

This is the what we want

[email protected] ~]# cat B.txt

A

B

C

1

2

You know that ' s tough

[Email protected] ~]#

MV [Options] source file destination Path

-I prompt if the destination has the same file name

-V Show Progress when moving files, move multiple files

Very useful when

-U when moving only when the source file is newer than the destination file

Before it moves.

-F Force Overwrite existing files

CP [Options] File name (original) destination file name (copy)

-r Copy the contents of the entire directory

The permission value of the directory is retained after-p copy finishes

-V Show Progress when copying files

-F at the time of copying, if you encounter the destination file name is duplicated, the original deleted

RM [Options] File name

-I need to manually confirm before deleting a file

-V Displays information when deleting files

-R Delete directory-F ignore prompt

Example: rm-v filename

Common options: RM-RF directory Name

ln [options] source file Link file

-F Delete A destination file that already exists

-I if I encounter a hint with duplicate name how to operate

-V Display Operation information

-S Soft link option


This article is from "Cloud computing" blog, declined reprint!

The Linux foundation of Cloud Computing

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.