linux commands Flashcards

1
Q

what does the kernel on UNIX do?

A

it is the hub of the op system - ALLOCATES TIME + MEMORY TO PROGRAMS -
also handles filestore + comms in response to system calls

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

what does the shell do on UNIX do?

A

acts as interface between user + kernel

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

to list personal files and subdirectories

A

ls

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

ls doesnt always list everything, just those not prefixed with a dot (HIDDEN FILES). how do you make a list inclusive of these

A

ls -a

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

how to display username

A

whoami

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

how to make directory

A

mkdir dirname

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

how to change directory

A

dc dirname

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

how to stay in directory you are in

A

cd .

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

how to navigate to parent directory

A

cd ..

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

pathnames enable you to work out where you are in file system. how do you print this out?

A

pwd

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

home directories can also be referred to by tilde character - can be used to specify paths starting at home directory

A

ls ~/dirname

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

how to copy file

A

cp file1 file2

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

how to create a file

A

touch filename

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

how to create backup

A

rename filename.txt to filename.bak

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

how to move/rename file

A

mv file1 file2

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

how to remove a file

A

rm filename

17
Q

how to remove a directory

A

rmdir directoryname

18
Q

to clear screen

A

clear

19
Q

what does the command cat (concatenate) do?

A

displays contents of file to screen

20
Q

what does the head command do?

A

displays first 10 lines of file to screen

21
Q

what effect will typing in -5 do to head command?

A

deducts last 5 lines from the 10 displayed

22
Q

what does tail command do?

A

displays last 10 lines of files

23
Q

what does grep do? specify the syntax

A

displays a specified word from the file to screen. grep science science.txt

24
Q

what option is used to ignore uppercase and lowercase letters?

A

grep -i science science.txt

25
Q

what syntax is used to search for a specific phrase?

A

grep -i ‘spinning top’ science.txt

26
Q

what are the other options of grep and their meanings?

A

-v display those lines that do not match
-n precede each matching line with line number
-c print only total count of matched lines

27
Q

what syntax is used to perform a word count?

A

wc -w science.txt

28
Q

what syntax is used to perform a line count?

A

wc -l science.txt

29
Q

how to write contents to a file

A

cat > list1
pear
banana
apple
^D

30
Q

how to read the contents of a file

A

cat list1