个人工具

UbuntuHelp:Forum/moving

来自Ubuntu中文

跳转至: 导航, 搜索

The how to has been pulled together in credit by darkmatter from Ubuntu Forums. The How To has been edited and published by SteveMyers. The direct steps are provided on moving a file from one directory to another by the command line, in doing so the serial.txt is being used as an example of how to move a file from one side of the HD to the other.


To move !serial.txt to math (as root - since the output you listed was from your root account), type the following in a terminal.

mv ~/!serial.txt ~/math

The '~' is a 'shorthand' representation for the 'home' folder of the account you are running from. For example, If the above files were on my system under my user account, I could move the .txt by the following Code:

mv /home/darkmatter/!serial.txt /home/darkmatter/math

Running as root, and the above files were in my root directory, I would move the .txt with

mv /root/!serial.txt /root/math

To save on typing, I can substitute '~' in place of the home directory. So for either of the above situations, the command would look the same:

mv ~/!serial.txt ~/math

The same files, if in the root account, could also be moved with the sudo command from my user account, but i would need to give the full path to the file, as well as the math directory

sudo mv /root/!serial.txt /root/math

Special Reference In a terminal, type

man bash