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
After running a bad command my computer generates folders that start with "--". When I run ls I get something like:
workspace
--workspace
I don't know how to delete these folders through the command line.
rm -r --workspace does not work. I only have access to this machine through CLI so I can't delete them using the gui.
My OS is Linux 18.04
You need to tell rm to stop parsing and use your arguments verbatim. You do this by passing a final -- argument before the file or folder name.
rm -r -- --workspace
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 1 year ago.
Improve this question
There was a directory structure on my linux server like this A/$b/
From my home directory executed a command
rm -rf A/$b.
After executing this command, The directory A itself was deleted.
Any idea what would have happened in the background?
A $ sign indicates the start of a variable in most shell languages.
If $b is not defined then your command would resolve as:
rm -rf A/
… which would delete the A directory.
To include the $ in the path you need to escape it:
rm -rf A/\$B
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 3 years ago.
Improve this question
Going through this tutorial, I had to execute the command export PATH=~/.local/bin:$PATH
It explained with
This command inserts the path, ~/.local/bin in this example, at the
front of the existing PATH variable.
However, I still don't understand what exactly is happening there. What is the goal/effect of that command?
This command prepend the folder ~/.local/bin (~ is your home folder) to your global variable $PATH (echo $PATH too see it).
Thanks to that, you'll be able to execute program/script stored in the folder ~/.local/bin without typing the full path.
Example, if you have a script myScript.sh in your folder, before adding ~/.local/bin to your $PATH, you can run it with the command:
~/.local/bin/myScript.sh
After adding ~/.local/bin to your $PATH, you can execute it with the command:
myScript.sh
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 6 years ago.
Improve this question
I've already posted this question here:
https://superuser.com/questions/1067609/how-to-run-a-bash-script-via-absolute-path
But I hope that maybe If I duplicate it here, I will get my answer sooner :)
I have a file:
/Users/danylo.volokh/test/test_bash_script.sh
Content is very simple:
#!/usr/bin/env bash
echo "-- print from script"
I'm in folder "danylo.volokh"
This command runs fine:
Danilos-MacBook-Pro:~ danylo.volokh$ test/test_bash_script.sh
-- print from script
But if I try to run in with absolute path I get an error:
Danilos-MacBook-Pro:~ danylo.volokh$ /test/test_bash_script.sh
-bash: /test/test_bash_script.sh: No such file or directory
I want to run a command with absolute path from any folder and get the script to be executed.
Your path in incorrect. You should run:
/Users/danylo.volokh/test/test_bash_script.sh
/test/test_bash_script.sh looks for the file from the root directory! Your path should be from the root, not from the current directory.
Try /Users/danylo.volokh/test/test_bash_script.sh.
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
while compiling the c++ programs in which i'm using the libxml library it is showing errors at the header files that no file or directory found. I have installed the library but it still showing errors. So i just type the above command after that every thing is working fine but i didn't understand it.
what is the meaning of "../" in UNIX? my command in UNIX is like this "sudo cp -r libxml ../" what it means? how to give relative addresses in UNIX and what are the different wildcard is used.
.. represents the parent directory. For example, if the current directory is /home/user/ the parent directory is /home
. represents the current directory
The command sudo cp -r libxml ../ copies the entire directory libxml in the parent directory.