What is the sane rational for "cd ..; ls" and "ls .." being different when starting from symbol link directory [closed] - linux

Closed. This question is not about programming or software development. 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 days ago.
Improve this question
Suppose this directory layout
/dir0/
/dir0/file0
/dir0/dir1
/dir0/dir1/file1
/dir0/dir1/dir2/dir2
/dir0/dir1/dir2/file2
/dir0/dir1/dir2/dir3 [ -> /dir0/dir1 symlink ]
and you are inside dir3. Then ls .. yields file0 dir1 while cd ..; ls yields file2 dir3.
In what logic does this make any sense? Is this a bug?

Related

Unix directory deletion: [closed]

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

linux cp file at the same directory but do not want cd to that directory [closed]

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

How to delete folders that start with "--" through command line [closed]

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

How to change folders/files emblems recursively in linux? [closed]

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.

Linux: how do I tar to a specific location? [closed]

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 7 years ago.
Improve this question
I am currently backing up my system. If I use
> tar cvpzf backup.tgz --exclude=/proc --exclude=/lost+found--exclude=/backup.tgz --exclude=/mnt --exclude=/sys /
It says the system doesn't have enought space.
Right now, I have mount a usb in directory
~/mnt/sdc1
How do I tar the backup.tgz to this specific location?
You will want to do two things. First insure that your drive is mounted, Then just provide the complete path to your backup location. E.g.
mount | grep -q ~/mnt/sdc1 # or just grep -q sdc1 (if it is the only sdc1)
if [ $? -eq 0 ]; then
tar cvpzf ~/mnt/sdc1/backup.tgz ...
fi
note: the replace the ellipses with the rest of your tar command.

Resources