run the mv command but nothing happened so I tried to install it:
# yum install mv
then i got the Nothing to do response with error : no package mv available
Any pointers on how to set up the mv command in Apache 2.2.15 on Centos 6.
Thank you very much in advance
N.B The last 3 lines after issuing the yum install mv:
Setting up Install Process
No package mv available.
Error: Nothing to do
Please explain nothing happened.
mv belongs to the coreutils. If you don't have mv installed then your system is seriously broken. But I'm very sure you have mv installed, otherwise you would see an error message like mv: command not found.
If there is no error, then mv won't print any output at all. This is the intended behavior. If you want to force output, then append the argument -v for verbose mode.
You can use the type command to see if your mv has been incorrectly aliased to something else.
Mine is:
$ type mv
mv is /bin/mv
Yours may be something like
$ type mv
mv is an alias for
You can use the unalias command to correct this type of problem.
$ unalias mv
Related
Hi I just created a file by mistake, doing a tar actually, anyway the problem I have is that I can't remove that file. It is called --exclude-tag-under=hey.txt
I am trying to use rm -rf command but it doesn't do the trick. this is the output
[root]# rm -rf '--exclude-tag-under\=hey.txt'
rm: unrecognized option '--exclude-tag-under\=hey.txt'
Try 'rm --help' for more information.
the problem here is that the command rm is recognizing the file as a flag and thats a problem, I've tried also
rm -rf *hey.txt
but it doesnt work neither
I've also tried to change the name of the file but its the same problem
Prepend ./ like this: rm ./--exclude-tag-under\=hey.txt
When in doubt, check the man pages.
Running man rm will give you the rm man page, which, on Linux and OpenBSD (the ones I have tested) at least, will have a section saying:
To remove a file whose name starts with a '-', for example '-foo', use
one of these commands:
rm -- -foo
rm ./-foo
Use rm -- --exclude-tag-under=hey.txt
$ ls
--exclude-tag-under=hey.txt
test
$ rm -- --exclude-tag-under=hey.txt
$ ls
test
How can I uninstall a gcc build which I installed from source.I am using gcc 4.9 and I'm on ubuntu 12.04.
Or is there a way to upgrade to latest gcc versions through the ubuntu repository?
When you build a package from source there is unfortunately no magic uninstall usually, however you can approximate this, credit to this mailing list thread.
Basically you should install again into a temporary directory and list all the files created in said directory, then you can delete all of them from the main system through a script.
Here is an example of a script to uninstall GCC in this way:
make install DESTDIR=/tmp/gccinst
find /tmp/gccinst | sed -e s,/tmp/gccinst,, | \
(while read F; do rm "$F"; done)
Run it from inside the gcc source directory as root.
To answer your second question you can install the latest gcc available in the ubuntu repo with:
apt-get install gcc
Overlay repos may have newer versions, I have seen a suggestion there is a newer version at ubuntu-toolchain-r/test (install via):
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
But I am not sure if they have added 4.9 there yet. If not you will indeed have to install from source.
EDIT:
It looks like #roelofs found a better guide to install the repo in his answer, so go look there too and remember to give him an upvote if it helps :)
In GCC 5.1.0, although there is no top-level uninstall target, some directories do have it, in particular gcc, so you can do:
cd build/gcc
sudo make uninstall
This does not remove everything that was installed, but it removes major executables like gcc, g++, cpp... contained in that directory, so it might be enough.
Vality has a great start
make install DESTDIR=/tmp/gccinst
But his cleanup command has a few problems. First, it passes directories to rm, including the usual directories (such as /usr). We can fix this via -type f:
find /tmp/gccinst -type f | sed -e s,/tmp/gccinst,, | \
(while read F; do rm "$F"; done)
Getting rid of the directories that this leaves empty...
find /tmp/gccinst -depth -type d -not -empty | sed -e s,/tmp/gccinst,, | \
(while read F; do rmdir -p --ignore-fail-on-non-empty "$F"; done)
add to Vality and Ben. If you do this from your own login shell:
find $HOME/tmp/gccinst/ -type f | sed -e s,$HOME/tmp/gccinst,, | (while read F; do rm **-f** "$F" ; done)
Need -f flag or the script may not run if there's some permission issue.
/root/ihome3/gcc-4.6.3/gcc-build-4.6.3/gcc
[root#izwz93atpyz gcc]# make uninstall
rm -rf /usr/local/bin/c++
rm -rf /usr/local/bin/g++
rm -rf /usr/local/share/man/man1/g++.1
rm -rf /usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.6.3
rm -rf /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/4.6.3
rm -rf /usr/local/bin/gcc
rm -f /usr/local/bin/cpp
if [ x != x ]; then \
rm -f /usr/local//cpp; \
else true; fi
rm -rf /usr/local/bin/gcov`enter code here`
rm -rf /usr/local/share/man/man1/gcc.1
rm -rf /usr/local/share/man/man1/cpp.1
rm -f /usr/local/share/info/cpp.info* /usr/local/share/info/gcc.info*
rm -f /usr/local/share/info/cppinternals.info* /usr/local/share/info/gccint.info*
[root#izwz93atpalb56zydy9bpyz gcc]# pwd
/root/ihome3/gcc-4.6.3/gcc-build-4.6.3/gcc
the following operation isreally ok. when you make one gcc from source code and make install at gcc-build,then it will generaton one gcc direction at source code's top direction. cd $source_code_top/gcc , then make uninstall. it will purge remove gcc from you linux system.
The highest available version of GCC in the 12.04 repositories is 4.6. You can use the package manager to install a newer version, but you will have to add a PPA. This link should help, although it is for a slightly older version of GCC (but can be used for the newest version).
As a commenter pointed out, if your own built version of GCC was compiled with the --prefix parameter, the entire installation should be in that directory under /usr/local or wherever you installed it, and can be removed.
I've created this bash file putting on it a secuence of commands i often run for synching files from my digital camera. the point is it doesn't to ANYTHING! What am i missing?
thank you!
code:
#!/bin/bash
#temporal
mkdir /tmp/canon
#copy files from camera
rsync -r /run/user/mango/gvfs/g*/DCIM /tmp/canon
cd /tmp/canon
#get files from subdirs
find ./ -name '*.JPG' -exec mv '{}' ./ \;
#remove dirs
ls -l | awk -F'[0-9][0-9]:[0-9][0-9]' '/^d/{print $NF}'| xargs -i rm -rf '{}' \;
#recreate folder structure with year|month pattern
jhead -n%Y/%m/%f *.JPG
#Sync with external HD
rsync -r --ignore-existing . /media/mango/WD/FOTOS/
If it does not even do the mkdir, then it sound most likely that the version of the script you want is not the one running. Try using an qualified path, such as ./myscript or an absolute path, like /home/joe/bin/myscript. The command type myscript will tell from where the shell is running it.
Also, try running the script after adding set -x to the top of the script or using bash -x myscript; that will show every line as it is executed.
If this still doesn't help, there could be bash startup code, such as in .bashrc getting in the way. That's much harder to diagnose, although the same set -x can be used, although with great caution unless a second user can login and edit this user's startup scripts since mistakes in startup scripts can make it impossible to login to the system.
Try this
chmod +x yourscriptname
./yourscriptname
Make usre you are running the same script you made.
I have one shell script running on windows environment on cygwin environment. This script have one purging function which deletes certain folder on the system bases on certain condition.
I prepare the list of all the folder that I want to delete and then use following command:
rm -rfv $purge (where purge is the list of directories I want to delete)
Now when I tested this script, the directories are not getting deleted at all. First I thought there is some issue with by purge list, but on debugging I came to know that purge list is fine.
After lots of debugging and trials I just made small change in command:
\rm -rfv $purge
It just a kind of hit and trial and script starts working fine.
Now as far as I know \rm and rm -f both means forceful delete.
Now how can I justify this that why 'rm -f' what now working earlier but '\rm -f' did.
I want to know the basic difference between these two commands.
The rm can be (in theory) one of:
shell builtin command (however I don't know any shell with such builtin)
external command (most likely /bin/rm)
a shell function
an alias
If you put \ before it (or quote any part of it, for example "rm" or even 'r'm) shell will ignore all aliases (but not functions).
As jlliagre mentioned, you can ask shell what rm is and what is \rm using type builtin.
Experiment:
$ type rm
rm is /bin/rm
$ rm() { echo "FUNC"; command rm "$#"; }
$ type rm
rm is a function
$ alias rm='echo ALIAS; rm -i'
$ type rm
rm is aliased to `echo ALIAS; rm -i'
Now, we have alias rm, function rm and original external rm command:
Let's see how to call each other:
$ rm # this will call alias, calling function calling real rm
$ rm
ALIAS
FUNC
rm: missing operand
$ \rm # this will ignore alias, and call function calling real rm
FUNC
rm: missing operand
$ command rm # this will ignore any builtin, alias or function and call rm according to PATH
rm: missing operand
To understand it deeply, see help builtin, help command, help alias and man sh.
That means your rm command is aliased or a function. Backslashing it tells the shell to use the real rm command.
Edit: You can tell what rm refers to with the type command, eg:
$ type rm
rm is /bin/rm
.
$ type rm
rm is aliased to `rm -i'
.
$ type rm
rm is a function
...
Assume I want to completely reinstall GHC/HP. I want to (as much for superstition as anything) delete anything and everything from previous installs. What do I actually need to delete (and where)?
Edit: I'm on OSX, but I'm more curious if this information is available in general, for all systems.
Edit2: So far we have:
OSX:
/Library/Frameworks/GHC.framework/
~/.cabal/
/usr/bin/ -- symlinks
I'll add to that (based on "prefix" defined here: http://www.vex.net/~trebla/haskell/sicp.xhtml#storage):
prefix/lib/
prefix/share/
prefix/bin/
prefix/share/doc/
/usr (/local) /lib/[ghc-version]
/usr (/local) /share/doc/ghc/html/libraries/ -- documentation
/usr (/local) /share/doc/ghc/
/usr (/local) /bin
/var/lib/[ghc-version]
/etc/[ghc-version]
~/.ghc/
Edit 3:
OS X:
~/Library/Haskell
Linux:
??
Windows:
??
Had to remove Haskell Platform on OS X recently. Most are cleaned up via Uninstaller:
sudo /Library/Frameworks/GHC.framework/Versions/Current/Tools/Uninstaller
These have to be cleaned up manually:
rm -r ~/.cabal
rm -r ~/.ghc
rm -r ~/Library/Haskell
Alternatively, as documented in
/Library/Haskell/doc/start.html
there is now a custom uninstall command with options,
/Library/Haskell/bin/uninstall-hs
In general, one can document the files created by any activity (installer, ...) by bracketing the activity in a work directory with
echo >timestamp
[activity]
sudo find -x / -newer timestamp -print >snapshot.txt
If you've installed a Haskell Platform since about 2012 on OS X, just run
uninstall-hs
and carefully read what it outputs. You'll need to run it again with the options it offers you. Run
uninstall-hs --help
for more options.
Below is my original answer, which will still work, but doesn't offer as many options and is a bit "ham fisted":
Warning: This script is extreme. It will remove even your custom config files for GHC and Cabal, and executables you've built that are still in ~/Library/Haskell or ~/.cabal. Use caution; review what it is about to do; have backups; caveat scriptor!
#!/bin/bash
set -x
sudo rm -rf /Library/Frameworks/GHC.framework
sudo rm -rf /Library/Frameworks/HaskellPlatform.framework
sudo rm -rf /Library/Haskell
rm -rf ~/.cabal
rm -rf ~/.ghc
rm -rf ~/Library/Haskell
find /usr/bin /usr/local/bin -type l | \
xargs -If sh -c '/bin/echo -n f /; readlink f' | \
egrep '//Library/(Haskell|Frameworks/(GHC|HaskellPlatform).framework)' | \
cut -f 1 -d ' ' > /tmp/hs-bin-links
sudo rm -f `cat /tmp/hs-bin-links`
You may want to add lines to save off and restore your config files like:
mv ~/.cabal/config /tmp/cabal-config 2>/dev/null || true
mv ~/.ghc/gchi.conf /tmp/ghci-config 2>/dev/null || true
and
mkdir ~/.cabal
mkdir ~/.ghc
cp /tmp/cabal-config ~/.cabal/config 2>/dev/null || true
cp /tmp/ghci-config ~/.ghc/gchi.conf 2>/dev/null || true
Bracket the rm lines with these. Though you may or may not want your old ~/.cabal/config if you are upgrading to newer stuff.
Note that this only deals with the current user's home directory. If you have multiple user accounts that all use Haskell, then the other accounts will need cleaning as well. (Repeat the lines involving ~.)
I am on OSX (Lion atm). I've got GHC in /Library/Frameworks/GHC.framework/ (current and previous versions). There are also some symlinks in /usr/bin, but these will be replaced by a new install.
If you have used cabal to (locally) install packages, you also may want to clean out ~/.cabal. If you have a recent cabal, you can easily reinstall all packages for the 'new' GHC version by using cabal install world and then look for directories matching previous version of GHC you had like so:
for package in `ls ~/.cabal/lib/`; do
if [ ! -d ~/.cabal/lib/${package}/ghc-7.0.3 ]; then
echo $package;
else
echo "OK for $package";
fi;
done
These should be safe to delete.
Hope this helps you somewhat.
uninstall-hs does some of the work for you; I'm not sure how much.