1.2 Given a scenario, manage files and directories Flashcards
Command: cp
copies files or directories to another location
Syntax: cp [options] SOURCE DESTINATION
What 2 options can be used with the cp command to also include the contents of a directory?
-r or -R
Command: mkdir
creates a new directory
Syntax: mkdir [options] DIRECTORY
What option must be used with command mkdir to create all directories in the path if they don’t exist, i.e. /folder1/folder2/directory?
-p
Command: rmdir
removes a directory, if it is empty
Syntax: rmdir [options] DIRECTORY
Command: ls
lists the contents of a directory
Syntax: ls [options] DIRECTORY
Command: pwd
prints full name of the current working directory
Command: cd
changes the current working directory
Syntax: cd [path/directory]
Command: cat
shows, read-only, text of a file
Syntax: cat [filename]
Command: less
like cat, but content is shown with paging
Syntax: less [filename]
Define vi(m)
default text editor included with Linux distributions, can be complex to use
Define nano
Simple, easy to use CLI text editor that must be installed
ls -a, what does the switch “a” do
shows all files/folders, including hidden
ls -l, what does the switch “l” do
long - shows more detailed information, such as permissions, file size, etc…
Command: touch
creates the file, if it doesn’t exist, otherwise updates the modification of the file
Syntax: touch [filename]