What are some of the most common Linux commands used in testing or operation?

Source: Internet
Author: User
Tags bz2 chmod touch command

In the process of testing, you may encounter the need to go to the server to modify some of the configuration files, for example, a field value is 1 associated with the old version, is 0 associated with the new version, you may need to take the command of the vi operation, or to see the length of the session set, You may need to CD to a directory under a cat file. Maybe we don't need to be proficient in Linux, but the basics are pretty helpful to everyone's work. Today Testyao introduced a few common Linux commands to you know:


1. ls command

The LS command is the meaning of listing directory contents (list directory Contents), and running it is to list the contents of a folder, possibly a file or a folder
The "ls-l" command lists the contents of a folder in detail mode (long listingfashion)
The "ls-a" command lists everything in the folder, including the following "." A hidden file that starts with


2. CD command

The frequently used "CD" command represents a change of directory, which changes the working directory in the terminal to perform, copy, move, read, write wait operations
CD: Represents back to previous directory
CD/REP back to the root directory


3. PWD command
PWD (Print working directory) displays the full path of the current working directory in the terminal


4. History command

The history command is a historical record that shows the history of all commands executed in the terminal


5. mkdir command

The Make Directory command creates a new directory under the named path, but if the directory already exists, then he returns an error message "Cannot create a folder, the folder already exists" mkdir


6. Touch Command

The "Touch" command represents the update of the file's sample and modification time to the current time, and the touch command creates it only when the file does not exist, and if the file already exists, he updates the timestamp, but does not change the contents of the file.


7. chmod command

The "chmod" command is to change the mode bit of the file, and chmod will change the file mode (permissions) of each given file, folder, script, etc. according to the required mode.
In files (folders or other, for simplicity, we are using files) in the 3 type of permissions
Read (R) =4
Write (W) =2
Execute (x) =1
So if you want to give the file read-only permission, set to ' 4 ', write-only permission, set the permission to ' 2 ': Execute only permissions, set to ' 1 ': Read and Write permissions, is 4+2=6, and so on
Now you need to set the user and user group permissions in 3, the first one is the owner, then the group where the user is, and finally the other user
[Email protected]:~# chmod 777 abc.sh


8. Tar command

The "tar" command is a tape archive (Tape Archive), which is useful for creating archives of some files and their decompression.
[Email protected]:~# tar-zxvf abc.tar.gz (remember ' Z ' stands for. tar.gz)
[Email protected]:~# tar-jxvf abc.tar.bz2 (Remember ' j ' stands for. tar.bz2)
[Email protected]:~# tar-cvf archieve.tar.gz (bz2)//path/to/folder/abc
Note: "tar.gz" represents the use of gzip archive, "bar.bz2" compressed with bzip, it compresses better but also slower


9. Date command
```
$ date
November 29, 2016 16:15:39
```

10. Cat Commands

"Cat" stands for connection (concatenation), connects two or more text files or prints the contents of a file in standard output form
[Email protected]:~# cat a.txt b.txt c.txt d.txt adbd.txt


11. CP Command

"Copy" is a copy, which copies one file from one place to another.
[Email protected]:~ #cp/home/user/downloads abc.tar.gz/home/user/desktop
NOTE: CP, a command that is most commonly used in shell scripts, and it can use wildcards to customize the replication of required files


12. MV Command

"MV" command to move a local file to another place
[Email protected]:~# mv/home/user/downloads abc.tar.gz/home/user/desktop

What are some of the most common Linux commands used in testing or operation?

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.