Common commands for SSH logon tools

Source: Internet
Author: User

First, we need to know what shell is.
The main interface between the operating system and the external system is shell. It may be said in terms of terminology, such as cmd command line, which is a shell in the Windows operating system. The dreamhost shell here refers to the command line provided by dreamhost to help customers better use their VM services.
In dreamhost, shell instructions and operations are based on linuxord2.4.29, that is, the system used by dreamhost. If you are also a user of dreamhost, this article may be helpful to you.

Directory:
1. basicinstructions/basic
2. wget/download Tool
3. crontab/scheduled task
4. Tar/tar.gz/compressed file
5. view the file size

CD [directory name] conversion path
CD .. back to the parent directory
Ls displays all files in the current directory
Rm [-R]-f [] [file name] delete a file, and add [-R] to delete all the sub-files in the file, for example, Rm-RF [ABC] deletes the ABC folder and all files in the folder.
Tar-[decompress the downloaded package]
Unzip [file name] decompress the file
CP-RPF. A/* B: Copy all the files in the folder to its parent directory B.
Wget (the best command inLinuxYou can use this tool to quickly download the required files from the network)

1. basicinstructions basic operation commands
Generally, you can use "$ [instructions]-help" to get help from the following command [instructions], including its parameters.
Number list definition.

-Ls: list all contents in the current folder
$ LS-O: list all contents in the current folder, including details, but not groups.
$ LS-l same as above, including group information
$ LS-A lists all contents in the current folder, including files starting "."
$ LS-t sort by change time
$ LS-V by version

-CD [dir]: Enter the folder
CD .. exit the current folder and return to the parent directory
-PWD: displays the current path
-Mkdir [dir]: Create a folder
-Chmod: change file/folder Permissions
$ Chmod [mode] [dir], where the mode is like "755" or "777.
$ Chmod [mode]
$ Chmod-R [mode] [dir], recursively used to change permissions for all objects in the target folder
Mode has another expression, "755" is "-rwxr-XR-X", not listed.

-RM: delete files/folders
$ Rm-F force Delete, ignore non-existing files, no prompt
$ Rm-r recursively deletes all content
$ Rm-RF Delete folder
-CP copy
$ CP [Options] [Source] [destination]
[Options] can be-F (forced copy) or-R (recursive copy)
-Rename or move music videos
$ MV [Options] [Source] [destination]
[Options] commonly used:-F (force move/rename),-I (try before move/rename),-U (update)
For example
$ Mvwwwroot/cgi-bin. Move the/cgi-bin directory to the current directory.
Export mvcronfile.txtmyfile.txtrename cronfile.txtas myfile.txt
CP-RPF. A/* B: Copy all the files in the folder to its parent directory B.

2. wget download Tool
Wget is a non-interactive network file download tool. It can be used in Linux to quickly download files from the network.
The required file does not need to go through
Wget [parameter list] URL
The simplest usage:
$ Wgethttp: // targetdomain.com/file.tar
Common wget parameters:-T [nuberoftimes]: number of attempts. The number of attempts allowed when wget cannot establish a connection with the server. Ratio
For example, "-t120" indicates a 120 attempt. When this parameter is set to "0", it indicates that the attempt is infinite Multiple times until the connection is successful,
This setting is very useful. When the recipient's server is suddenly shut down or the network is suddenly interrupted, it can resume normal succession.
Download continued?
-C: resumable upload is also a very useful setting. If a large file is downloaded, when the connection is restored

Instead of starting from scratch, the remote server also supports resumable data transfer. Generally, Unix/Linux Web/FTP servers support
Resumable data transfer;-T [numberofseconds]: Specifies the timeout time. If the remote server does not respond, the connection is interrupted and the connection starts.
Next attempt. For example, "-t120" indicates that if the remote server does not send data after 120 seconds, it will try again.
. If the network speed is faster, you can set a shorter time. On the contrary, you can set a longer time, generally the most
A value of no more than 900 is usually not less than 60. Generally, about 120 is suitable.-W [numberofseconds]: the number of seconds to wait between two attempts, for example, "-w100" indicates two attempts.
Wait for 100 seconds.-Nd: No directory structure is downloaded. All files downloaded from all specified directories on the server are heap to the current directory.-X: the setting is the opposite to that of "-nd, create a complete directory structure,

For example, "wget-ndhttp: // www.gnu.org /",
The actual directory structure is created at the first level until all files are uploaded.-NH: do not create a directory with the target host domain name as the directory name, and directly go down to the directory structure of the target host.

current directory
;-R: recursive download. In this directory structure;-L [depth]: Download the depth of the remote server directory structure, for example, "-L5" downloads a directory whose depth is less than or equal to 5 and uses the directory structure or file in
-M: The option for site image creation, if you want to create a site image, use this option, it will automatically set
other appropriate options for site image;-NP: download only the contents of the specified directory and its sub-directories of the target site. This is also a very useful option. We may leave
A personal homepage with a link pointing to the personal homepage of another person on the website, however, we only want to download the personal homepage of the
person. If this option is not set, the entire website may be captured, this is obviously not expected by
.-http-user = username-http-passwd = password: if the web server needs to specify the user name and password, these two items are used for setting;-O writes data to a file.

3. crontab scheduled task execution
In the dreamhost system, you can use shell to create your own crontab. The usage is as follows:
Using a terminal that supports shell login (such as fterm or Putty), enter username@qiran.org: 22 in the address bar to SSH
Method to log on to the server.
Common crontab commands:
Crontab-l displays all existing cronjobs.
Crontab-r deletes the current cronjobs.
Crontab-E: edit the current "crontabfile". Nano is recommended for DH.
Note that your crontab contains all cronjobs, each cron row, and the end of the broken row. A normal cron is as follows:
Description:
452 ***/home/user/script. pl
The first number is the number of minutes per hour,
The second number is the hour of the day,
The third digit is the day of the month,
The fourth digit is the month of the year,
The fifth digit is the day of the week.
Example:
32 *: 32nd minutes per hour.
12, 42 *: indicates two times of 12th and 42nd minutes per hour.
*/15 */2 ***: 0: 00, 0: 15, 0: 30 ,...
43 18 ** 7: run the command line at every Sunday.

After using nano in dreamhost to edit the file, use Ctrl + O to save the file and CTRL + X to exit the editing.

4.tar command
The tar command is used as follows:
Tar [parameter list] [file name]
Parameter List:
-C generate a new backup and overwrite the old backup file
-X extract from the backup file
-T list the file directories in the backup file
-V: show all operationsCompositionParts list
-F generate a backup at a specified location
-U will not exist in the backup file, or add the modified file to the backup.

Example:
Tar CVF filename.tar/* Create backup */
Tar CVF tarfile.tar./filename/* upload the filenamefile to tarfile.tar */
Tar tvf filename.tar/* list the content of the TAR document */
Tar xvf filename.tar/* export files from the tar file */
Tar zxpvf filename.tar.gz/* export the file from the tar.gz document */
Tar zxvf filename.tar.gz/* same as above */
Tar xvf tarfile.tar./filename/* export a single file in the TAR file */
Tar-xzf filename.tar.gz unzip
Package files for downloadPack the directory./wwwinto a file www.tar.gz.

Quote:

Tar czvf www.tar.gz./WWW

Or simply zip./www.
Pack all .php files in the current directory and compress them to the bak.tar.gz file.

5. view the folder size

Du-s discuz by KB
Du-SH discuz by m

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.