1.3-linux basic Commands

Source: Internet
Author: User
Tags what date

Basic command:

Date

Date [Options] ... [+ format]: Time display

%d

%F

%T

Date [MMDDHHMM[[CC]YY][.SS]]: Time setting

MM: Month

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 time

--s,hctosys

--w,systohc


Directory-related commands:

Current directory or working directory

Home directory: Home

Root:/root

Normal User:/home/username

~: User's home directory


Cd:

CD or CD ~: Back to the current user's home directory

CD ~username: Switch to the home directory of the specified user

CD-: Switch back and forth between the previous directory and the current directory


Related environment variables:

PWD: The current directory path is saved

OLDPWD: The directory path where the last time was saved


PWD: Show current directory


Ls:list

Displays a list of files under the specified path

ls [options] ... [File] ...

-A,--all: show all files, including hidden files

-L: Long format

Ls-l Install.log//See first character (file type)

-rw-r--r--1 root root 38502 October 05:50 Install.log

- Normal files (text files, binaries, compressed files, movies, pictures ...) )

D catalog file ( Blue )

b device file (block device) storage device hard disk, USB drive

C device file (character device) printer, terminal/dev/tty1

s socket file

P Pipeline file

L link file ( light blue )

9 bits in the back: access rights, Perm

1: Number of times a file has been hard linked

Left Root: Owner of File

Right root: Group of files

38502: Size of File

October 12 05:50: Last modified time of the file

Install.log: File name

-H,--human-readable: unit conversion

-D: Displays the relevant properties of the directory itself and is typically used with-l

-R,--Reverse: Reverse Display

-R: Recursive display


Stat/path/to/somefile: Gets the metadata for the specified file


File View command: CAT,TAC

Cat [OPTION] ... [FILE] ...

-E: Display line terminator $

-N: Numbering each line displayed

File type view commands:

File/path/to/somewhere

Echoing command: Echo

-N: Prevent automatic addition of newline symbols

-e: Allow escape characters to be used

\ n: Line break

\ t: Tab

echo "$VAR _name": Variables are replaced, double quotes indicate weak references

Echo ' $VAR _name ': variable does not replace, strong reference


Which: Displays the program file path for the command

which [options] COMMAND

--skip-alias: Prohibit alias use


Whatis

Use the Mkwhatis command to create a database of all help manuals and their corresponding keywords on the current system


1.3-linux basic Commands

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.