Learn Linux (3): Linux file management and operations

Source: Internet
Author: User
Folder:

We may be used to right-click Copy, cut, and paste in windows. although this function can be seen in Ubuntu, in some cases, these functions are not available. For example, if you are in the file system home directory, all these right-click options are invalid...

If you need such a convenient operation in Windows, you can switch to the root logon, or you can use the following command:

sudo nautilus

In this case, the main folder is opened. At this time, you can perform operations similar to those in Windows no matter which directory you are in. copy, cut, and paste; do not close the terminal during the process, because the process is controlled by a terminal; close the terminal after the operation is complete;

After the folder is closed, shutting down Nautilus-gdu extension is displayed.


Common file operation commands: ls (List Files ):

Ls # list files in the current folder LS-A # list all files, including. or .. do not hide LS-L # lowercase L, not 1. listing the detailed document information of the current directory LS-F # the information listed is marked with "*" indicating the executable file, and "/" indicating the folder # other usage, you can use the help command to view: ls -- Help

CD command (enter the Directory ):

# Before using this command, we can enter PWD to view the current directory;

CD downloads // enter the download folder CD \ # Return to the root directory> press enter> Cd ~ # Effect CD .. # enter the home folder CD/# enter the main File System

CMP command (comparison ):

CMP in in2 # create these two documents before practice and input the content for comparison # output information such as: In in2: 51st bytes, row 8th # When the two files are identical to each other, the command will not display any information. For more details, refer to CMP -- help.

CP command (copy ):

Copy the abc.png file from the folder to the desktop. the Chinese system folder is named "desktop" CP-R Document desktop/# copy folder "document" to the Desktop Folder. and recursively process the content in the folder, that is, copy the content including the folder content CP document desktop/# If-R is not added, the following message will appear:

CP: Skip the directory "document"

Other usage

cp --help

Note: The CP command is used to copy files or directories. For example, if two or more files or directories are specified at the same time, and the last destination is an existing Directory, then it copies all the previously specified files or directories to this directory. If multiple files or directories are specified at the same time, and the last destination is not an existing Directory, an error message is displayed.

Cut command:

Usage: Cut-cnum1-num2 filename
Description: displays the text of each row starting from num1 to num2.

Mycpp/in content
5
1 1 4 2
2 3 3 1

Run the following command:

cut -c1-6 mycpp/in

5
1 1 4
2 3 3

Other functions:

 cut --help

Diff command (comparison differences ):

# Compare file differences diff mycpp/In mycpp/in2 # list different diff downloads/mycpp/# list different files in the two folders

FILE command (Judgment type ):

File abc.png identification file abc.png: PNG image data, 405x397, 8-bit/color RGB, non-interlacedfile-C macubuntu.tar.gz # the file name gzip compressed data, from UNIX, last modified: mon Aug 5 02:09:38 2013

Mkdir command (create folder ):

Mkdir mylove # create a folder named mylovemkdir mylove/you # If mylove does not exist, an error is returned. in this case, mkdir-P mylove/you # cascade is created. if necessary, create the upper-level directory mkdir-V mylove # output processing details

Mkdir: the directory "mylove" has been created"

Rmdir command (delete folder ):
Rmdir mylove/you # delete a folder you do not delete its parent directory mylovermdir-P mylove/you # cascade delete you, that is, its upper directory rmdir-V mylove # output processing details after deletion
Rmdir: deleting directory "mylove"

Rm command (delete file ):

Rm abc.png # Delete directly without prompting Rm-r abc.png # force Delete, no message is displayed. rm-I abc.png # Ask Rm-I abc.png before deletion # Ask Rm-V ABC before deleting more than 3 files, PNG # display the message Rm-r download/# recursively delete all files in the download process (use Rm-R ~ with caution ~)

MV command (move file/folder ):

MV-V abc.png desktop/# Move the music video with a prompt "abc.png"-> "desktop/abc.png" Mv abc.png desktop/# Move the music video without the steps shown overwrite and rename

OK ~~ Come here today. Go to bed!

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.