Several common Linux commands and common Linux commands

Source: Internet
Author: User

Several common Linux commands and common Linux commands

Ls

Purpose: view files in the directory

Format: directly view the current directory by ls, or the ls parameter/directory name.

Parameter:-l View Details

-A: Show Hidden Files

. Indicates the current directory

.. Parent directory

-G: Mark different types of files with different colors (commonly used in mac OS, ubuntu default ls = ls-G)

Pwd

Purpose: view the path

Format: directly view the current path through pwd or the pwd directory name.

 

 

Cd

TIPS:

Cd or cd ~ Return to/home

Cd-Return to the last switched directory

Cd/return to the root directory

 

 

Date

View system time

Hwclock

View bios time

 

 

Shutdown command:

Shutdown

Format: shutdown Parameter

-R restart (-r + minutes) (-r now)

-H Shutdown (-h + min) (-h now)

-C command to cancel Shutdown

 

Init

Function: switches the system level.

Format: init 0-6

Init 0 is used to immediately switch the system running level to 0, that is, shutdown

Init 6 is used to immediately switch the system running level to 6, that is, restart

 

Reboot

Restart

 

Runlevel

View the current system running level

 

Switch to the graphic interface on the Character interface:

1. startx

Only the graphic interface is started, and the system running level is not switched

 

2. init 5

Switch system running level

 

 

! $ Last parameter of the previous command

Echo prints the value or string of a variable.

 

 

 

Create an empty file

 

Touch file name. Extension (no extension can be added)

 

 

 

Terminal screen clearing

 

Ctrl + L

 

 

 

 

 

Create an empty folder

 

Mkdir file name (make directory)

 

Mkdir-p/root/1/2/3/4/5 and the-p parameter can be used to directly create a path.

 

 

 

 

 

 

 

Copy a file

 

Cp

 

-R: copy the entire folder (the source folder will be created under the target directory)

 

Eg cp-r/etc // root/copy the entire etc to the root

 

-R./* Copy all files in the entire folder (the source folder is not created)

Eg cp-r/etc/*/root/copy all files under etc to the root

 

 

 

 

 

Delete

 

Rm-rf file or directory name

 

-R recursively Delete (delete all files in directories and directories)

 

-F force Delete

 

If the-r parameter is not added, the system will prompt that the directory cannot be deleted.

 

If the-f parameter is not added, you will be asked if you want to delete it.

 

 

 

 

Rename/move

 

Mv Source Target

 

 

 

View hard disk usage

 

Df-h

 

 

 

View the current mounting status

 

Mount

 

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.