Linux commands required by beginners and Cainiao

Source: Internet
Author: User
For a Linux newbie or Cainiao, using Linux commands to help execute tasks is a basic requirement. the following commands are the basic commands that every Linux newbie must master, let's start from here.

I. basic file directory operations
Ls command: indicates the meaning of List Directory Contents. Run it to list the contents in the folder.

Copy codeCode: $ ls # View files in the current directory
Conf lnmp_install.sh README vhost_ngx_pagespeed.sh
Init. sh ngx_pagespeed.sh source vhost. sh
$ Ls conf # View files in the conf Directory
The index.html nginx. conf pureftpd-mysql.conf tz. php
Init. d. nginx pure-ftpd.conf script. mysql
$ Ls-a # show all files (including hidden files starting with a dot ,)
. Conf lnmp_install.sh README vhost_ngx_pagespeed.sh
. Init. sh ngx_pagespeed.sh source vhost. sh
$ Ls-l # displays detailed information about a file in a long format. you can view the file permission, owner, and date.
Total 60
Drwxr-xr-x 2 root 4096 Jul 25 conf
-Rwxr-xr-x 1 root 5720 Jul 25 18:14 init. sh
-Rwxr-xr-x 1 root 21011 Jul 25 18:14 lnmp_install.sh
-Rwxr-xr-x 1 root 1983 Jul 25 18:14 ngx_pagespeed.sh
-Rw-r -- 1 root 392 Jul 25 18:14 README
Drwxr-xr-x 15 root 4096 Jul 27 13:58 source
-Rwxr-xr-x 1 root 4865 Jul 26 21:58 vhost_ngx_pagespeed.sh
-Rwxr-xr-x 1 root 3774 Jul 25 18:14 vhost. sh
Pwd command: print the current directory, that is, display the full path of the current working directory in the terminal.

Copy codeThe code is as follows: # pwd
/Root/lnmp

Cd command: switch the directory in the terminal

Copy codeThe code is as follows:
# Cd ../# enter the upper Directory
# Cd ../# go to the upper-level Directory
# Cd ~ # Enter the home directory of the current user
# Cd/root/lnmp/conf # enter the/root/lnmp/conf Directory
Mkdir command: create a new directory

Copy codeThe code is as follows:
$ Mkdir linuxeye # Create a linuxeye Directory
$ Mkdir-p backup/SQL # recursively create a directory (if the directory does not exist, create it)
Rm command: delete files or directories (please use it with caution)

Copy codeThe code is as follows:
$ Rm init. sh # Delete the init. sh file (the directory cannot be deleted without the-r parameter)
$ Rm-r conf # recursively delete a file or directory (you can delete a folder. The system will ask you if you want to delete the folder. enter y to confirm the deletion and press Enter)
$ Rm-rf backup # delete files or directories recursively without asking (-f parameters are used with caution)
Mv command: move a file or folder

Copy codeThe code is as follows:
$ Mv linux linuxeye # Rename a linux file or directory to linuxeye
$ Mv vhost. sh conf/# Move vhost. sh to the conf Directory
Cp command: copy a file or directory

Copy codeThe code is as follows:
$ Cp linux linuxeye # Copy a linux file and name it linuxeye (if the linuxeye directory exists, copy the linux file to the linuxeye directory without changing the file name to linux)
$ Cp-r linuxeye/conf/# Copy the linuxeye Directory (including files) to the conf Directory
Wget: download files from the network

Copy codeThe code is as follows: $ wget cat & grep: View file content and powerful pipeline commands
[Code] $ cat vhost. sh | grep linuxeye # display vhost. sh to filter lines containing linuxeye characters

II. view and manage system resources
Df-h

Copy codeThe code is as follows:
Filesystem Size Used Avail Use % Mounted on
/Dev/xvda 24 GB 13G 9.9G 55%/
Tmpfs 501 M 108 K 501 M 1%/dev/shm
Top # dynamically View resources consumed by processes (cpu and memory)
Top-H # view the resource consumption of each thread
Free-m # View memory and swap usage. you can also view top
III. compression and decompression
Tar

Copy codeThe code is as follows:
$ Tar czf linuxeye.tar.gz./linuxeye # tar package compression
$ Tar xzf linuxeye.tar.gz # decompress
Zip & unzip # Adding The-q parameter does not display the compression process

Copy codeThe code is as follows:
$ Zip-r linuxeye.zip./linuxeye # zip compression
$ Unzip-q linuxeye.zip # quiet zip extraction
IV. MySQL database operations

Copy codeThe code is as follows:
# Mysqldump-uroot-pmysqlpwd -- opt -- database linuxeye> linuxeye. SQL
Root is the user name, mysqlpwd is the password, linuxeye database name, and eye. SQL backup SQL

# Mysql-uroot-p # enter MySQL management through the command line
Enter password:

Mysql> source linuxeye. SQL # import SQL, which is usually used for database recovery

As a result, the commands described above will allow new users to master basic application commands on Linux and upgrade from Cainiao to novice users by using these commands skillfully.

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.