BASH Flashcards

1
Q

man

A

stands for manual, used to explain commands

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

$ ls

A

list directory contents

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

$ ls -l

A

use a long listing format

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

$ ls -a

A

all - do not ignore entries starting with .

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

$ ls -R

A

list all files and subdirectories recursively

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

$ cd

A

change directory - move between folders

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

% cd ..

A

return to previous directory

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

% pwd

A

print working directory - shows you full path of your current location

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

$ mkdir

A

make directory

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

% touch

A

change file timestamps

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

% touch -t 0402050000 new_file2.txt

A

change time of new_file2.txt to 05.02.04 instead of current time

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

% touch -r file1 file2

A

change file2 timestamps to copy file1s

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

% stat filename

A

can view access, modify, change, and birth info of file

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

% nano

A

text editor - lets you create/edit text files

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

% cp file1 file2

A

copy - copies content of file1 to file2

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

% mv

A

move and rename files

17
Q

% mv desktop Desktop

A

will rename desktop as Desktop

18
Q

$rm / rmdir

A

remove file or remove directory

19
Q

shebang?

A

Very first line of a script

20
Q

!/usr/bin/env bash

A

starter for portable bash script

21
Q

echo “Hello World”

A

prints text to terminal

22
Q

Would a new file be allowed to run?

A

No - newly created files aren’t executable by default, need to give permission to run them

23
Q

chmod +x hello.sh

A

gives permission to run hello.sh

24
Q

./hello.sh

A

./ tells terminal to run hello.sh file

25
Q

$ printenv

A

prints environment variables

26
Q

read -p can read for user input