Linux 2 Flashcards
How would you copy a single file?
Call the cp command with two arguments, the source file you want to copy and the target file you want to copy it to.
What happens if you use the cp command with a directory as the target?
You will end up with a copy of the source file inside of the named directory.
How can you copy multiple files at once?
Using the cp command, you can list several source files and use a directory name to specify where you want copies of those files to go. The original file names of the source files will be used as the names of the new files in the target directory.
What will happen if you try to copy a directory to another directory using cp?
If you didn’t use -r (the recursive flag), you will get an error message.
What flag can you use to overwrite a file that is not under your current username?
The -f (force) flag.
What flag can you use in order to prompt for confirmation when copying over existing files?
cp -i
What command is used to delete files and folders?
rm
The process for moving files is almost identical to that of copying files. Which command is really just a combination of cp and rm to achieve the desired outcome of moving a file from one location to another?
mv
Can you use the mv command to move a file across systems?
No.
What is the Unix philosophy for commands?
Don one thing, and do it well.
With these seemingly small individual commands, we can build some impressive work flows by redirecting the output of one command to the input to another command using the ____ operator.
pipe ( | )
In addition to redirecting the output from one process and sending it to another process, we can alos write that output to a file using the ____ operator.
>
We can use the > to write data to a file, but how can we read data from a file?
With the
What are two common command line search tools?
ack and ag
How do you run an ag search?
ag