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
create file in vim
26
move cursor to first/last line
27
set line numbers
28
copy paste in vim
yy/p, P
29
copy number of lines
nyy
30
delete line
dd
31
undo
uu
32
search keyword
/search
33
list files with detailed information
ls -l
34
get file type information
file filename
35
different filetypes
directory, file, character file, block disk, link, socket, pipe
36
create link to a file
ln -s destination link_name
37
list files sorted by timestamp
ls -lt
38
list files sorted from latest
ls -ltr
39
hostname location
/etc/hostname
40
search word in a file
grep keyword filename
41
search word in a file respect case
grep -i keyword filename
42
search word in directory
grep -iR *
43
less filename
44
top few lines from file
head filename
45
top 20 lines from file
head -20 filename
46
last n lines from file
tail -n filename
47
log files location
/var/log/
48
user information
/etc/passwd
49
slice terminal output
cut -d: -f1 /etc/passwd
50
using regex to split output
awk -f ':' '{print $1}' /etc/passwd
51
search and replace in VIM
:%s/searched_text/replaced_text [optional /g, //g]
52
search and replace from cmdline
sed ‘s.coronavirus/covid19/g’ filename or *
53
redirect cmd output to a file
ls > filename
54
show disk information
df -h
55
outputs a string of text
echo "text"
56
outputs to no where
echo "text" > /dev/null
57
append output to a file
cmd >> filename
58
appends error to a file
cmd 2>>filename
59
redirect and append
cmd &>>filename
60
number of words in file
wc -l filepath
61
use of pipe symbol
62
get users information
uid
63
user password location
/etc/passwd
64
types of users
root, regular, service
65
add a user
useradd username
66
user information
id username
67
add user to group
usermod -aG Group user
68
add user through group information file
/etc/groups
69
switch to user
su -username
70
list user open files
lsof -u username
71
delete user
userdel username
72
list files with permissions
ls -l
73
describe ls -l output
lrwxrwxrwx => file type, user, group others r read, w write, x execute
74
change file owner
chown -R ansible:devops /opt/devopsdir
75
remove file read permission from other users
chmod o-r /opt/devopsdir, -r
76
change file permission with numeric method
chmod 640 filepath
77
sudo users
/etc/sudoers, /etc/sudoers.d
78
visudo
79
download package with curl
curl package_name URL
80
install redhat package
rpm -ivh path
81
yum package management
82
yum repos
/etc/yum.repos.d /etc/apt/sources.list & /etc/apt/sources.list.d
83
starting a service
systemctl start httpd
84
is service enabled
systemctl is-enabled service_name
85
show running processes continuously
top
86
show running processes
ps aux
87
show running processes, search for httpd processes
ps -ef | grep httpd
88
stop a running process
kill process_id
89
archive file
tar -czvf source target, tar -xzvf source target
90
archive file commands
tar, zip
91