complex mv and ls commands Flashcards

1
Q

if the following commands returns:
pwd
=> /root/cli-tmp/parents/children

ls root/cli-tmp/parents/
=> nephews

what will this command do?
cp ../nephews/* ./

A

Copy the contents of the “nephews” directory to the “children” directory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Suppose you are in a directory with 7 files. You need to move 6 of them into a “tmp” directory, that you have yet to create. How do you do that?

A

The fastest way to move all but one file is to move all the files, then move the one file back

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you move all the files in abc/ that end with “.txt” into xyz/?

A

First, check your pattern:
$ ls abc/*.txt

Then move the files:
$ mv abc/*.txt xyz/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

what command lists only hidden files?

A

ls -d .*

How well did you know this?
1
Not at all
2
3
4
5
Perfectly