{"id":1962,"date":"2016-09-03T19:02:53","date_gmt":"2016-09-04T03:02:53","guid":{"rendered":"http:\/\/systemsolver.com\/StatlerBlog\/?p=1962"},"modified":"2016-09-03T19:02:53","modified_gmt":"2016-09-04T03:02:53","slug":"misc-notes-mostly-linux","status":"publish","type":"post","link":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/2016\/09\/03\/misc-notes-mostly-linux\/","title":{"rendered":"Misc notes &#8212; mostly linux"},"content":{"rendered":"<p>A variety of links and ideas<\/p>\n<hr style=\"color: black ! important;\" data-blkn-colour=\"rgba(128,128,128,1)\" \/>\n<h3><strong>Shutdown slow with Samba\/Windows shares in Linux<\/strong><\/h3>\n<p><a href=\"http:\/\/techdelirium.blogspot.com\/2015\/11\/slow-shutdownreboot-when-mounting.html\">http:\/\/techdelirium.blogspot.com\/2015\/11\/slow-shutdownreboot-when-mounting.html<\/a><\/p>\n<blockquote>\n<blockquote><p>sudo ln -s \/etc\/init.d\/umountnfs.sh \/etc\/rc0.d\/K14umountnfs.sh<\/p><\/blockquote>\n<blockquote><p>sudo ln -s \/etc\/init.d\/umountnfs.sh \/etc\/rc6.d\/K14umountnfs.sh<\/p><\/blockquote>\n<\/blockquote>\n<hr style=\"color: black ! important;\" data-blkn-colour=\"rgba(128,128,128,1)\" \/>\n<h3>Linux bash script &#8211; Windows batch script links<\/h3>\n<p><a href=\"http:\/\/www.dostips.com\/DtTipsStringManipulation.php\">http:\/\/www.dostips.com\/DtTipsStringManipulation.php<\/a><\/p>\n<table class=\"menu\" border=\"3\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td class=\"title\" style=\"height: 24px;\"><\/td>\n<td class=\"title\" style=\"height: 24px;\"><a href=\"http:\/\/www.dostips.com\/DtTipsStringManipulation.php#Snippets.AlignRight\">Align Right<\/a><\/td>\n<td class=\"text\" style=\"height: 24px;\">Align text to the right i.e. to improve readability of number columns.<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td class=\"title\" style=\"height: 24px;\"><\/td>\n<td class=\"title\" style=\"height: 24px;\"><a href=\"http:\/\/www.dostips.com\/DtTipsStringManipulation.php#Snippets.LeftString\">Left String<\/a><\/td>\n<td class=\"text\" style=\"height: 24px;\">Extract characters from the beginning of a string.<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td class=\"title\" style=\"height: 24px;\"><\/td>\n<td class=\"title\" style=\"height: 24px;\"><a href=\"http:\/\/www.dostips.com\/DtTipsStringManipulation.php#Snippets.MapLookup\">Map and Lookup<\/a><\/td>\n<td class=\"text\" style=\"height: 24px;\">Use Key-Value pair list to lookup and translate values.<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td class=\"title\" style=\"height: 24px;\"><\/td>\n<td class=\"title\" style=\"height: 24px;\"><a href=\"http:\/\/www.dostips.com\/DtTipsStringManipulation.php#Snippets.MidString\">Mid String<\/a><\/td>\n<td class=\"text\" style=\"height: 24px;\">Extract a Substring by Position.<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td class=\"title\" style=\"height: 24px;\"><\/td>\n<td class=\"title\" style=\"height: 24px;\"><a href=\"http:\/\/www.dostips.com\/DtTipsStringManipulation.php#Snippets.Remove\">Remove<\/a><\/td>\n<td class=\"text\" style=\"height: 24px;\">Remove a substring using string substitution.<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td class=\"title\" style=\"height: 24px;\"><\/td>\n<td class=\"title\" style=\"height: 24px;\"><a href=\"http:\/\/www.dostips.com\/DtTipsStringManipulation.php#Snippets.RemoveBothEnds\">Remove both Ends<\/a><\/td>\n<td class=\"text\" style=\"height: 24px;\">Remove the first and the last character of a string.<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td class=\"title\" style=\"height: 24px;\"><\/td>\n<td class=\"title\" style=\"height: 24px;\"><a href=\"http:\/\/www.dostips.com\/DtTipsStringManipulation.php#Snippets.RemoveSpaces\">Remove Spaces<\/a><\/td>\n<td class=\"text\" style=\"height: 24px;\">Remove all spaces in a string via substitution.<\/td>\n<\/tr>\n<tr style=\"height: 24.0333px;\">\n<td class=\"title\" style=\"height: 24.0333px;\"><\/td>\n<td class=\"title\" style=\"height: 24.0333px;\"><a href=\"http:\/\/www.dostips.com\/DtTipsStringManipulation.php#Snippets.Replace\">Replace<\/a><\/td>\n<td class=\"text\" style=\"height: 24.0333px;\">Replace a substring using string substitution.<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td class=\"title\" style=\"height: 24px;\"><\/td>\n<td class=\"title\" style=\"height: 24px;\"><a href=\"http:\/\/www.dostips.com\/DtTipsStringManipulation.php#Snippets.RightString\">Right String<\/a><\/td>\n<td class=\"text\" style=\"height: 24px;\">Extract characters from the end of a string.<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td class=\"title\" style=\"height: 24px;\"><\/td>\n<td class=\"title\" style=\"height: 24px;\"><a href=\"http:\/\/www.dostips.com\/DtTipsStringManipulation.php#Snippets.SplitString\">Split String<\/a><\/td>\n<td class=\"text\" style=\"height: 24px;\">Split a String, Extract Substrings by Delimiters.<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td class=\"title\" style=\"height: 24px;\"><\/td>\n<td class=\"title\" style=\"height: 24px;\"><a href=\"http:\/\/www.dostips.com\/DtTipsStringManipulation.php#Snippets.StringConcatenation\">String Concatenation<\/a><\/td>\n<td class=\"text\" style=\"height: 24px;\">Add one string to another string.<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td class=\"title\" style=\"height: 24px;\"><\/td>\n<td class=\"title\" style=\"height: 24px;\"><a href=\"http:\/\/www.dostips.com\/DtTipsStringManipulation.php#Snippets.TrimLeftFOR\">Trim Left<\/a><\/td>\n<td class=\"text\" style=\"height: 24px;\">Trim spaces from the beginning of a string via &#8220;FOR&#8221; command.<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td class=\"title\" style=\"height: 24px;\"><\/td>\n<td class=\"title\" style=\"height: 24px;\"><a href=\"http:\/\/www.dostips.com\/DtTipsStringManipulation.php#Snippets.TrimQuotes\">Trim Quotes<\/a><\/td>\n<td class=\"text\" style=\"height: 24px;\">Remove surrounding quotes via FOR command.<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td class=\"title\" style=\"height: 24px;\"><\/td>\n<td class=\"title\" style=\"height: 24px;\"><a href=\"http:\/\/www.dostips.com\/DtTipsStringManipulation.php#Snippets.TrimRightFOR\">Trim Right<\/a><\/td>\n<td class=\"text\" style=\"height: 24px;\">Trim spaces from the end of a string via &#8220;FOR&#8221; command.<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td class=\"title\" style=\"height: 24px;\"><\/td>\n<td class=\"title\" style=\"height: 24px;\"><a href=\"http:\/\/www.dostips.com\/DtTipsStringManipulation.php#Snippets.TrimRightSubst\">Trim Right<\/a><\/td>\n<td class=\"text\" style=\"height: 24px;\">Trim spaces from the end of a string via substitution.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<hr style=\"color: black ! important;\" data-blkn-colour=\"rgba(128,128,128,1)\" \/>\n<h3>\u00a0<strong>OCR in linux<br \/>\n<\/strong><\/h3>\n<p><a href=\"https:\/\/help.ubuntu.com\/community\/OCR\">https:\/\/help.ubuntu.com\/community\/OCR<\/a><\/p>\n<hr style=\"color: black ! important;\" data-blkn-colour=\"rgba(128,128,128,1)\" \/>\n<h3>D\u00e9j\u00e0 Dup instead of Lucky Backup<\/h3>\n<p><a href=\"https:\/\/www.linux.com\/learn\/total-system-backup-and-recall-deja-dup\">https:\/\/www.linux.com\/learn\/total-system-backup-and-recall-deja-dup<\/a><\/p>\n<hr style=\"color: black ! important;\" data-blkn-colour=\"rgba(128,128,128,1)\" \/>\n<h3>Monitor linux disk usage, send email<\/h3>\n<p><a href=\"https:\/\/www.linux.com\/learn\/customized-file-monitoring-auditd\">https:\/\/www.linux.com\/learn\/customized-file-monitoring-auditd<\/a><\/p>\n<p><a href=\"https:\/\/www.linux.com\/blog\/linux-shell-script-monitor-space-usage-and-send-email\">https:\/\/www.linux.com\/blog\/linux-shell-script-monitor-space-usage-and-send-email<\/a><\/p>\n<hr style=\"color: black ! important;\" data-blkn-colour=\"rgba(128,128,128,1)\" \/>\n<h3>Bluetooth headset controls<\/h3>\n<p><a href=\"https:\/\/wiki.archlinux.org\/index.php\/X_KeyBoard_extension#Multiple_keyboards\">https:\/\/wiki.archlinux.org\/index.php\/X_KeyBoard_extension#Multiple_keyboards<\/a><\/p>\n<p><a href=\"https:\/\/bugs.freedesktop.org\/show_bug.cgi?id=53907\">https:\/\/bugs.freedesktop.org\/show_bug.cgi?id=53907<\/a><\/p>\n<hr style=\"color: black ! important;\" data-blkn-colour=\"rgba(128,128,128,1)\" \/>\n<h3>Quick backup of linux?<\/h3>\n<p><a href=\"http:\/\/manpages.ubuntu.com\/manpages\/trusty\/man8\/dump.8.html\">http:\/\/manpages.ubuntu.com\/manpages\/trusty\/man8\/dump.8.html<\/a><br \/>\nDump examines files on an ext2\/3\/4 filesystem and determines which<br \/>\nfiles need to be backed up.<\/p>\n<hr style=\"color: black ! important;\" data-blkn-colour=\"rgba(128,128,128,1)\" \/>\n<h3>Create a live cd of the installed Linux system<\/h3>\n<p><a href=\"https:\/\/sourceforge.net\/projects\/pinguy-os\/files\/ISO_Builder\/\">https:\/\/sourceforge.net\/projects\/pinguy-os\/files\/ISO_Builder\/<\/a><\/p>\n<hr style=\"color: black ! important;\" data-blkn-colour=\"rgba(128,128,128,1)\" \/>\n<h3>Systemd service after network is connected<\/h3>\n<p>Sometimes the service is wireless, so connection doesn&#8217;t happen until a user logs in.<\/p>\n<p>Try this (not tested yet)<\/p>\n<pre><code>[Unit]\nDescription=start script\n\n[Service]\nType=idle\nExecStart=\/script\/location\/name\nRestart=always\nRestartSec=30\n\n[Install]\nWantedBy=network-online.target<\/code><\/pre>\n<hr style=\"color: black ! important;\" data-blkn-colour=\"rgba(128,128,128,1)\" \/>\n<h3>Find command<\/h3>\n<p><a href=\"http:\/\/www.binarytides.com\/linux-find-command-examples\/\">http:\/\/www.binarytides.com\/linux-find-command-examples\/<\/a><\/p>\n<hr style=\"color: black ! important;\" data-blkn-colour=\"rgba(128,128,128,1)\" \/>\n<h3>Linux bluetooth headset<\/h3>\n<p>The headsets send info as sound input, sound mic, keyboard and mouse.<\/p>\n<p>Check what happens when the hangup button is pushed, maybe use automation to make it click Zoiper voip softphone<\/p>\n<hr style=\"color: black ! important;\" data-blkn-colour=\"rgba(128,128,128,1)\" \/>\n<h3>List linux packages by date installed<\/h3>\n<p><a href=\"https:\/\/help.ubuntu.com\/community\/ListInstalledPackagesByDate\">https:\/\/help.ubuntu.com\/community\/ListInstalledPackagesByDate<\/a><\/p>\n<hr style=\"color: black ! important;\" data-blkn-colour=\"rgba(128,128,128,1)\" \/>\n<h3>Systemd information<\/h3>\n<p><a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-use-systemctl-to-manage-systemd-services-and-units\">https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-use-systemctl-to-manage-systemd-services-and-units<\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/wiki.archlinux.org\/index.php\/systemd\">https:\/\/wiki.archlinux.org\/index.php\/systemd<\/a><\/p>\n<p>Run script right before shutdown<br \/>\n<a href=\"http:\/\/unix.stackexchange.com\/questions\/39226\/how-to-run-a-script-with-systemd-right-before-shutdown?noredirect=1&amp;lq=1\">http:\/\/unix.stackexchange.com\/questions\/39226\/how-to-run-a-script-with-systemd-right-before-shutdown?noredirect=1&amp;lq=1<\/a><\/p>\n<p style=\"padding-left: 30px;\">[Unit]<br \/>\nDescription=Log Traffic<br \/>\nDefaultDependencies=no<br \/>\nBefore=shutdown.target reboot.target halt.target<\/p>\n<p style=\"padding-left: 30px;\">[Service]<br \/>\nExecStart=\/usr\/local\/bin\/perl \/home\/me\/log_traffic.pl &#8211;stop<br \/>\nType=oneshot<\/p>\n<p>CIFS shutdown problems<\/p>\n<p style=\"padding-left: 30px;\">test by mounting local windows share<\/p>\n<p style=\"padding-left: 30px;\">try to shut down nrservice before closing down &#8212; didn&#8217;t help<\/p>\n<p style=\"padding-left: 30px;\">use oneshot to umount?<\/p>\n<p style=\"padding-left: 30px;\">run umount before shutdown.target reboot.target halt.target?<\/p>\n<hr style=\"color: black ! important;\" data-blkn-colour=\"rgba(128,128,128,1)\" \/>\n<h3>Automate what is seen on screen<\/h3>\n<p><a href=\"http:\/\/www.sikuli.org\/\">http:\/\/www.sikuli.org\/<\/a><br \/>\nSikuli automates anything you see on the screen. It uses image recognition to identify and control GUI components. It is useful when there is no easy access to a GUI&#8217;s internal or source code.<\/p>\n<p><a href=\"http:\/\/alternativeto.net\/software\/xdotool\/?platform=linux\">\u00a0http:\/\/alternativeto.net\/software\/xdotool\/?platform=linux<\/a><br \/>\n<span class=\"item-desc\">This tool lets you simulate keyboard input and mouse activity, move and resize windows, etc. It does this using X11&#8217;s XTEST extension and other Xlib functions.<\/span><\/p>\n<p><a href=\"https:\/\/github.com\/guoci\/autokey-py3\">https:\/\/github.com\/guoci\/autokey-py3<\/a><br \/>\nAutoKey-Py3 (GitHub) is a Python 3 port of AutoKey, a desktop automation utility for Linux and X11.<br \/>\nClick on or move pointer to an area that can be identified with an image<\/p>\n<hr style=\"color: black ! important;\" data-blkn-colour=\"rgba(128,128,128,1)\" \/>\n<h3>Linux containters (like vms)<\/h3>\n<p><a href=\"https:\/\/linuxcontainers.org\/\">https:\/\/linuxcontainers.org\/<\/a><\/p>\n<hr style=\"color: black ! important;\" data-blkn-colour=\"rgba(128,128,128,1)\" \/>\n<h3>Hide command screens that must run in the background<\/h3>\n<p><a href=\"http:\/\/www.linuxdevcenter.com\/cmd\/cmd.csp?path=s\/screen\">http:\/\/www.linuxdevcenter.com\/cmd\/cmd.csp?path=s\/screen<\/a><\/p>\n<p><code>sudo apt-get install screen<\/code><\/p>\n<p>create a script shrewsoft-ikec.sh that will start an ikec command with a screen name of shrew.<br \/>\nThis will hide the ensuing command window ikec creates while keeping the program running at low cpu.<\/p>\n<pre><code>#!\/bin\/bash\nscreen -dmS shrew \/user\/bin\/ikec -r bcws -a\nsleep 2s\nscreen -d shrew<\/code><\/pre>\n<p>Create Startup Application named a.shrew to run script at login<\/p>\n<p>To kill the screen create above by name<\/p>\n<p><code>screen -X -S shrew kill<\/code><\/p>\n<p>To get ikec running iked has to be started first and if there is a problem it has to be killed and restarted before ikec is restarted<\/p>\n<p><code>sudo iked<\/code><\/p>\n<p>To run iked with systemd, create the following in \/etc\/systemd\/system<\/p>\n<p>iked.service<\/p>\n<p><code>[Unit]<br \/>\nDescription=Shrew VPN client<\/code><\/p>\n<p>[Service]<br \/>\nExecStart=\/usr\/sbin\/iked<br \/>\nTimeoutSec=0 StandardOutput=tty<br \/>\nRemainAfterExit=yes<br \/>\nSysVStartPriority=99<\/p>\n<p>[Install] WantedBy=multi-user.target<\/p>\n<p>&nbsp;<\/p>\n<p>Run<\/p>\n<p><code>sudo systemctl start iked.service<br \/>\nsudo systemctl enable iked.service<\/code><\/p>\n<p>To kill the iked or ikec process<\/p>\n<pre><code>killall -9 ikec<\/code><\/pre>\n<hr style=\"color: black ! important;\" data-blkn-colour=\"rgba(128,128,128,1)\" \/>\n<h3>Test network information<\/h3>\n<p>View most cpu intensive processes<\/p>\n<p>top<\/p>\n<p>View<\/p>\n<p>Get route info for specific ip address<\/p>\n<p>ip route get xxx.xxx.xxx.xxx<\/p>\n<p>Get route info for all ip connections<\/p>\n<p>route -e<\/p>\n<p>display process info for name<\/p>\n<p>ps -ef | grep processname<\/p>\n<p>check if ip exists with a specific<\/p>\n<p>ip route get 10.141.229.1 | grep &#8221; tap&#8221; &amp;&gt; \/dev\/null; if [ $? == 0 ]; then echo &#8220;tap0&#8221;; else echo &#8220;not tap0&#8221;; fi<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A variety of links and ideas Shutdown slow with Samba\/Windows shares in Linux http:\/\/techdelirium.blogspot.com\/2015\/11\/slow-shutdownreboot-when-mounting.html sudo ln -s \/etc\/init.d\/umountnfs.sh \/etc\/rc0.d\/K14umountnfs.sh sudo ln -s \/etc\/init.d\/umountnfs.sh \/etc\/rc6.d\/K14umountnfs.sh Linux bash script &#8211; Windows batch script links http:\/\/www.dostips.com\/DtTipsStringManipulation.php Align Right Align text to the right i.e. to improve readability of number columns. Left String Extract characters from the beginning of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1962","post","type-post","status-publish","format-standard","hentry","category-general"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/posts\/1962","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/comments?post=1962"}],"version-history":[{"count":0,"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/posts\/1962\/revisions"}],"wp:attachment":[{"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/media?parent=1962"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/categories?post=1962"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/systemsolver.goodhealthyday.com\/StatlerBlog\/wp-json\/wp\/v2\/tags?post=1962"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}