Linux Simple operation commands

Source: Internet
Author: User
Tags clear screen

1, understand the Linux directory structure, as well as the Linux important directory description?

  

001.bin:bianries Storing binary executable files

002.sbin:super User bianries Store binary executable file, only root user access

003.ETC: Storage System configuration file

004.usr:unix Shard resurces Storage System shared resources

005.home: Store User's Directory

006.root: Directory of super users

007.dev: Storing device files

008.lib:library the kernel module to be executed when the system program runs, similar to the System32 folder in window.

009.MNT: External Device

010.tmp: Important files can not be placed in this folder, after each restart will be emptied, storing temporary files.

011.var: To store some data of the user during the operation of the system, it is recommended that the disk space of this directory remain large. Log files for big data are stored in the Var directory.

2, master the file/directory commonly used commands

01. Naming conventions for files and directories:

001. File or directory name size not exceeding 255 bytes

002. Strictly case-insensitive, window is case insensitive

mkdir Test Create Test folder

mkdir Test Create Test folder

003. The name cannot appear special characters []% ^ & Space

    

02. Commonly used directives:

001.ls: Displays the contents of the current directory

0001.ls

0002.ls-l

0003.ls-la: Displays all files in a list, including hidden files

 

The file or directory is preceded by a hidden file.

0004.LS-LH: Displays all files as a list, containing the size

(1) d: Directory-: File L: Link (01. Soft Link/02. Hard link)

(2) The number of folders on behalf of the directory, which is itself a file

(3) Root: The owner of the current file

(4) Root: The group to which the owner belongs

(5) The size of the file or directory, in bytes

(6) When the file was created or last modified

(7) Name of the file or directory

002.PWD: Querying the current directory

003.clear: Clear Screen/ctrl+l

004.CD: Switch Directories

(1) cd/: Switch to the root directory

(2) cd~: Switch to the directory where the user information is stored

(3) CD file path

Note: The path to the 1.windows file: D:\ teaching materials \u3 reverse skew

2.linux the following path: cd/etc/ forward Oblique

3. Common operation commands for files and directories:

01.mkdir Creating folders

001.mkdir: Create a directory, for example, to create a Testb folder

      

002. If you need to create multi-level catalogs at the same time, you need to use-p (parents)

      

02.touch: Create File

001.touch: Create File

      

002. Create a my.sql file with touch

      

03.CP: Copy files/directories

001.CP (copy): Copying files

      

002.CP original File New file, time change of new file

      

003.cp-p Original File New file: This time is the original file time, now you need to copy multiple files to a specified folder to go?

004. Copying folders

Cp-r Original Folder new folder

04.MV: rename/move

001.move move: Is the cut below the window

002.MV files that need to be cut, target files

003. Renaming: MV old file name new file name

05.RM: Delete

001.rm (remove): Delete, the default RM can only delete files!

002. If you want to delete a folder, you must add the-r command!

003. If you do not need prompt information, directly use the RM-RF folder name, recursive forcibly deleted!

06.cat/more/less/head/tail: Viewing the contents of a file

001.cat:cat file name

002.more:more file name: Use the Enter line to view the +C exit using the CTRL key

003.less:less file name: Use the ↓ arrow line to view the exit using Q

004.head:head-n number of rows file name: Displays the first few lines of content in a file

005.tail:tail-n number of rows file name: Displays the following lines of the files

07.ln: Link (shortcut)

001. Hard connect: itself is a CP, is the same as the original file. If the original file is deleted, this will work as well.

002. Soft Link: itself is a reference to the original file, if the original file is damaged, then this reference is invalid.

    

08.man/help: View Help documentation

001.man command

002. Command--help

4. Summary and cases of common commands

01. Case:

A family:

There are four people in the family: Father, mother, son, daughter

Home bought a new house: There is a kitchen, toilet, sofa, room A (parents), Room B (son's), Room C (daughter's)

Son's room: bed, book

Daughter's Room: bed, book, toy

After a while, the son needs the same toys as his daughter's room.

The son needs to move the couch to his room.

After a while, the daughter's toys were tired and threw away

02. Case Action Command:

001. Create a family family

      

002. Create a home person

      

