{"id":1453,"date":"2022-11-27T11:28:05","date_gmt":"2022-11-27T17:28:05","guid":{"rendered":"https:\/\/raffy.ch\/blog\/?p=1453"},"modified":"2023-01-19T12:57:49","modified_gmt":"2023-01-19T18:57:49","slug":"nix-command-line-foo","status":"publish","type":"post","link":"https:\/\/raffy.ch\/blog\/2022\/11\/27\/nix-command-line-foo\/","title":{"rendered":"*NIX Command Line Foo"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Well, not one of my normal blog posts, but I hope some of you geeks out there will find this useful anyways. I will definitely use this post as a reference frequently.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I have been using various flavors of UNIX and their command lines from ksh to bash and zsh for over 25 years and there is always something new to learn to make me faster at the jobs I am doing. One tool that I keep using (despite my growing command of Excel), is <a href=\"http:\/\/vim.org\">VIM<\/a> coupled with UNIX command line tools. It saves me hours and hours of work all the time. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Well, here are some new things I learned and want to remember from the Well, here are some new things I learned and want to remember from the <a href=\"https:\/\/github.com\/jlevy\/the-art-of-command-line\">art of command line<\/a> github repo:<\/p>\n\n\n\n<ul><li><code>CTRL-W<\/code> on the command line deletes the last word<\/li>\n<li><code>pgrep<\/code> to search for processes rather than doing the longer version with awk<\/li>\n<li><code>lsof -iTCP -sTCP:LISTEN -P -n<\/code> processes listening on TCP ports<\/li>\n<li>Diff two json files: <code>diff &lt;(jq --sort-keys . &lt; file1.json) &lt;(jq --sort-keys . &lt; file2.json) | colordiff | less -R<\/code><\/li>\n<li>I totally forgot about <code><a href=\"https:\/\/github.com\/wireservice\/csvkit\">csvkit<\/a><\/code> &#8211; <code>brew install csvkit<\/code><\/li>\n<li><ul><li><code>in2csv file1.xls &gt; file1.csv<\/code><\/li>\n<li><code>csvstat data.csv<\/code><\/li>\n<li><code>csvsql --query \"select name from data where age &gt; 30\" data.csv &gt; old.csv<\/code><\/li>\n<\/ul>\n<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">I just found some additional command son OSX that I wish I had known earlier:<\/p>\n\n\n\n<ul><li><code>ditto<\/code> copies one or more source files or directories to a destination directory.  If the destination directory does not exist it will be created before the first source is copied.  If the destination directory already exists then the source directories are merged with the previous contents of the destination.<\/li>\n<li><code>pbcopy<\/code> past data from command line into the clipboard<\/li>\n<li><code>qlmanage<\/code> quick view from the command line<\/li>\n<\/ul>\n\n\n\n\n<p class=\"wp-block-paragraph\">This is a great repo as well for great <a href=\"https:\/\/git.herrbischoff.com\/awesome-macos-command-line\/about\/\">OSX commands.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Well, not one of my normal blog posts, but I hope some of you geeks out there will find this useful anyways. I will definitely use this post as a reference frequently. I have been using various flavors of UNIX and their command lines from ksh to bash and zsh for over 25 years and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,5],"tags":[],"class_list":["post-1453","post","type-post","status-publish","format-standard","hentry","category-uncategorized","category-unix-scripting"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/posts\/1453","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/comments?post=1453"}],"version-history":[{"count":9,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/posts\/1453\/revisions"}],"predecessor-version":[{"id":1465,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/posts\/1453\/revisions\/1465"}],"wp:attachment":[{"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/media?parent=1453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/categories?post=1453"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/raffy.ch\/blog\/wp-json\/wp\/v2\/tags?post=1453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}