UNSORTED - kamialie/knowledge_corner GitHub Wiki
There are only two difficult things in Computer Science: cache invalidation and naming things.
stress
can be used to imitate high load. nproc
# Returns number of available CPUs.
$ nproc
$ stress --cpu 1 --timeout 120
# Imitate high load on memory, each worker alocated 256 MB of memory
$ stress --vm 5 --timeout 180
-
--context=number
- show surrounding lines -
-R
- recursive inside directory$ grep -R pattern .
-
--color
to hightlight matches,--color=always
to pass colorized output through pipe
# output logs of a service started by systemd, -f to follow output
$ journalctl -u service_name -f
Automatically sets up environment user enters a directory containing .envrc
file.
export KEY=VALUE
# Encode, -n to avoid new line character
$ echo -n "string" | base64
# Decode
$ base64 <<< "encoded_string"
Common Log Format (CLF):
<IP Address> <Client Id> <User Id> <Time> <Request> <Status> <Size>
127.0.0.1 - swills [13/Nov/2019:14:43:30 -0800] "GET /assets/234 HTTP/1.0" 200 2326
Generate file with exact size
$ sudo dd if=/dev/zero of=/opt/sfw/bigfile bs=1M count=300