Bash/Linux Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

ls -la

A

for listing permission

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

Get-LocalGroup

A

Get default local groups listed w descriptions

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

Get-LocalUser

A

gives the names of users, if they are enabled or not, with description

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

Get-LocalGroupMember

A

can see which users are in the group

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

sudo su -

A

you become the root user, but not recommended if a mistake has been made

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

sudo cat /etc/group file

A

shows which groups or users have sudo accessibility to run commands/unrestricted access

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

cat /etc/group

A

shows each group, group password (x means the pw is encrypted), group ID, list of users in the group

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

cat etc/password

A

first field is username, password, UID (user ID),

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

How to reset password in GUI

A

computer management, local users and groups, select account, properties, then you can ask to reset PW or set it manually for them by selecting set PW

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

net user cindy ‘some_password’ OR * to then ask for PW for user

OR /logonpasswordchg:yes

A

to change a users password, set it hidden from sight, or for next login they will have to change it

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

passwd cindy

A

changing password for cindy in Linux, you need current PW, then entering a new one

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

sudo passwd -e cindy

A

set the password to expire and require a new one in Linux

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

new -localuser in windows

A

creates a new user in windows

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

net user cindy * /add

A

adds a new user called cindy and asks for the password/hidden in Windows

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

net user cindy /logonpasswordchg:yes

A

next login cindy will need to change her password in Windows

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

net user cindy /del

A

delete cindy command in Windows

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

Remove-LocalUser Cindy

A

removes a local user in Windows

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

sudo useradd cindy

A

adding a user in Linux

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

sudo userdel cindy

A

deletes a user in Linux

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

ls -l ~/my_file

A

listing it using the long flag to see the permissions on the file

  • at the beginning is a normal file, D is for directory, the next 9 bits are the permissions grouped in sets of 3

first set is permission of owner,
second set is permission of group,
last is permission of all other users
- means its disabled, otherwise it has rwx (read, write, execute)

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

chmod u+x my_cool_file

chmod u-x my_cool_file

chmod ugo+r my_cool_file

A

change the permission by giving executable or x access to the owner or you.

remove a permission with -

add read permissions to our owner, the group that the file belongs to, and to all users and groups

22
Q

numerical equivalent for rwx (read, write, execute)

A

4 for read,
2 for write,
1 for execute

chmod 754 my_cool_file

stands for 4+2+1 meaning rwx for the owner,
5 is 4+1 for read and execute for g

23
Q

if you ls -l /usr/bin/passwd, you get

-rwsr-xr-x 1 root root 54256 May 16 19:35

what does the S in the permissions stand for?

A

S stands for set UID, you can run permissions as if you were the owner of the file

24
Q

sudo chmod +t my_folder/

OR

sudo chmod 1755 my_folder/

A

sticky bit aka this means everyone can add and modify files in the /tmp directory, but only root or the owner can delete the /tmp directory.

25
Q

sudo apt install gimp

A

open source graphical editor named Gimp

26
Q

where are repository source files saved on Ubuntu?

A

/etc/APT/sources.list

27
Q

sudo apt update

sudo apt upgrade

A

updates the list of packages in your repos but wont upgrade them.

to upgrade packages, it will then install any outdated packages for you automatically. before installing new software, its good to run apt update

28
Q

orca.exe

A
29
Q

uname -r

A

gives us system information on the kernal for the microchip installed and what version it is

30
Q

sudo apt update

sudo apt full-grade

A

this will update for a new kernal version for microchip

31
Q

FAT32

A

file system that support reading and writing data to all 3 major OS, linux, windows, Mac OS

files cant be larger than 4 GB
size of file system cant be bigger than 32 GB
mainly for USB

32
Q

Partition

A

splitting up the hard drive into another section that can be used.

if a different OS is on the partition, it is called a volume

disks can have 4 partitions, with extended, and logical as additional partitions within

33
Q

GPT

A

GUID Partition Table

2 TB or greater size volume that has 1 type of partition, but has unlimited partitions

34
Q

MBR and GPT partitioning

A

MBR is an interactive program and GPT is from command line

sudo parted -l (disk named /dev/sda will be partitioned into /dev/sda 1)

sudo parted /dev/sdb
there was error as unrecognized disk lable

mklabel gpt
print

sudo mkfs -t ext4 /dev/sdb1

sudo parted -l

then mount it

35
Q

sudo mount /dev/sdb1 /my_usb/

A

mounting the usb

36
Q

/etc/fstab

A

to permanently mount a disk

cat /etc/fstab
sudo blkid (will show UUID for block device ID's)
37
Q

mkpart primary linux-swap 5GiB 100%

sudo mkswap /dev/sdb2
sudo swapon /dev/sdb2

A

virtual memory is known as swap space

to automatically mount the swap space everytime, just add

swapentry /etc/fstab file like earlier

38
Q

inode

A

stores everything about a file except for the filename and data

39
Q

df -h

A

disk free space in human readable form

Linux generally doesnt need disk defrag

40
Q

sudo fsck /dev/sda

A

checks the filesystem to repair

41
Q

ps -x -ef (more details of where it is located)

ps -ef | grep Chrome (to find chrome)

cat /proc/1805 to look at more info on process state

A

shows processes running

PID
PPID
C is children processes
TTY is terminal associated with the process,
STAT stands for R running, T stopped, S interruptible sleep,
TIME the time the process has been running

42
Q

kill 10235

kill -KILL 10235

kill -CONT 10235

A

kills a firefox process or something else using PID

killed without it cleaning up processes, may lead to corruption

process turned from a T to an S (stop to a suspended)
SIGTERM, SIGKILL, SIGSTP are most common signals

43
Q

top

uptime

lsof

A

top processes being used

shows current time, up for X time, how many users, and load averages

lists open files and what processes are using them, good for showing processes that are holding open files

44
Q

ls -l /

ls -la /

A

gives detailed info about our directory and the files and folders in them

shows all files aka hidden files

45
Q

cp -r ‘cat pics’ ~/Desktop

A

will copy the directory of cat pics and all contents recursively for all contents

46
Q

less mytext.txt

head mytext.txt (or tail

A

interactive shell,

first 10 lines of file or last 10

keys for up and down
g at beginning of file,
G goes to end of file,
/word find_thisword
q to quit
47
Q

grep cow *.txt

A

find strings of cow in all .txt files

48
Q

less /var/log/syslog 2> /dev/null/

A

filtered from error messages, is a redirector or STDER or standard error

49
Q

scp /home/drdoo/Desktop/myfile.txt drdoo@104.131.122.215:

A

will copy a file with the path of the file

50
Q

unmount /dev/sdd

dd if=/dev/sdd of=~/Desktop/myusbimage.img bs=100M

A

how to disk clone in linux, first make sure to unmount the disk, then copy it over using a USB flash image