Skip to content

Latest commit

 

History

History
39 lines (34 loc) · 2.9 KB

linux.org

File metadata and controls

39 lines (34 loc) · 2.9 KB

Linux

CheatSheet

commanddesc
awk '{print $0}'print entire line, 07.46.199.184 [28/Sep/2010:04:08:20] “GET /robots.txt HTTP/1.1” 200 0 “msnbot”
echo 'this is a test' \vert awk '{print $3}'a
echo 'this is a test' \vert awk '{print $1, (NF-2)}'print first and NF number of columns print the second column from end
**~awk~**
awk '{print NR ") " $1 " -> " $(NF-2)}' logs.txtNR Row Number. 1) 07.46.199.184 -> 200
awk '{print $2}' logs.txt \vert awk 'BEGIN{FS=":"}{print $1}'FS separator is :. [28/Sep/2010
sed 's/\[//'Remove the first [
awk '{if ($(NF-2) == "200") {print $0}}' logs.txtFilter status column with status 200
awk '{a+=$(NF-2); print "Total so far:", a}' logs.txtVariable cross rows sum the total of status numeric column
awk '{a+=$(NF-2)}END{print "Total:", a}' logs.txtPrint only last cummulative value
pipes
sbt test \vert& tee ~/tmp/test.logconsole + log

Files

File Descriptors

  1. File oriented file system everything is a file.
  2. Every process keeps a table of file descriptors that shows files that are currently in use. Example STDIN STDOUT

ls /proc/$PID/fd/ This is what the process is doing 0 is stdin, 1 is stdout 7,8 network for interprocess communication.

Performance

vmstat

  1. `vmstat 5`
metricmeaning
ustime spent on user cpu
sytime spend on system cpu

Shell

grep -B 1 - grep results one line before.

Docker

Docker Swarm

Local in mac

http://callistaenterprise.se/blogg/teknik/2017/12/18/docker-in-swarm-mode-on-docker-in-docker/