Go Create, rename, delete files and folders under Ubuntu, forcing the Recycle Bin method to empty

Source: Internet
Author: User
Tags touch command

Create, rename, delete files and folders under Ubuntu, forcing the Recycle Bin method to empty

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 file name-           -Create an empty file
Renaming files (clips)/moving files (clips) to a specified folder echweb-technology Community 5]. O "? 8H. I
Execution format:
MV Source Destination
Example:
MV file1 file2 means to file1 the file and change the file name to File2.  mv  file1 dir1 The file file1, 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, with the new directory name 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.

Previous versions of ubuntu8.04

sudo RM -fr $HOME/. Trash/*

Ubuntu 8.04 and above

sudo rm -fr $HOME/.local/share/trash/files/*
Here is the touch command usage
-A                     only change the access time -C,--no-        Create creates no file -D,--Date= string        Use < string >  Represents the time, not the current time -f                     (Ignore)-m                     only changes the modified time -R, the--reference= file   uses the specified < file >  Time property instead of the current time -t STAMP               using [[CC]YY]MMDDHHMM[.SS] format instead of the current time --time=word            using WORD Time specified: Access, atime, use equals-a
The effect of the option, while modify, Mtime equals the effect of the-m option
--     Help displays this information and leaves --version to display version information and leave

Go Create, rename, delete files and folders under Ubuntu, forcing the Recycle Bin method to empty

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.