Linux: mv command
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?
December 21, 2006 08:35 PM
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.
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))
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))
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement