File system Flashcards

1
Q

Which command should we use to know current directory/ current location?

A

pwd

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

Current directory/location can be referenced by…

A

. in commands

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

Directory above the current directory can be referenced by…

A

.. in commands

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

Absolute path

A

specifies the path of a file/ directory regardless of the current location

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

Relative path

A

specifies the path of a file/ directory which is relative to the current location

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

display the content of a directory

A

ls

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

List All Files including hidden files
Hidden files start with a .
Commonly used for storing user preferences

A

ls -a

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

List files in reverse order

A

ls -r

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

List files in Recursive list

A

ls -R

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

can be used to view a hierarchical structure of the file system

A

tree

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

user’s home folder

A

~ (tilde character)

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

navigate your way to other directories

A

cd

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

create a directory/ multiple directories

A

mkdir

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

create subdirectory and parent(s). Required if parent(s) do(es) not pre-exist

A

mkdir -p dir1/sub2/sub3

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

remove empty directories

A

rmdir

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

remove directories with or without content

A

rm -r

17
Q

create files

A

vi/ vim

touch: creates files, but also has another purpose which is to update time stamp if the file already exists

18
Q

Display the content of a file

A

cat

19
Q

Display a % of the file starting from the beginning

A

more

20
Q

Display a screenful of the file starting from the beginning

A

less

21
Q

Display the first 10 lines of a file

A

head

22
Q

Display the last 10 lines of a file

A

tail

23
Q

removes file

A

rm filename

24
Q

copy files

A

cp filename newfilename

25
Q

counts the number of line, words, and bytes in the files

A

wc filename

26
Q

move or rename

A

Rename: mv originalFilename newFilename

Move a file into directory:
mv filename directoryname

Move multiple files into a directory: mv file1 file2 file3 dir

27
Q

Provide information abut the content of a file

A

file filename

ASCII text, directory, empty, shell script text

28
Q

File - inode

A
ls -i
Inode holds information on files such as:
- user and group ownership
- file size
etc.

In UNIX, each file is uniquely identified by its name and by an index node number called inode.

29
Q

File - long format

A

ls -l

30
Q

Wildcards

A
  • : Match zero or more characters

? : Match one character

[ ] : Match anything in the [ ] for 1 character position

[a-e] : The - is a range separator. This will match a to e.

[!0-9] : ! = negate. This will match anything except 0 to 9.

31
Q

Every file in UNIX has access permission

A

Read -r
Write -w
Execute -x

32
Q

Permissions are defined for three types of users.

A

User, Group, Other

33
Q

What does it mean?

drwxr-xr-x

A

d : file type
“d” means directory
“-“ means regular file

rwx : user permissions
r-x : group permissions

34
Q

How to change permission?

A

chmod 751 dir3

4: r - Read
2: w - Write
1: x - execute
0: No permissions