$cp souce.file /destination/folder
$ cp /source/folder /destination/foler
$ scp [source.file] andy@121.10.17.0:/destination/folder
$ rsync -e "ssh" -avz [source.file] andy@121.10.17.0:/destination/folder
$ scp * andy@121.10.17.0:/destination/folder
$ rsync -e "ssh" -avz --no-recursive * andy@121.10.17.0:/destination/folder
$ scp -r * andy@121.10.17.0:/destination/folder
$ rsync -e "ssh" -avz * andy@121.10.17.0:/destination/folder
$ rm [option] [command]
| -i | interactive -allows you to see what its doing |
|---|---|
| -f | force -will not prompt you even if write protected |
| -d | directory -must be empty or will not remove |
| -r | recursive -to delete directories that are not empty and sub-directories and files |
| -rf | recursive and force -care is required here, everything will be deleted if not carefulFile |
examples
The simplest case is deleting a single file in the current directory. Type the rm command, a space, and then the name of the file you want to delete.
$ rm file_1.txt
If the file is not in the current working directory, provide a path to the file's location.
rm ./path/to/the/file/file_1.txt
You can pass more than one filename to rm. Doing so deletes all of the specified files.
rm file_2.txt file_3.txt
Wildcards can be used to select groups of files to be deleted. The * represents multiple characters and the ? represents a single character. This command would delete all of the png image files in the current working directory.
rm *.png
This command would delete all files that have a single character extension. For example, this would delete File.1 and File.2, but not File.12.
rm *.?
If a file is write-protected you will be prompted before the file is deleted. You must respond with y or n and press "Enter."
rm command with write-protected file
To reduce the risk of using rm with wildcards use the -i (interactive) option. This requires you to confirm the deletion of each file.
rm -i *.dat
The -f (force) option is the opposite of interactive. It does not prompt for confirmation even if files are write-protected.
rm -f filename
To remove an empty directory, use the -d (directory) option. You can use wildcards (* and ?) in directory names just as you can with filenames.
rm -d directory
Providing more than one directory name deletes all of the specified empty directories.
rm -d directory1 directory2 /path/to/directory3
To delete directories that are not empty, use the -r (recursive) option. To be clear, this removes the directories and all files and sub-directories contained within them.
rm -r directory1 directory2 directory3
If a directory or a file is write-protected, you will be prompted to confirm the deletion. To delete directories that are not empty and to suppress these prompts, use the -r (recursive) and -f (force) options together.
rm -rf directory
-o precedes miscellaneous mount options
allow_other: allows other users to access files
default_permissions so that it otherwise uses default file permissions
sudo sshfs -o allow_other,default_permissions andy@DadsAsus:/home/andy/Downloads /home/andy/ShareFolder