Some common shell commands

Source: Internet
Author: User
Tags rsync

It is for entertainment only and is not responsible for the result of misoperations.

1. Remote copy
Root@192.168.1.38:/f/u/C/k.txt.
Root@192.168.1.38 SCP-r-p1234:/beauty.

2. Force Overwrite
\ CP-r/data/data1

3. synchronous copy of folders
Rsync-vzrtopg -- Progress -- delete root@192.168.1.38:/you/This
Do not synchronize the bug folder
Rsync-vzrtopg -- Progress -- delete -- exclude = bug/root@192.168.1.38:/you/This

4. Display files and update them in real time
Tail-F log. Make. Love

5. delete all the lines between you and me in the file, excluding you and me
Sed-I "/you/,/ME/{/you /! {/ME /! D }} "human. File

This command is successfully executed only in the script. the following error is reported when you enter the command line.
-Bash :! {/ME /! D }}": event not found
I am so lazy to study...

6. display a row.
I = 38
Sed-n "$ I" "P" human. File

7. replace all the files in which you are me
Sed-I's/you/ME/G' why. Do. That

8. If the first column of the log is a date, find the date after January 1, March 8...
Awk '{if ($1> "03-08") print} 'Kiss. Log

9. display the 3rd and 8th columns separated ']'
Echo "] A] B] C] D] E] F] G] H] I" | cut-D]-F 3,8
If necessary, replace '[' with ']'.
God! What do I do?

10. Split large files into small files
Split-l 3800 big. Bo small. Bo

11. Do something every second
While sleep 1
Do
Echo "Haha"

Done

12. Do something at regular intervals

Crontab-e

0 1 *** make love

Service crond restart

Crontab-l

13. view the hexadecimal format in VI

: %! Xxd

14. Tar compression and decompression

Tar cfz Doc. tgz Doc

Tar-zxvf Doc. tgz

Tar-zcvf doc.tar.gz Doc

Tar-zxvf doc.tar.gz

15. Rename batch suffix change (txt ---> HTML)

Rename. txt. html *. txt

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.