Ubuntu Create, delete files and folders, Force empty Recycle Bin method

Source: Internet
Author: User
Tags touch command

mkdir directory name = = Create a directory

rmdir empty Directory name = = Delete an empty directory

RM file name = = Delete a file or multiple files

RM–RF non-empty directory name = = delete everything under a non-empty directory

Touch filename = = Create an empty file

Rename file (clip)/move file (clip) to the specified folder

Execution format: MV source destination

Example:

MV File1 file2 = file1 The file, change the file name to File2.

MV File1 dir1 = file1 The file is moved to directory Dir1 and the filename is still file1.

MV Dir1 DIR2 = If the directory Dir2 exists, move the directory Dir1, and all of its files and subdirectories, to the directory Dir2, the new directory name is Dir1. If the directory Dir2 does not exist, the dir1, and all of its files and subdirectories, are changed to directory Dir2.

The Rename command is dedicated to file renaming, and according to the following example, rename can rename a batch file in addition to renaming a single file. At the same time, it is worth noting that the Rename command is a 2 parameter with 3 parameters rather than many people think.

In the example above, the use of batch renaming of two files is given, in fact, the rename is used in conjunction with wildcards, which is more powerful than the example shown above. The basic wildcard characters are as follows:

? Can replace a single character

* Can replace multiple characters

[CharSet] can replace any single character in a charset set

The following examples illustrate:

such as folders have these files Foo1, ..., foo9, Foo10, ..., foo278, if you use

Rename foo foo0 foo?

It will only rename the foo1 to foo9 file to Foo01 to foo09, because the wildcard can only replace a single character, so the renamed file is only a file with a 4-character-length name, and foo in the file name is replaced with Foo0.

Then continue to use

Rename foo foo0 foo??

All foo01 to foo99 files in the folder are renamed to Foo001 to foo099, and foo100 and later filenames are not changed, because the wildcard is used, so only files with a 5-character-length name are renamed, and Foo in the file name is replaced with Foo0.

If you continue to use

Rename Foo foo0 foo*

All files foo001 to foo278 are renamed to foo0001 to foo0278 because the wildcard * can replace multiple characters, so all files starting with Foo are renamed, and Foo in the file name is replaced with Foo0.

Let's take a look at the usage of the wildcard [CharSet], or continue in the folder described above, execute the following command

Rename Foo0 foo foo0[2]*

All files from foo0200 to foo0278 are renamed to Foo200 to foo278, and Foo0 in the file name is replaced with Foo.

In use, three kinds of wildcard characters can be used together, about the specific other uses only oneself constantly groping.

Force empty Recycle Bin

Previous versions of ubuntu8.04

sudo rm-fr $HOME/. trash/*

Ubuntu 8.04

sudo rm-fr $HOME/.local/share/trash/files/*

Here is the touch command usage

-A Change access time only

-C,--no-create does not create any files

-D,--date= string using < string > representing time instead of current time

-F (Ignore)

-M only changes the modification time

-R, the--reference= file uses the specified < file > time attribute instead of the current time

-t STAMP using [[CC]YY]MMDDHHMM[.SS] format instead of current time

--time=word the time specified by WORD: Access, atime, use equals-a

The effect of the option, while modify, Mtime equals the effect of the-m option

--HELP Display this help message and leave

--version display version information and leave

Note that the-D and-t options can accept different time/date formats.

Http://www.cnblogs.com/lwm-1988/archive/2011/09/13/2174538.html

Ubuntu Create, delete files and folders, Force empty Recycle Bin method

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.