Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I have list of files which ends with -live.conf.
e.g.
admin-live.conf
user-live.conf
Above files should be renamed to:
admin-dev.conf
user-dev.conf
please help me how can I achieve with single command.
this is rename stand-alone utility by perl package.
usage :-
rename -n -v 's/live.conf/dev.conf/' *
Proper find + bash solution:
find . -type f -name "*-live.conf" -exec bash -c \
'dir_n=${0%/*}/; fn=${0##*/}; mv "$0" "$dir_n${fn/-live/-dev}"; ' {} \;
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
what i do
$ cp /etc/libvirt/qemu/centos7.8.xml{,123.xml}
what happend
$ ls /etc/libvirt/qemu/
centos7.8.xml centos7.8.xml123.xml
but what i want is
$ ls /etc/libvirt/qemu/
centos7.8.xml 123.xml
i don't want to use the follow , write /etc/libvirt/qemu twice:
$ cp /etc/libvirt/qemu/centos7.8.xml /etc/libvirt/qemu/123.xml
and i know what {,_backup} mean.
any way?
like follow ? no such format
cp /etc/libvirt/qemu/centos7.8.xml{123.xml}
Using bash extension brace expansion you can do the following:
cp /etc/libvirt/qemu/{centos7.8.xml,123.xml}
or even:
cp /etc/libvirt/qemu/{centos7.8,123}.xml
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I was helped with a command, but it doesn't seem to be working. This is the command:
find /var/www/HernandezW/wordpress/ -type d -exec chmod 750 {}\;
The shell return error messages:
find: missing argument to `-exec'
How can I fix it to be able to install WordPress?
Try adding space after {}:
find /var/www/HernandezW/wordpress/ -type d -exec chmod 750 {} \;
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 3 years ago.
Improve this question
I want to change my folder emblems recursively. I know that the command gvfs-set-attribute -t string ~/Desktop/ metadata::emblems [] can change the emblem of only Desktop.
How can I change whole folders and the files emblems? I tried gvfs-set-attribute -t stringv ~/* metadata::emblems [] but it returns error Error setting attribute: Setting attribute /home/taygun/Desktop not supported.
You could feed the command into find:
find ~/ -type d -exec gvfs-set-attribute -t stringv {} metadata::emblems [] \;
There are some known issues with the defaultdir ~ on some distros with gvfs-set-attribute (https://bugzilla.redhat.com/show_bug.cgi?id=1368676)
Consider upgrading to the latest version if you're not already on it.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I have lot of files in specific folder.
I want to delete all files expect *.html file type in that folder.
Is there any way to do this in command line? I am using Linux.
I'll assume that you refer to linux command line, please update your question if not.
find ./folder/to/look/in -not -iname '*.html' -exec rm {} \;
Here's an explanation of what this does
edit
If you have not too many files then you might want to make find execute one single rm command. You can do that with using + instead of ;
find ./folder/to/look/in -not -iname '*.html' -exec rm {} +
Here's an explanation of this one
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
Is there any command in linux to calculate SHA1 hash of a director which contains files + Directories(these directories future contains file and more directories).
tar cf - $DIRECTORY|sha1sum
Deficiencies/advantages (depending on your perspective):
$DIRECTORY must be exactly the same in both cases (so you must use
relative paths).
This takes into account file modification dates, not just file contents.
I think you should be able to use this
find . -type f -exec sha1sum {} \;
Just replace the "." with your directory.
File by file you mean?
$ cd my_folder
$ sha1sum *
d73c8369c7808f7e96561b4c18d68233678f354f xxx.txt
5941a4f547f69b4b6271a351242ce41b3e440795 yyy.txt
Or of all the files together?
$ cat my_folder/* | sha1sum
7713154076812602f6f737cf5ad5924813182298