Chapter 3: Managing Files, Directories, and Text Flashcards

1
Q

ls

A

list command

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

pwd

A

present working directory

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

ls -a

A

Display all file and subdirectory names, including hidden files’ names.

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

ls -d

A

Show a directory’s own metadata instead of its contents.

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

ls -F

A

Classify each file’s type using an indicator code (*,/,=,>,@, or |).

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

ls -i

A

Display all file and subdirectory names along with their associated index number.

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

ls -l

A

Display file and subdirectory metadata, which includes file type, file access permissions, hard link count, file owner, file’s group, modification date and time, and file name.

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

ls -R

A

Show a directory’s contents, and for any subdirectory within the original directory tree, consecutively show their contents as well (recursively).

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

touch

A

The touch command will allow you to create empty files on the fly

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

Which command creates directories?

A

mkdir

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

How do copy a file or directory locally?

A

use the cp command

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

cp -a

A

Perform a recursive copy and keep all the files’ original attributes, such as permissions, ownership, and timestamps

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

cp -f

A

Overwrite any preexisting destination files with same name as DEST.

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

cp -i

A

Ask before overwriting any preexisting destination files with same name as DEST

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

cp -n

A

Do not overwrite any preexisting destination files with same name as DEST

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

cp -R or cp -r

A

Copy a directory’s contents, and for any subdirectory within the original directory tree, consecutively copy its contents as well (recursive).

17
Q

cp -u

A

Only overwrite preexisting destination files with the same name as DEST, if the source file is newer.

18
Q

cp -v

A

Provide detailed command action information as command executes.

19
Q

What is the command or moving or renaming files or directory locally

A

mv

20
Q

Most flexible and heavily used deletion

A

rm

21
Q

Explain basic commands for handling files and directories

A

Typical basic file and directory management activities include viewing and creating files, copying and moving files, and deleting files. For viewing and creating files and directories, use the ls, touch, and mkdir commands. When needing to duplicate, rename, or move files, employ one of the mv, cp, or rsync commands. For local large file copies, the rsync utility is typically the fastest. You can quickly delete an empty directory using the rmdir utility, but for directories full of files, you will need to use the rm -r command. Also, if you need to ensure that you are removing the correct files, be sure to use the -i option on the rm utility

22
Q

Describe both structures and commands involved in linking files

A

Linking files is rather easy to do with the ln command. However, it is important for you to describe the underlying link structure. Hard linked files share the same inode number, while soft linked files do not. Soft or symbolic links can be broken if the file they link to is removed. It is also useful to understand the readlink utility to help you explore files that have multiple links

23
Q

Summarize the various utilities that can be employed to read text files

A

To read entire text files, you can use the cat, bat, and pr utilities. Each utility has its own special features. If you only need to read the first or last lines of a text file, employ either the head or tail command. For a single text line out of a file, the grep utility is useful. For reviewing a file a page at a time, you can use either the less or the more pager utility

24
Q

Describe how to find information on your Linux system

A

To determine two text files’ differences, the diff utility is helpful. With this utility, you can also employ redirection and modify the files to make them identical. When you need to quickly find files on your system and want to use simple tools, the which, whereis, and locate commands will serve you well. Keep in mind that the locate utility uses a database that is typically updated only one time per day, so you may need to manually update it via the updatedb command. When simple file location tools are not enough, there are more complex searching utilities, such as find and grep. The grep command can employ regular expressions to assist in your search