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
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
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/
4
Q
what command lists only hidden files?
A
ls -d .*