UNIX Flashcards

(22 cards)

1
Q

Read / Write privileges

A

Three triplets on the left. Then come owner and group. Read, write, execute.
example: drwxrwsr-x

rw-r–r–
110100100

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

Change permissions

A

chmod [code] file

chmod +w abc

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

Change the owner of a file

A

chown

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

Change group for a file

A

chgrp

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

Get the security details of a file (e.g. who owns it, who is group)

A

getent

e.g. getent group cs201ta

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

Read a file and execute the commands you find in that file

A

source OR .

e.g. source myinstructions OR ./myinstructions

OR

NEWPROG=ls -l
echo $X

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

Tell us where a program is (e.g. where is the program ls?)

A

which ls

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

Tell me what groups I’m a part of

A

id

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

Tell me what processes I’m running

A

ps

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

Tell me all the environment variables

A

set

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

Search path for commands

A

echo $PATH

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

Give programs an alias

A

alias
e.g. alias now=date
alias myls ls

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

Put commands in a file, then alias, then execute

A

echo date > dateprog
alias mydate=./dateprog
mydate
» [Tells me the date]

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

Tell me the present working directory or the past one

A

echo $PWD

echo $OLDPWD

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

Random number

A

echo $RANDOM

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

Tell me home directory

17
Q

Create an environment variable

A

assignment operator =

TODAY=”Thursday”
echo $TODAY
» Thursday

18
Q

Tell me my user ID or UID

19
Q

How to evaluate an expression

A

expr (e.g. expr 20 + 4)

double parens e.g. echo $((20 + 4))

square brackets e.g. echo $[20 + 4]

20
Q

Go back n commands

21
Q

Tell me what is happening in the foreground

22
Q

Tell me the type of a program

A

type

e.g. type ls
“Ls is aliased to…”