Linux Learning Notes-2015-12-17

Source: Internet
Author: User

1. Create a directory/data

Mkdir/data

CD/; mkdir data

Command summary:

mkdir command to create a directory

LS-L long format display-D directory displays directory or file

CD switch directory hierarchy


2. Create the Aaa.txt file below/data

Pwd

Cd/data;touch Aaa.txt or Touch/data/aaa.txt


3. Adding content to aaa.txt study Linux

echo "Study Linux" >/data/aaa.txt

Vi/vim I study Linux QW


4. Copy the Aaa.txt file to the/temp.

Cp/data/aaa.txt/temp

Parameter-A can be copied directory-pdr


5. Move the/data directory to the/root

mv/data//root/


6. Go to the data directory in the root directory and delete the Aaa.txt

Cd/root/data;rm Aaa.txt y

Rm-f/root/data/aaa.txt


7. Exit to the previous level directory, delete the data directory

CD: Rm-r/data


Paired with Xargs

Find. -type f-mtime +15 |xargs rm-f Delete file 15 days ago Current directory file

Find. -type d-mtime +30 |xargs rm-rf Delete directory 30 days ago directory under current directory

Using the-exec of find

Find/logs-type f-mtime +5-exec rm {} \; Find files that change time before 5th in the/log directory and delete


8. Filtering files

Cat

Grep-v

Grep


9. Create a complete/data/aaa/directory with one command

Mkdir-p/DATA/AAA/B/C/D

tree/data/Display tree structure


10. It is known that the Test.txt file already exists in the/tmp directory, how to execute the command in order to copy the/mnt/test.txt to/tmp and overwrite the/tmp/test.txt, and the Linux system does not prompt to overwrite

/bin/cp/mnt/test.txt/tmp/test.txt

\cp/mnt/test.txt/tmp/test.txt


11. Only the contents of lines 20th through 30th in the Ett.txt file (100 included) are produced.


This article is from the "Small Zheng Technology Blog" blog, please be sure to keep this source http://ko178.blog.51cto.com/220419/1725750

Linux Learning Notes-2015-12-17

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.