-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdevops_linux_cli_cheat_sheet.txt
More file actions
134 lines (117 loc) · 1.84 KB
/
devops_linux_cli_cheat_sheet.txt
File metadata and controls
134 lines (117 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
DEVOPS LINUX CLI CHEAT SHEET (FOUNDATIONS)
========================================
NAVIGATION
pwd - current directory
ls - list files
ls -la - detailed list
cd dir - change directory
cd .. - move up
cd ~ - home directory
FILES & DIRECTORIES
touch f - create file
mkdir d - create directory
mkdir -p a/b - nested directories
rm f - delete file
rm -r d - delete directory
rm -rf d - force delete (danger)
cp a b - copy
cp -r a b - copy directory
mv a b - move / rename
VIEW FILES & LOGS
cat f - show file
less f - scroll file
head f - first lines
tail f - last lines
tail -f log - live logs
wc f - count lines/words
SEARCH & TEXT
grep err f
grep -r err .
grep -i err f
grep -v debug f
awk '{print $1}' f
sed 's/a/b/g' f
cut -d: -f1 f
sort | uniq
PERMISSIONS
chmod 755 f
chmod 644 f
chown user f
chgrp group f
ls -l
whoami
id
USERS
useradd u
userdel u
usermod -aG g u
passwd u
su u
sudo cmd
who
last
DISK
df -h
du -sh d
lsblk
mount
umount
FIND
find / -name f
find . -size +1G
which python
whereis nginx
NETWORK
ip a
ip route
ping host
curl url
wget url
ss -tulnp
hostnamectl
PROCESSES
ps aux
top
htop
free -h
uptime
kill PID
kill -9 PID
ARCHIVES
tar -czf a.tgz d
tar -xzf a.tgz
zip -r a.zip d
unzip a.zip
REDIRECTION
cmd > out
cmd >> out
cmd 2> err
cmd > out 2>&1
cmd | grep x
cmd | tee f
SERVICES
systemctl status svc
systemctl start svc
systemctl stop svc
systemctl restart svc
systemctl enable svc
journalctl -u svc
journalctl -f
SSH
ssh u@ip
ssh-keygen
ssh-copy-id u@ip
scp f u@ip:/path
rsync -avz a/ b/
DOCKER
docker ps
docker images
docker run img
docker exec -it ctr bash
docker logs ctr
docker build -t img .
docker pull img
docker push img
RULE:
Cheat sheet helps memory.
Practice builds skill.