Bash Shell (Linux) Flashcards

1
Q

cd..

A

Navigates back to parent directory of current directory

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

cd

A

Change directory
(Is how to navigate to a different directory in current directory)

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

grep

A

Used to search for a string of text. Consists of 2 arguments. First argument is string of text (if more than 1 word, use quotes to indicate the string). The Second argument is the file being searched

Ex: grep OS updates.txt

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

ls (LS)

A

Lists names of files and directories in current directory.

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

pwd

A

Print working directory. Displays current working directory.

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

clear

Bonus- what keys can also be used

A

Clears terminal

Bonus: CTRL+L

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

/ (Slash)

what is the 1st / in a file path and the difference between that and others after.

A

The first / indicates the root and each other / indicates the next directory path down the hierarchy.

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

cat

A

Displays the content of a file.

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

head

A

Displays the top 10(by default) lines of a file.

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

tail

A

Displays the last 10(by default) lines of a file.

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

-n X (replace X with any number)

A

Can be added to cat, head, Or tail to change the default amount of lines of a file that is displayed.

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

less

Bonus: what keys are used in less, and their function?

A

Displays content of a file one page at a time. BONUS: Spacebar -move forward a page. b -move back a page.
⬆️key -forward one line. ⬇️key -back one line. q -Quit.

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

whoami

A

Will display current user directory
(Does not move you to directory)

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

(piping)

A

Send the standard output of one command as the standard input of another command for further processing.

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

find

A

Searches files and directories that meet certain criteria.

Such as a certain ‘string of text’, a certain file size, or were last modified within a certain time frame.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q
  • (dash)
A

Indicates an option.

Ex: -n (to modify the number of lines displayed)

Other Ex: -mtime, -name.

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

-name

A

Searches criteria that is case sensitive.

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

-iname

A

Searches for criteria that is not case sensitive.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q
  • (Asterisk)
A

Are used to represent zero or more unknown characters.

20
Q

-mtime

A

Can be used to find files last modified by + or - the number of days.

Command syntax Ex:
-mtime +10
-mtime -10

21
Q

-mmin

A

Used to find files last modified by any number of minutes.

Command syntax Ex:
-mmin +10
-mmin -10

22
Q

/bin

A

Directory that stores binary files and other executable files.

23
Q

/etc

A

Directory that stores system
configuration files.

24
Q

/tmp

A

Directory that stores temporary files.

25
Q

/mnt

A

“Mount” Directory that stores media such as USB and Hard drives.

26
Q

/home

A

Home directory for the user. Each user has their own home directory.

27
Q

mkdir

A

Creates a new directory.

(The mkdir command is followed by what you want the name to be)

28
Q

rmdir

A

Removes or deletes a directory.
(After, rmdir command is followed by the name of directory you want to remove).

29
Q

touch

A

Creates a new file.

(touch command is followed by what you want to name the file).

30
Q

rm

A

Removes or deletes a file.

(rm command is followed by the file name you want to delete).

31
Q

mv

A

Moves a file or directory to a new location.

(mv command has two arguments after it. The 1st being the file name being moved. The second is the file path the file is being moved to).

32
Q

cp

A

Copies a file to a new location.

(cp command has two arguments after it. 1st is the file being copied, 2nd is the path the file is being copied to).

33
Q

nano

A

Is used to edit a file.

(nano, followed by the file name. Will put you into an edit mode that with also show a legend to navigate and edit said file).

34
Q

ls -l (LS -L)

A

Displays permissions to files and directories.

35
Q

ls -a (LS -A)

A

Displays hidden files.

36
Q

ls -la (LS -LA)

A

Displays permissions to files and directories, including hidden files.

37
Q

chmod

A

Changes permissions on files and directories.
Syntax Ex: chmod g+w, o-r access.txt
permissions returned Ex: -rwxrwxw-x

                                            u        g         o Breakdown:directory/file user group other
                                  d/-   rwx    rwx     rwx
38
Q

sudo

A

“Super User DO” grants temporary access to root authority.

DO NOT EVER LOG IN AS ROOT! is considered bad practice and can be dangerous.

39
Q

useradd

A

Adds a new user.

Can add -g to set user in primary group,
Or add -G to set user to secondary group. followed by the user name being added.

              *Need to use sudo
40
Q

usermod

A

Used to modify existing users.
*uses sudo
Using -g or -G with -a adds user to existing group. Without -a any other groups are removed. Other usermod options include
-d to change the users home directory.
-l (L) to change users log in name.
-L to lock user out of account.

41
Q

userdel

A

Deletes a user from the system.
*uses sudo

42
Q

chown

A

Changes ownership of a file, directory or group.
*uses sudo

Ex: sudo chown fgarcia access.txt

Ex: sudo chown fgarcia :security access.txt
(To change group owner, indicated by : )

43
Q

man

A

“Manual” displays information on other commands and how they work.

44
Q

whatis

A

Displays a description of a command
in a single line.

45
Q

apropos

A

Searches the manual’s definitions using a specified ‘string’.

Adding -a will allow another ‘string’.