003. Create a letter House

      

     

004. Create a variety of rooms and furniture

  

005. Create your son's room items

      

echo "Little black Black" >book.txt will write small black black to Book.txt will overwrite the previous content

echo "Little black Black" >>book.txt will be spliced, will not cover

006. Create the items in your daughter's room

      

007. Copy the toys from your daughter's room to your son.

      

008. Move the couch to your son's room

009. Daughter Throwing Toys

      

5. Common other Operational commands

01.wc:word count! The number of words in the statistics text, number of lines, number of bytes

-M: Bytes-W: number of words-l: Lines

001.find: Query the specified file in the folder

Find directory (default is current directory)-name ' filename '

002.grep:

0001. Querying the specified content in the specified file

grep text Content file name

0002. After querying the command can increase the condition,-I: for ignoring case

        

02.free/df/du

001.free: Displays current memory and swap space usage

002.DF: Display the system's disk space usage

003.du: Displays the total disk space occupied by the specified file or folder

-H: Display units

-S: Displays the total disk space occupied by the current file or folder

-sh: Sub-command federated use

03.top/ps/kill

001.top: Displays the most resource-intensive processes in the current system

002.ps: Show the progress of the moment

-e: Show All Processes

-F: Displays all information for the current process

003.kill: End a process

Kill PID

kill-9 PID: Force Delete

04.ifconfig/ping

001.ifconfig: Querying the current network card

002.ping: Testing the connectivity of the network

6. Mastering the use of vim

01.vim Overview: is a kind of vi-like text editor, is a software. But no interface, only commands.

02.vim Mode of operation:

03. Insert Command

001. I: inserting before the cursor

002. I: Inserting at the top of the line where the cursor is located

003. A: Inserting after the cursor

004. A: Insert the last face of the line where the cursor is located

005. O: Insert the next line of the cursor

006. O: Insert on the previous line of the cursor

04. Positioning commands

001.: Set nu--> setting line number

Set the global line number:

① set Vim's

VIM/ETC/VIMRC-Open our VIMRC file and join: Set NU after: wq! in the last place Save exit

② Set VI's

VI/ETC/VIRC---> Open our Virc file, in the last location, add: Set Nu: wq! Save exit

002.: Set Nonu----> Cancel line number

003. GG: Arrive at the first position of a text

004. G: First place to reach the last line of text

005.: N: (: 4 for jump to the first position on line 4th)

05. Delete command

001. x: Delete the character where the cursor is located

002. NX: Delete n characters after cursor location

003. DD: Delete the line where the cursor is located! NDD (delete n rows)

004. DG: Removes all characters after the cursor position, for the entire text

005. D: Delete all characters after the cursor position, the bank

7. Mastering Compression and decompression

01.tar: Package/Unpacking

001. Common commands

①.-C: Creating a compressed file

②.-X: Unlocking a compressed file

③. Z: Whether to use gzip compression

④.-J: Whether to use BZIP2 compression

⑤. V: Whether to display compressed files

⑥. F: Whether to use file name (rename)

002. Use:

①. Tar-The compressed name (. tar.gz) of the sub-command requires a compressed file

②. Unpacking the package:

TAR-XVF need to unlock the filename-C need to store the location, if not write-C default is unpacked to the current directory

③. compressing files while packaging is using the gzip format, TAR-ZCVF files that need to be compressed after the file name is compressed

④. compressing files while packaging using the BZIP2 format

8.gzip: Compression/Decompression

01. The file name after compression/decompression must be GZ

02. Unzip

03. Common Commands:

001. D: Unzip

002. L: Shows the size of the compressed file, compression ratio

003.-V: Compression

004.-num: Use the specified number to adjust our compression speed!

The faster the speed, the lower the compression ratio, and the larger the resulting file.

The slower the speed, the higher the compression ratio, and the smaller the resulting file.

The default value is 6, and the value range 0~9

9.BZIP2: Compression/Decompression

01. The file name after compression/decompression must be bz2

The first is-Z compressed file-D decompression

02. Common Commands:

001.-C: Parameters generated during compression

002. D: Unzip

003. Z: Compression

      

Linux Simple operation 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.