Filed and Directory Commands Flashcards

1
Q

ls -al

A

List all files in a long listing (detailed) format

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

pwd

A

Display the present working directory

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

mkdir directory

A

Create directory “directory”

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

rm file

A

Remove (delete) file

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

rm -r directory

A

Remove the directory and its contents recursively

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

rm -f file

A

Force removal of file without prompting for confirmation (-f is Force)

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

rm -rf directory

A

Forcefully remove directory recursively

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

cp file1 file2

A

Copy file1 to file2

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

cp -r source_directory destination

A

Copy “source_directory” recursively to “destination”. If “destination” doesn’t already exist, create “destination” with the contents of “source_directory”

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

mv file1 file2

A

Rename of move file1 to file2. If file2 is an existing directory, move file1 into directory file2

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

ln -s /path/to/file linkname

A

Create symbolic link to “linkname” (from /path/to/file)

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

touch file

A

Create an empty file or update the access and modification times of “file”

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

cat file

A

View the contents of “file”

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

less file

A

Browse through a text file
Why “less”?

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

head file

A

Display the first 10 lines of “file”

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

tail file

A

Display the last 10 lines of “file”

17
Q

tail -f file

A

Display the last 10 lines of “file” and “follow” the file as it grows