Common commands for Linux

Source: Internet
Author: User
Tags clear screen

PWD Displays the current location
CD Jump Directory
LS View content
Cd.. /Return to Parent directory
Ls-l View
Ls
Mans LS
Q return
. DMRC
Ls-all Show all files including hidden files
cd/home/user/Desktop/a/b Path entry
CD./switch to the current directory
cd ^
SU Super Tube
SU user switches back to normal user
Exit return User
WHOAMI View Current User
Who am I display users of the login system
# Super Tube Display symbol
$ normal User
inin3 switch to the command interface
ININ5 switch to the graphical interface
Which command view the executable file location of the instruction
mkdir Creating a single directory
Clear Clear Screen
1. View as Action directory location
> pwd

2. View the contents of the file in the (current) directory
> ls//list
> ls-l or ll//show file details
> Ls-al//all Show file details (including hidden files)
> ls-a//Show directory all file names (including hidden files)
> ls [-al] Directory//view file information for the specified directory

3. Switching of directories
> CD Catalog Name
> CD. or CD: ///Parent Directory switch
> CD. or CD.///switch to the current directory
> CD ~ or CD//switch directly to the user home directory

4. User Switching
> Su-or su-root//switch to root super admin
> su Normal user name//switch to normal user
> Exit//Return to original user

User Switching can result in overlay effects, so do not repeat the SU action (used with SU and exit pairs)
Jinnan--->root--->jinnan--->root--->jinnan

5. See who the current user is
> WhoAmI//Displays the user who is currently operating system
> Who am I//display user information for login system (not related to SU)

6. Graphical interface and command interface switch
># init 3//Switch to command interface
># init 5//Switch to graphical interface

7. View the executable file location for the instruction
> which directive

8. Direct output file contents to Terminal
> Cat Files

9. Clear the screen
> Clear

10. Directory Operations
① Creating directories Make Directory
> mkdir directory Name//create a single directory
> mkdir-p newdir1/newdir2/newdir3//Recursive creation of multilevel catalogs
> mkdir Dir1/dir2/newdir
> Mkdir-p dir1/newdir2/newdir3
The new directory has a level greater than or equal to 2, you need the-p parameter,
equals 1, no need.
> Mkdir/home/jinnan/shandong//"absolute path mode" for the relative root directory to create the Shandong directory

② Moving Directory Move
> MV Dir1 dir2//dir1 moved to the DIR2 directory
> MV Dir1/dir2 dir3//dir2 moved to the DIR3 directory
> MV Dir1/dir2 dir3/dir4//dir2 moved to the DIR4 directory
> Mv/home/jinnan/beijing/home/jinnan/shandong//absolute path mode: Beijing move to Shandong Directory
(The destination directory that you moved to is "existing")

③ Directory Change name operation
The second parameter of the MV instruction is the new name or the name change operation.
The name that exists is the move operation
MV is the "Move and change name" merge directive
> MV Dir1 newdir//dir1 move to the current directory and change the name to Newdir
> MV Dir1/dir2 dir3//dir2 move to dir3 directory and change name to original
> MV Dir1/dir2 dir3/newdir//dir2 move to the DIR3 directory and change the name to Newdir

④ copy (and change name) operation copy
-R Recursive Recursive
> Cp-r dir1 dir2//dir1 copied to Dir2, and renamed as original name
> cp-r dir1/dir2 dir3/newdir//dir2 Copy to Dir3, and change name to Newdir
> cp-r dir1/dir2 newdir//dir2 Copy to current directory and change name to Newdir

> CP Dir1/filea dir2//filea copied to Dir2 and renamed as original name
> CP dir1/filea dir2/dir3/newfile//filea Copy to Dir3, and change name to NewFile

⑤ Delete operation remove
-F Force Mandatory
> RM File//delete file files
> rm-r dir//delete directory
> RM-RF filename//recursive forced Delete file (directory)

> RM-RF///recursive forced delete "/slash" root directory

Common commands for Linux

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.