Advertisement

Linux: mv command

Started by December 21, 2006 07:18 PM
3 comments, last by pulpfist 17 years, 9 months ago
I'm trying to move everything in a directory to another directory. normally to move 'file.txt' to '/etc/somefolder' I would just do: 'mv file.txt /etc/somefolder' // simple enough However, my problem is that I have like 50 files in a directory and I have to move it into a folder at '/etc/somefolder'. Any ideas for moving all file to a directory?
mv * /etc/somefolder

I think
Advertisement
mv * /dest/dir

Will move everything in the current directory (.) into /dest/dir. Keep in mind that if moving into /etc, you'll likely need superuser permissions.
I would like to note that some schools of thought, believe that the configuration should be stored in the home directory of those responsibible for modifying them, such as /root.

Then once something like xorg.conf is to be mv'd to /etc instead the following command is `ln -s /root/xorg.conf.curr /etc/X11/xorg.conf`

This is merely a school of thought to avoid moving things around in your /etc, and allow for easier backup, and modification of files in /etc--you may choose to follow it or you may not.

-=-

Also you can move entire folders using `mv`

So `mv folder/ /etc/somefolder` would move the entire folder 'folder/' into '/etc/somefolder'

Just keep in mind other commands like 'cp' tend to have different behaviour

One example is the -R flag that is require for recursive copying. Now be careful. On some systems (I have no idea if this is an unintentional glitch or if it is intented) `cp -R folder/ /path/to/dest` will copy the contents of folder, rather than the directory `folder`. Generally it is best, to avoid this glitch, you simply do not include the slat(/) `cp -R folder /path/to/dest` (which means you should careful with tab completion (about the only decent tab completion I've found in my conquests is ksh))
[ Six Hour Game Contest | ( Thread | Blog | Wiki | 6hour Bio ) ][ Website | (Blog | Gallery ) ]
I personally use the -r option to both mv and cp and never had a problem with it.

This topic is closed to new replies.

Advertisement