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
What does the -a option do in the cp command?
I thought that the -a does not preserve the structure of directories. But, I have never found a case where the structure of directories has been destroyed by the -a option.
is there such a case where the structure of directories has been destroyed by the -a option? Thanks.
-a means 3 things:
preserve timestamps, permissions, group, user (if you're running as root).
preserves symbolic links (no dereference)
recursive copy
read the man page, it has all info there
-a, --archive
same as -dR --preserve=all
To my understanding, it should recursively copy the directories while keeping all the attributes. In which case, it shouldn't be destroying the structure at all.
http://man7.org/linux/man-pages/man1/cp.1.html
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
I a little bit confused..
if in case i don't have any directory
and then I want to make a new directory with subdirectories
for example I want to make a directory named A and subdirectories B and C
can I directly use :
mkdir -p A/B A/C
or must I use
mkdir -p A A/B A/C
which is the right one?
Thank you
As mentioned in my comment, -p tells mkdir to create the parent directory/ies if it does not exist. So in your case A is created when the subdirectory is created.
Therefore:
mkdir -p A/B A/C
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
Is there any way in Linux(SUSE) to log the items below when one file or directory is accessed?
e.g.,
File_Name/Directory_Name Date_Time who Access_Permission
FileA 09/24/2015_08:12:17 UserA[all users] Execute
At 09/24/2015_08:12:17, FileA was accessed by UserA(permission group: all users) who execute the file.
You can use very cool application called sysdig It is made to do tasks that you described. It is highly configurable and can achieve a lot of things.
In you case you might need to play with parameters to achieve a diserid output. For the sake of simplicity will provide an example that partially achieves your goal. Image I want to watch folder /tmp:
1:
Start sysdig with required params:
sudo sysdig -p "%user.name %proc.name %fd.name" "evt.type=open and fd.name contains /tmp"
2:
Do some activity in specified folder:
vagrant#worker:/tmp$ touch qwerty
vagrant#worker:/tmp$ echo "aaa" >> qwerty
vagrant#worker:/tmp$ more qwerty
aaa
3:
Observe the result:
vagrant touch /tmp/qwerty
vagrant bash /tmp/qwerty
vagrant more /tmp/qwerty
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 using cp command in my program to make a copy of a text file. But when I use -p -i with cp I don't understand the difference between the both.
What's the difference between using simple cp and using options -p -i with it?
Here is my line code:
execl("/bin/cp","cp","-p","-i",argv[1],argv[2],NULL);
The -i stands for interactive mode, this will require input from the stdin before it will overwrite a file.
The -p (no capital p) will preserve mode ownership and timestamp. The latter one seems the more interesting one, this will actually cause a difference in your mss. When you're copying a file there is an owner of the file and there are different file permissions and a timestamp attached to it, if you want to keep these then use the -p parameter.
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 took an examination last week and there was a question asking to create three directories by using one command ; then there was a question asking to delete those directories on a same command. Is that possible ?
You should read man mkdir and man rm
mkdir -pv myfolder/{a..z}/{1..10}
creates 261 folders (myfolder/a/1, myfolder/a/2.... myfolder/z/10)
rm -rf myfolder/
removes them all
Yes this is possible.
Check here and here
Removing directories in one command is also possible. Check here
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
i am a linx beginner.the command options often confused me
e.g.
dash and double dash
let us look at 'man lftp'
mirror [OPTS] [source [target]]
-e, --delete delete files not present at remote site
--delete-first delete old files before transferring new ones
--depth-first descend into subdirectories before transferring files
what is -e?
-e ==? --delete
or
-e ==? --delete --delete-first --depth-first
-e is the same as --delete only.
There do not exist short options corresponding to --delete-first or --depth-first, so those have to be written out in full.