{"id":10,"date":"2016-06-19T08:13:52","date_gmt":"2016-06-19T08:13:52","guid":{"rendered":"http:\/\/home.zandmans.nl\/wp\/?p=10"},"modified":"2024-06-29T12:03:24","modified_gmt":"2024-06-29T11:03:24","slug":"unix-commands","status":"publish","type":"post","link":"https:\/\/www.sandynet.nl\/index.php\/2016\/06\/19\/unix-commands\/","title":{"rendered":"Unix commands"},"content":{"rendered":"<h2>Network<\/h2>\n<p>Check listening ports:<\/p>\n<pre>netstat -plnt<\/pre>\n<p>Sniff the network on a port or ip-address:<\/p>\n<pre>tcpdump port &lt;portnr&gt;\ntcpdump src\/dst &lt;ip-addr&gt;<\/pre>\n<p>Check the network performance:<\/p>\n<pre>iftop (-n) (network perfomance)\niftop -bNP -i eth0\nifstat<\/pre>\n<h2>System activity<\/h2>\n<p>Check all processes from a user and press c for the full path names:<\/p>\n<pre>top -u &lt;username&gt;<\/pre>\n<p>Memory:<\/p>\n<pre>vmstat\ncat \/proc\/meminfo<\/pre>\n<p>Hard disks:<\/p>\n<pre>iostat<\/pre>\n<p>Processors:<\/p>\n<pre>lscpu\ncat \/proc\/cpuinfo<\/pre>\n<h2>User activity<\/h2>\n<p>Logged on users:<\/p>\n<pre>w<\/pre>\n<p>Last logged on users:<\/p>\n<pre>last<\/pre>\n<h2>I\/O Performance<\/h2>\n<p>Check what drive you want to monitor:<\/p>\n<pre>lsblk<\/pre>\n<p>Once the drive is know you can start the monitoring, for this you can use iotop or iostat:<\/p>\n<pre>iostat -dxm 5 &lt;device&gt;\niostat -dxm 5 | grep &lt;device&gt;<\/pre>\n<p>These commands will provide extensive information for a specific device. The refresh will be done every 5 seconds, you can increase or decrease this number.<\/p>\n<h2>Processes<\/h2>\n<p>Check the running processes:<\/p>\n<pre>ps -ef<\/pre>\n<p>This command will show a list of information about every process currently running.<\/p>\n<h2>VI<\/h2>\n<table>\n<tbody>\n<tr>\n<th>Command<\/th>\n<th>Result<\/th>\n<\/tr>\n<tr>\n<td>i<\/td>\n<td>Insert text<\/td>\n<\/tr>\n<tr>\n<td>r<\/td>\n<td>Replace character<\/td>\n<\/tr>\n<tr>\n<td>x<\/td>\n<td>Remove character<\/td>\n<\/tr>\n<tr>\n<td>dd<\/td>\n<td>Remove line<\/td>\n<\/tr>\n<tr>\n<td>yy<\/td>\n<td>Copy line<\/td>\n<\/tr>\n<tr>\n<td>p<\/td>\n<td>Paste line<\/td>\n<\/tr>\n<tr>\n<td>V<\/td>\n<td>Virtual select text<\/td>\n<\/tr>\n<tr>\n<td>G<\/td>\n<td>Go to end of file<\/td>\n<\/tr>\n<tr>\n<td>H<\/td>\n<td>Go to start of file<\/td>\n<\/tr>\n<tr>\n<td>ZZ<\/td>\n<td>Save file and exit<\/td>\n<\/tr>\n<tr>\n<td>dw<\/td>\n<td>Remove a word<\/td>\n<\/tr>\n<tr>\n<td>c&lt;number&gt;w<\/td>\n<td>Remove the following x words<\/td>\n<\/tr>\n<tr>\n<td>:q!<\/td>\n<td>Do not save file and exit<\/td>\n<\/tr>\n<tr>\n<td>:g\/^#\/d<\/td>\n<td>Remove all lines starting with a #<\/td>\n<\/tr>\n<tr>\n<td>:s\/&lt;search&gt;\/&lt;replace&gt;\/g<\/td>\n<td>Find\/replace<\/td>\n<\/tr>\n<tr>\n<td>:sort<\/td>\n<td>Sort the selected content<\/td>\n<\/tr>\n<tr>\n<td>:%sort<\/td>\n<td>Sort all the lines alphabetically<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>Network Check listening ports: netstat -plnt Sniff the network on a port or ip-address: tcpdump port &lt;portnr&gt; tcpdump src\/dst &lt;ip-addr&gt; Check the network performance: iftop (-n) (network perfomance) iftop -bNP -i eth0 ifstat System activity Check all processes from a user and press c for the full path names: top -u &lt;username&gt; Memory: vmstat cat &hellip; <a href=\"https:\/\/www.sandynet.nl\/index.php\/2016\/06\/19\/unix-commands\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Unix commands&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-10","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/www.sandynet.nl\/index.php\/wp-json\/wp\/v2\/posts\/10","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sandynet.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sandynet.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sandynet.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sandynet.nl\/index.php\/wp-json\/wp\/v2\/comments?post=10"}],"version-history":[{"count":1,"href":"https:\/\/www.sandynet.nl\/index.php\/wp-json\/wp\/v2\/posts\/10\/revisions"}],"predecessor-version":[{"id":45,"href":"https:\/\/www.sandynet.nl\/index.php\/wp-json\/wp\/v2\/posts\/10\/revisions\/45"}],"wp:attachment":[{"href":"https:\/\/www.sandynet.nl\/index.php\/wp-json\/wp\/v2\/media?parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sandynet.nl\/index.php\/wp-json\/wp\/v2\/categories?post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sandynet.nl\/index.php\/wp-json\/wp\/v2\/tags?post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}