Linux copy U disk file (command line)

Some Linux systems have an interface, and some do not have a command window, so importing external files becomes difficult, and there is no visual convenience.

Here you can copy files by mounting u disk.

First mount the U disk: here take centos as an example

1. In the command line mode, enter the command sudo -i to obtain root permissions.

2. mkdir / usb // Create a directory to mount the U disk 

3. fdisk -l // Check the U disk mounted in the system. If the system has a hard disk sdb1 representing your U disk, / dev / sdb1 indicates that the machine has recognized the U disk.

4. Mount / dev / sdb1 / usb // Mount the U disk / dev / sdb1 to the / mnt / usb directory.

5. cd / usb // Enter the U disk directory to view the contents of the U disk.

6. cp usb / a.txt usr / b.txt // Complete file copy

7、cd user

8. ls -l // Check it, you can see that it has been copied successfully

9. umount / mnt / usb or umount / dev / sdb1 // Unmount the U disk.

 

At this point, linux copy u disk file ends.

 

 

The above word reference: https://blog.csdn.net/houmou/article/details/50752774

 

-----------------------------------------------------------------------------------------------------

Here are some Linux commands:

1. Create a file (folder)

mkdir file name

2. Delete folder: Because there are many subfolders in the folder DOC1, it needs to be deleted layer by layer.

rm -r -f -v mydir

3. Delete the file:

rm [command switch ..] [file | directory]
 
command switch:
 
-f Delete all files in the directory without prompting the user.
-i interactive mode. With this option, the rm command prompts the user for confirmation before deleting any files.
-r (or) -R Recursively delete the directories and subdirectories in the parameter table. The directory will be emptied and deleted. The user is usually prompted when deleting files with write protection contained in the directory.

4. Delete multiple files at once:

rm file1.txt file2.txt

5. Move files:

mv [-f] [-i] original name new name

6, ls -l view the current folder content

  ls [-parameters]

-a List all files in the directory, including hidden files starting with.
-A Display all files except "." And ".."
-k Represents the size of the file in k bytes.
-l List detailed information of the file.
-s Print the size of the file after each file name.
-t Sort by time.
-u Sort by the time the file was last accessed.
-S Sort by file size.
-R List files in all subdirectories.
-p -F Append a character to each file name to indicate the type of the file. "*": Indicates an executable executable file; "/": indicates a directory; "@": indicates a symbolic link; "|": indicates FIFOs; "=": indicates sockets.
-X Sort by file extension (the character after the last.).
-m Output the file name horizontally, and use "," as the grid break.
--color = no do not display color file names

Guess you like

Origin www.cnblogs.com/alphacode/p/12676108.html