Linux Common commands

Source: Internet
Author: User
Tags parent directory file permissions

1. ls command: (list) List Directory contents

format ls [parameter] [file or directory]     -A displays all files, including hidden files, special files, and so on.     -l  Use a list of detailed formats,    abbreviated LL-H friendly display information ll-h file information header: D directory,-normal file, L link

2.CD Command: Switch directories

Cd.. /  //directory name, switch to the specified directory (absolute path) such as: cd/usr/~, equivalent toCD/-   , switch to the last accessed directory PWD Displays the absolute path of the current directory

3.mkdir command: Create a directory

Format mkdir folder name  
Example: mkdir Java (Create a subfolder named Java under the current folder)
-P Parent Directory does not exist when the parent directory is generated, such as: mkdir-p java2/javarmdir command: Delete empty directory, such as: RmDir java

4. File Browse command

cat [filename] Quick View Current file name, suitable for a small amount of information file more [file name] Paging display file content     operation: Enter down n lines, need to be defined. Default 1 line                space bar scroll down one screen                B return to the previous                screen -digital file name, quickly view the contents of the X-line after the file, such as: Tail-10 tomcat/logs/catalina.out

5.CP command: Copying files

CP [file to be copied] [path/-R [file to be copied] [path], copy folder

6.MV command: Move files

MV  [file to be moved] [path/-F [file to be moved] [path]  directly overwrite

7.rm command: Delete files

RM  FileName [ Path/-f [filename] [path]  -rf [file name] [path]  Delete directory such as: rm-rf/usr/-rf * Delete all contents of the current directory


8. Find commands



such as: Find/root-name ' java* '

9. Document editing commands

Vim [path/ filename]  into the general mode, you can file browsing, copying files. Insert mode: Enter the editable state, in the general mode, press A, I, o three one can be, press: to cut into the low-line mode. General mode: Insert mode press ESC Low line mode: Exit, save. : Q! Forced exit: Wq hold and exit

10. Piping commands and grep commands

-I [character to find] [file name  ]-| command 2| |

11. Compress and Unzip commands (important)

Linux Compression Pack: *.tar: Package, do not compress file size; *  . tar.gz: Package, and compress the file tar command parameters    : -z whether to use gzip compression (. gz)    -C Compressed file instructions     -x Extract compressed file instructions     -v Compress (unzip) the display file    during the process -F Specify the file name, after F to immediately answer the file name  commonly used compression parameter combination    ZCVF Common decompression parameter combination    zxvf-ZCVF [Compress package name. tar.gz] [content to compress]  
For example: Tar-
such as: TAR-ZXVF java.tar.gz-c/root, if not added-

12. System commands

PS Command: View process -e: View All Programs --ef|grep-i [process name] view processes associated with the process name, such as: Ps-ef|grep-i  -9 [PID]  forces the PID process to be killed

13. Other Commands

ifconfig View network configuration (IP) ping [IP] view connectivity to the target, constantly test the connection, press CTRL+C to stop reboot restart command halt shutdown command Setup network settings (firewall configuration, network configuration)
chmod Modify Permissions Modify file permissions syntax chmod [permissions settings] [file to change permissions] for example chmod u=rwx startup.sh Modify the permissions of the owning user to rwx (user) chmod g< /c4>=r-x startup.sh Modify the permissions of the owning group to RX (group) chmod o=r--startup.sh Modify the permissions of the owning group to r-- (other) chmod a =rwx startup.sh Modify permissions for all users to rwx (all) -R [permission settings] [file to change permissions] -R u=rwx tomcat/ Bin Modify the permissions of the owning user in the bin directory to rwx (user)

Linux Common 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.