SSH Login Tools Common Commands _linux

Source: Internet
Author: User
Tags chmod parent directory

First we need to know what is called shell.
The operating system is called the shell with the external most important interface, perhaps in terms of terminology such as the cmd command line, a shell under the Windows operating system. The DreamHost shell refers to the DreamHost provides a command line for customers to better use their virtual hosting services.
DreamHost shell instructions and operations are based on the Linuxord2.4.29, that is, DreamHost now adopted the system, if you are also dreamhost users, then this article may be helpful to you.

Directory:
1.basicinstructions/Basic
2.wget/Download Tool
3.crontab/timed Task
4.tar/tar.gz/Compressed Files
5. View File Size

cd[Directory name] conversion path
Cd.. Return to Parent Directory
LS shows all files in current directory
rm[-r]-f[][file name] Delete files, plus [-r] to delete all files under the file, such as RM-RF [ABC] Delete all files under ABC folder and folder
Tar-[unzip the downloaded compression pack]
unzip[file name] Extract files
CP-RPF. a/* b copies all files in folder A to its parent directory B
Wget (one of the best commands You can use this tool to quickly download the required files from the network under Linux)

1.BasicInstructions Basic Operation command
In general, you can use "$[instructions]-help" to obtain help for each of the following commands [instructions], including its parameters
The definition of a list of sequences.

-ls List all contents under current folder
$ls-o Lists all content in the current folder, with details but not group
$ls-L-ibid., with group information
$ls-A lists all the contents of the current folder, including the "." The file that starts with
$ls-T sorted by change time
$ls-V by version

-CD [dir] into the folder
cd.. exit current folder, return to parent directory
-PWD Show Current Path
-mkdir [dir] new folder
-chmod Change File/folder permissions
$chmod [mode] [dir], where the Mode is like "755″ or" 777″.
$chmod [Mode] [file]
$chmod-R [Mode] [dir], recursive form that changes permissions on all files in the target folder
Mode there is another way of expression, "755″" is "-rwxr-xr-x", not enumerated.

-rm [file] Delete files/folders
$RM-F [file] forcibly deleted, ignoring files that do not exist, without prompting
$RM-R [file] recursively deletes all content
Delete a folder $rm-RF
-CP Copy
$CP [Options] [source] [destination]
Where [options] can be-f (forced copy) or-R (recursive copy)
-MV Rename or move
$MV [Options][source][destination]
[Options] Common:-F (forcibly moved/renamed),-I (try before moving/renaming),-U (update)
For example
$mvwwwroot/cgi-bin. Move the/cgi-bin directory to the current directory
$mvcronfile. Txtmyfile.txt Rename Cronfile.txt to MyFile.txt
CP-RPF. a/* b copies all files in folder A to its parent directory B

2.wget Download Tool
Wget is a non-interactive network file download tool that you can use on Linux to quickly download from the Web
Required documents without the need for the
wget[parameter list]url
The simplest usage:
$wgethttp://targetdomain.com/file.tar
wget common parameters:-t[nuberoftimes]: Number of attempts, when Wget cannot establish a connection to the server, try to connect how many times. Than
such as "-t120″ said to try 120 times." When this is "0″", specify to try Infinity multiple times until the connection succeeds.
This setting is very useful when the other server suddenly shuts down or the network is suddenly disconnected, it can restore the normal successor
Continue downloading No
There are finished files;-C: the continuation of the breakpoint, which is also a very useful setting, especially in the case of a larger file, if the midway accidentally interrupted, then the connection to restore the time from the

The time has not finished the place to pass, but does not start afresh, uses this item to need the remote server also to support the breakpoint continuation, General Unix/linux's WEB/FTP server all supports
continuation of breakpoint;-t[numberofseconds]: timeout, specify how long the remote server will disconnect without responding, start
Next try. For example, "-t120″ says that if the remote server does not send the data after 120 seconds, try to connect it again.
Pick up. If the network speed is faster, this time can be set shorter, on the contrary, you can set the longer some, generally the most
No more than 900, usually not less than 60, generally about 120 more appropriate;-w[numberofseconds]: How many seconds to wait between two attempts, such as "-w100″ indicates two attempts
Stay 100 seconds;-nd: Do not download the directory structure, the files downloaded from the server all specified directories are heap into the current directory;-x: Just the opposite of the "-nd" setting, create a complete directory structure,

such as "wget-ndhttp://www.gnu.org/",
The actual directory structure is built at one level, until all the files have been passed;-NH: Do not create directories with the destination host domain name directory, and direct the directory structure of the target host directly down to

Current directory
; r: Recursive download, in this record structure;-l[depth]: Download the depth of the remote server directory structure, such as "-l5″ download directory structure or file with a depth less than or equal to 5
;
-M: Options for site mirroring, If you want to mirror a site, use this option to automatically set
other appropriate options to facilitate site mirroring;-NP: Downloads only the contents of the specified directory and its subdirectories for the target site. This is also a very useful option, we fake
set up a person's personal home page has a link to other people on the site's personal homepage, and we just want to download this
person's personal homepage, if not set this option, or even--it is possible to take down the entire site, which is clearly we pass the
often unwanted;-http-user=username-http-passwd=password: If the Web server needs to specify a username and password, use these two items to set up;-O to write the data to the file.

3.Crontab Perform tasks regularly
Under the DreamHost system, you can build your own crontab through the shell. The specific use is as follows:
Using a terminal that supports shell logins (such as fterm or putty), the address bar input username@qiran.org:22 can ssh
Way to log on to the server.
Common crontab Commands:
CRONTAB-L displays all existing cronjob.
Crontab-r deletes the current cronjobs.
Crontab-e Edit the current "Crontabfile". DH recommends the use of Nano
Note that your crontab contains all the cronjobs, each cron row, and the end of the line. A normal cron follows
Shown
452***/home/user/script.pl
The first number is a few minutes per hour,
The second number is the first few hours of the day,
The third number is the day ordinal of the month,
The fourth number is the month ordinal of a year,
The fifth number is the day ordinal of the week.
How to use it for example:
32 * * *: Represents the 32nd minute per hour.
12,42 * * *: Indicates that the 12th and 42nd minutes are two times per hour
*/15 */2 * *: means 0:00, 0:15, 0:30, 0:45, 2:00, 2:15, 2:30, ...
43 18 * * 7: For each Sunday 6:43pm run the command line.

After using the Nano to edit the file under DreamHost, save with Ctrl+o, ctrl+x exit edit.

4.tar command
The tar command is used in the following ways:
tar[parameter list] [filename]
Parameter list:
-C generates a new backup and overwrites the old backup file at the same time
-X uncompress from backup file
-t lists the file directories within the backup file
-V Display list of all manipulated files
-F generate backup at specified location
-U will not exist in the backup file, or add the file that has been changed to the backup.

An example is provided:
Tar cvf filename.tar/* Make backup * *
Tar cvf tarfile.tar./filename/* To back up filename files to Tarfile.tar * *
Tar TVF filename.tar/* List The contents of the TAR document * *
Tar xvf filename.tar/* Export file from tar document * * *
Tar zxpvf filename.tar.gz/* Export file from tar.gz document * * *
Tar zxvf filename.tar.gz/* Ditto * *
Tar xvf tarfile.tar./filename/* Export a single file in the tar file * * *
TAR-XZF filename.tar.gz Decompression
package files for download the directory./www package to file www.tar.gz

QUOTE:

Tar czvf www.tar.gz./www

Or a straightforward, simpler zip./www
Package and compress all. php files in the current directory to file bak.tar.gz

5. View folder size

Du-s Discuz by kb
Du-sh Discuz Press 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.