04 - LINUX Flashcards

1
Q

what is opensource ?

A

Software with source code that anyone can inspect, modify, and enhance.

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

advantages of linux

A
  • Opensource
  • Community support
  • Support wide variety of hardware
  • Customization
  • Most servers run on linux
  • Automation
  • Security
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Architecture of linux

A

Hardware – kernel – shell – applications

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

Popular linux distros

A
  • Ubuntu
  • Mint
  • Arch
  • Fedora
  • Debian
  • OpenSUSE
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Popular server linux OS

A
  • Red Hat Enterprise linux
  • Ubunu server
  • Centos
  • SUSE enterprise linux
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Most used linux distros

A
  • RPM based: RHEL, centos, Oracle
  • Debian based: ubuntu, kali linux
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what are the home directories

A

/root, /home/[username]

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

user executable

A

/bin, /usr/bin, /usr/local/bin

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

other mountpoints

A

/media, /mnt

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

configurations

A

/etc

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

Temporary files

A

/tmp

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

kernels and bootloader

A

/boot

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

server data

A

/var, /srv

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

system information

A

/proc, /sys

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

shared libraries

A

/lib, /usr/lib, /usr/local/lib

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

command to switch to root user

A

su -i

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

create file

A

touch filename.ext

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

create multiple files in number range

A
  • Touch filename{1..10}.txt
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

copy file to directory

A

cp file dev/

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

relative vs absolute file path

A

relative: path from current directory
absolute: path from file system home directory

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

copy directory with contents

A

cp -r /dir /main

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

move or rename a file

A

mv src dest

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

move all text files

A

mv *.txt dir/

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

VIM editor modes

A

command, insert, extended

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

create file in vim

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

move cursor to first/last line

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

set line numbers

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

copy paste in vim

A

yy/p, P

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

copy number of lines

A

nyy

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

delete line

A

dd

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

undo

A

uu

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

search keyword

A

/search

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

list files with detailed information

A

ls -l

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

get file type information

A

file filename

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

different filetypes

A

directory, file, character file, block disk, link, socket, pipe

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

create link to a file

A

ln -s destination link_name

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

list files sorted by timestamp

A

ls -lt

38
Q

list files sorted from latest

A

ls -ltr

39
Q

hostname location

A

/etc/hostname

40
Q

search word in a file

A

grep keyword filename

41
Q

search word in a file respect case

A

grep -i keyword filename

42
Q

search word in directory

A

grep -iR *

43
Q

less filename

A
44
Q

top few lines from file

A

head filename

45
Q

top 20 lines from file

A

head -20 filename

46
Q

last n lines from file

A

tail -n filename

47
Q

log files location

A

/var/log/

48
Q

user information

A

/etc/passwd

49
Q

slice terminal output

A

cut -d: -f1 /etc/passwd

50
Q

using regex to split output

A

awk -f ‘:’ ‘{print $1}’ /etc/passwd

51
Q

search and replace in VIM

A

:%s/searched_text/replaced_text [optional /g, //g]

52
Q

search and replace from cmdline

A

sed ‘s.coronavirus/covid19/g’ filename or *

53
Q

redirect cmd output to a file

A

ls > filename

54
Q

show disk information

A

df -h

55
Q

outputs a string of text

A

echo “text”

56
Q

outputs to no where

A

echo “text” > /dev/null

57
Q

append output to a file

A

cmd&raquo_space; filename

58
Q

appends error to a file

A

cmd 2»filename

59
Q

redirect and append

A

cmd &»filename

60
Q

number of words in file

A

wc -l filepath

61
Q

use of pipe symbol

A
62
Q

get users information

A

uid

63
Q

user password location

A

/etc/passwd

64
Q

types of users

A

root, regular, service

65
Q

add a user

A

useradd username

66
Q

user information

A

id username

67
Q

add user to group

A

usermod -aG Group user

68
Q

add user through group information file

A

/etc/groups

69
Q

switch to user

A

su -username

70
Q

list user open files

A

lsof -u username

71
Q

delete user

A

userdel username

72
Q

list files with permissions

A

ls -l

73
Q

describe ls -l output

A

lrwxrwxrwx => file type, user, group others
r read, w write, x execute

74
Q

change file owner

A

chown -R ansible:devops /opt/devopsdir

75
Q

remove file read permission from other users

A

chmod o-r /opt/devopsdir, -r

76
Q

change file permission with numeric method

A

chmod 640 filepath

77
Q

sudo users

A

/etc/sudoers, /etc/sudoers.d

78
Q

visudo

A
79
Q

download package with curl

A

curl package_name URL

80
Q

install redhat package

A

rpm -ivh path

81
Q

yum package management

A
82
Q

yum repos

A

/etc/yum.repos.d
/etc/apt/sources.list & /etc/apt/sources.list.d

83
Q

starting a service

A

systemctl start httpd

84
Q

is service enabled

A

systemctl is-enabled service_name

85
Q

show running processes continuously

A

top

86
Q

show running processes

A

ps aux

87
Q

show running processes, search for httpd processes

A

ps -ef | grep httpd

88
Q

stop a running process

A

kill process_id

89
Q

archive file

A

tar -czvf source target, tar -xzvf source target

90
Q

archive file commands

A

tar, zip

91
Q
A