Linux basic commands

Source: Internet
Author: User
Tags parent directory

Linux Common Basic Command collation

1-CD Switching directories

The CD enters the user's home directory;
CD ~ Enter the user's home directory;
CD-Returns the directory where the directory was before it entered;
Cd.. Return to the parent directory (if the current directory is "/", then "/"; "..." after execution) The meaning of the parent directory);
Cd.. /.. Return to the top level two directory;
CD!$ Use the parameters of the previous command as CD parameters.

2-pwd shows the current working directory


3-ls View current Directory

In the Linux file system, all with dots (.) The starting filenames are hidden files (differentiate between ls-a and Ls-a)

-D: Do not display directory contents, but only display the directory name

-L--long: Display detailed properties of a file in long format

4-mkdir Creating a Directory

5-rmdir Delete Empty directories (only empty directories can be deleted)

6-RM Deleting a catalog file



7-touch Create an empty file (note the difference from mkdir)


8-stat Display details of the specified file, more detailed than LS

-C (More important)

9-nano

Usage: Nano [options] [[+ Row, column] filename] ...

^ The bracket character represents the CTRL key

Save the contents of a document

Ten cat-e-n-b Ctrl+d exit

Usage: cat [options] ... [File] ...

-B,--number-nonblank number of non-null output lines

-S,--squeeze-blank do not output multiple lines of blank lines, merge whitespace behavior line

-E,--show-ends displays "$" at the end of each line

-N,--number of all lines for the output

Reverse output of one-to-one TAC cat

Usage: TAC [options] ... [File]:

The first 10 rows are displayed by default in head

Usage: head [options] ... [File] ...

-C,--bytes=[-]k printthe first K bytes of each file;

withthe leading '-', print all and the last

Kbytes of each file

-N,--lines=[-]k print the first K lines instead of Thefirst 10;

With the leading '-', print all and the last

Tail monitor changes in small files

Usage: tail [options] ... [File] ...

Print the last ten lines of each FILE to standard output.

With more than one FILE, precede each with a header giving the filename.

-F,--follow[={name|descriptor}]

Output appended data as the file grows; An absent option argument means ' descriptor ' use CTRL + C to exit

+ Less (page display)

    • Date Time

Hardware Clocks Hwclock Clock

-S

-K

--set--date

system clock Date (kernel emulation)

Synopsis

Date [OPTION] ... [+format]

Date [-u|--utc|--universal] [mmd‐

DHHMM[[CC]YY][.SS]] For example: Date "031211092017"

[[email protected] desktop]# date-s "2017/11/11 11:11:11"

[[email protected] desktop]# date-s "2017-11-11 11:11:11"

%F full date format, equivalent to%y-%m-%d

%d Date by month; equal to%m/%d/%y

%s number of seconds since UTC 1970-01-01 00:00:00 [email protected] desktop]# date +%s


Cal-y

    • Shutdown

Halt

Shutdown

Synopsis

shutdown [OPTIONS ...] [TIME]    [WALL ...] absolute time and relative time

-K do not halt, Power-off, reboot, Justwrite wall

Message.

-C Cancel a pending shutdown. This could be usedcancel

The effect of an invocation ofshutdown with a

Time argument that's not ' +0 ' or ' now '

    • Logoff (differs from Windows)

Exit:

Logout

Ctrl+d

    • Copy

cp

Usage: CP [options] ... Source file destination file (unit copy can be renamed)

OR: CP [options] ... Source file ... directory (multivariate replication)

OR: CP [options] ...-t directory source files ... (usually not used)

Copy source to DEST, or multiple source (s) todirectory.


Options [[email protected] desktop]# echo $?

- D :

- P : The ability to preserve the properties of a file while copying files and all

-r/r :

-A : Equivalent to a combination of options



mv

Usage: MV [options] ... [-t] source file destination file

Or: MV [options] ... Source file ... Directory

Or: MV [options] ...-t directory source files ...

Rename source to DEST, or move source (s) todirectory.







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.