{"id":19,"date":"2014-11-19T23:37:43","date_gmt":"2014-11-19T21:37:43","guid":{"rendered":"http:\/\/blog.chloesoe.ch\/?p=19"},"modified":"2017-10-02T17:01:45","modified_gmt":"2017-10-02T15:01:45","slug":"randomized-collection-of-useful-linux-commands","status":"publish","type":"post","link":"https:\/\/blog.chloesoe.ch\/?p=19","title":{"rendered":"Randomized collection of useful linux commands"},"content":{"rendered":"<p>Cut some rows<br \/>\n<code>cut -d \" \" -f2-4 messages<\/code><\/p>\n<p>with tee we drop shit in a file and in stdout<br \/>\n<code> grep kernel \/var\/log\/messages | tee \/root\/my.log<\/code><\/p>\n<p>with xargs we give in this expample the command host the output line by line:<br \/>\n<code>cut -d \" \" -f1 localhost_access_log.2014-11-19.txt | sort | uniq | xargs -n1 host<\/code><\/p>\n<p><code>ps -C tail<\/code><br \/>\nps and show all processes of the program tail<\/p>\n<p><code>pstree -pna<\/code><br \/>\n-p = show PID<br \/>\n-n = sort by PID<br \/>\n-a = shows options and arguments <\/p>\n<p><code>top -bi -d 1 > file.txt<\/code><br \/>\n-b = batch mode to put it in a file<br \/>\n-i = show only the active ones<br \/>\n-d 1 = every 1 sec<br \/>\nLike that the file.txt has every second the active processes in top <\/p>\n<p><code>kill -l<\/code> shows you all available signals you can send to the process<br \/>\n1) SIGHUP: Hang-up-signal, for daemons to reload their config<br \/>\n9) SIGKILL: to kill the process<br \/>\n15) SIGTERM: to terminate the process<br \/>\nother<br \/>\n2) SIGINT: like Ctrl+C, but much more fun<br \/>\n18) SIGCONT: continue processes which are put in the background with bg and fg (or with 19)<br \/>\n19) SIGSTOP: bg, but also much more fun<br \/>\n20) SIGSTP: like ctrl+z.<\/p>\n<p>with <code>w<\/code> we see the logged in users<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Cut some rows cut -d &#8221; &#8221; -f2-4 messages with tee we drop shit in a file and in stdout grep kernel \/var\/log\/messages | tee \/root\/my.log with xargs we give in this expample the command host the output line by line: cut -d &#8221; &#8221; -f1 localhost_access_log.2014-11-19.txt | sort | uniq | xargs -n1 host&#8230; <a href=\"https:\/\/blog.chloesoe.ch\/?p=19\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Randomized collection of useful linux commands<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-19","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=\/wp\/v2\/posts\/19","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19"}],"version-history":[{"count":6,"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions"}],"predecessor-version":[{"id":25,"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=\/wp\/v2\/posts\/19\/revisions\/25"}],"wp:attachment":[{"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.chloesoe.ch\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}