File Operations Flashcards

1
Q

ls

A

Lists files and directories in current directory (ls - list).

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

ls -a

A

Lists files, dot files and directories in current directory (-a - all.

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

ls dir1 dir2

A

Lists files in directory1 and directory2.

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

ls -l

A

Lists a long list (-l - long). permissions, number of hard links, owner, group, size, last modified and filename.

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

What does drwxrwxr-x means?

A

Position 1: - = file, d = directory, l = symbolic link, p = named pipe, c = character device, b = block device. 2-4: Read, write and execute permissions for the owner. 5-7: Group. 8-10: Other users.

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

ls -ld dir1

A

Information about directory but not about what is in the directory.

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

ls -lh

A

Prints size in a more readable format.

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

ls -s

A

Prepend the size of files.

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

Sort files by size.

A

ls -s | sort -n

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

ls -R

A

List contents in directories recursively.

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

cp [options] files (file|directory)

A

Copy one or several files.

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

cp -a

A

Copy directories recursively. Same as cp -r but preserve file attributes.

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

cp -r

A

Copy directories recursively. Same as cp -a but does not preserve file attributes.

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

mv [options] source target

A

Move. Can also be used to rename a file.

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

mv file1 file2

A

Rename file1 to file2.

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

mv file1 file2 dir2

A

Move file1 and file2 to dir2.

17
Q

rm [options] files | directories

A

Remove.

18
Q

rm -r dir1 dir2

A

Recursively remove dir1 and dir2.

19
Q

rm -rf /

A

Probably you don’t want to do this.

20
Q

ln [options] source target

A

Create symbolic (also soft or sym) and hard links. The default is a hard link.

21
Q

ln -s

A

Create a symbolic link.

22
Q

ln -d

A

Create a hard link to a directory.

23
Q

cd

A

Change directory.

24
Q

pwd

A

Prints current directory.

25
Q

mkdir

A

Make directory.

26
Q

mkdir -p

A

Make a directory path, e.g. mkdir -p ./dir1/dir2, now both dir1 and dir2 will be created.