Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794
{"id":2485,"date":"2019-12-06T00:25:41","date_gmt":"2019-12-06T00:25:41","guid":{"rendered":"https:\/\/support.aklwebhost.com\/?post_type=manual_kb&p=2485"},"modified":"2019-12-14T19:15:27","modified_gmt":"2019-12-14T19:15:27","slug":"boost-productivity-with-z-and-zsh-on-ubuntu","status":"publish","type":"manual_kb","link":"https:\/\/support.aklwebhost.com\/knowledgebase\/boost-productivity-with-z-and-zsh-on-ubuntu\/","title":{"rendered":"Boost Productivity with Z and Zsh on Ubuntu"},"content":{"rendered":"

Introduction<\/strong><\/h2>\n

Working on Linux systems means that one is using the command line more often than not. Having to type long directory names over and over as well as\u00a0guessing command<\/strong>\u00a0names eats up valuable time. This can add up very quickly.\u00a0Z<\/strong>\u00a0is a tool that records every directory you browse and compiles a weighted list of the most\u00a0frequent\/recently<\/strong>\u00a0used ones.\u00a0Zsh<\/strong>\u00a0is an alternative to bash (the default shell that come with most Linux distros) that adds subtle improvements like spelling correction of words\/commands and better tab-completion.<\/p>\n

Setup & Installation<\/strong><\/h2>\n

Spin-up for AKLWEB Host Server or VPS<\/strong>\u00a0with running Ubuntu\u00a0(either version 12,14 or 16)<\/strong>\u00a0and follow the steps below to add a\u00a0new admin (sudo) user<\/strong>. We’re doing this because it is along the lines of\u00a0best practices<\/strong>\u00a0to create a new user and assign it admin rights to access the server, rather than use the root user.<\/p>\n

    \n
  1. Connect to your Server<\/strong>\u00a0ssh\u00a0root@[akl-web-host-server-ip-address]<\/code>.<\/li>\n
  2. Add a new user<\/strong>\u00a0adduser <newuser><\/code>\u00a0(you will need to answer some prompt questions after issuing this command).<\/li>\n
  3. Make the new user an admin user<\/strong>\u00a0adduser <newuser> sudo<\/code>.<\/li>\n
  4. Disconnect from the server<\/strong>\u00a0exit<\/code>.<\/li>\n
  5. Reconnect to server, but this time as the new user<\/strong>\u00a0ssh <newuser>@[akl-web-host-server-ip-address]<\/code>.<\/li>\n<\/ol>\n

    Installing and Using Z<\/strong><\/h3>\n

    You should be in your home directory after you logon as\u00a0“newuser”<\/strong>\u00a0(otherwise, run\u00a0cd ~<\/code>). Follow the next set of\u00a0steps to install Z<\/strong>. Note that\u00a0since Z<\/strong>\u00a0is a script, what we do is download it to our home directory and tell our default shell to run Z anytime it starts.<\/p>\n

      \n
    1. Download<\/strong>\u00a0wget https:\/\/raw.githubusercontent.com\/rupa\/z\/master\/z.sh<\/code>.<\/li>\n
    2. Install<\/strong>\u00a0printf \"\\n\\n#initialize Z (https:\/\/github.com\/rupa\/z) \\n. ~\/z.sh \\n\\n\" >> .bashrc<\/code>.\u00a0This command appends<\/strong>\u00a0. ~\/z.sh<\/code>\u00a0to your\u00a0.bashrc<\/code>\u00a0file, which in turn tells it to run Z upon start-up.<\/li>\n
    3. Reload<\/strong>\u00a0shell\u00a0source ~\/.bashrc<\/code>.<\/li>\n<\/ol>\n

      To test how Z works, browse to these directories:<\/strong><\/p>\n

      cd \/etc\/systemd\/system\r\ncd \/usr\/share\/nano\r\ncd \/etc\/kernel\/postinst.d\r\ncd ~\r\n<\/code><\/pre>\n

      Now, from your terminal, type in\u00a0z sys<\/code>\u00a0and\u00a0push the tab button<\/strong>, then enter. Next, type\u00a0z nano<\/code>\u00a0and hit the tab button, then enter again. You will see in both cases that Z automatically knew to\u00a0cd<\/code>\u00a0into the first and\u00a0second directories<\/strong>\u00a0where we initially browsed.<\/p>\n

      Installing and Using Zsh<\/strong><\/h3>\n
        \n
      1. Install<\/strong>\u00a0sudo apt-get update && sudo apt-get -y install zsh<\/code>.<\/li>\n
      2. Check version to verify installation<\/strong>\u00a0zsh --version<\/code>.<\/li>\n
      3. Make Zsh your default shell<\/strong>\u00a0chsh -s \/bin\/zsh<\/code>. You will be prompted to enter your password.<\/li>\n
      4. Logout<\/strong>\u00a0exit<\/code>.<\/li>\n
      5. Log back into the system<\/strong>\u00a0ssh <newuser>@[akl-web-host-server-ip-address]<\/code>.<\/li>\n<\/ol>\n

        If you are\u00a0greeted with a Zsh shell configuration prompt<\/strong>, select\u00a0“2”<\/strong>\u00a0to accept default settings.<\/p>\n

        To test things out, type\u00a0cd \/emc<\/code>\u00a0and push the tab button.\u00a0Zsh will auto-complete terminal<\/strong>\u00a0to\u00a0cd \/etc<\/code>\u00a0because a\u00a0\/emc<\/code>\u00a0directory does not exist and\u00a0\/etc<\/code>\u00a0is the closest option as to what was intended. Next, type “kill<\/code>\u00a0” and push the tab button (there is a space after\u00a0kill<\/code>). Zsh will automatically show you a list or processes to kill as oppose to doing nothing.<\/p>\n

        Zsh also shares your terminal history<\/strong>\u00a0across multiple windows\/sessions, and has tons of other useful features. There are also\u00a0frameworks built on top of Zsh<\/strong>\u00a0that even add more dazzling features to it, such as\u00a0oh-my-zsh<\/span><\/a><\/strong>\u00a0and\u00a0prezto<\/span><\/a><\/strong>.<\/p>\n

        Using Z with Zsh<\/strong><\/h3>\n
          \n
        1. Run<\/strong>\u00a0printf \"\\n\\n#initialize Z (https:\/\/github.com\/rupa\/z) \\n. ~\/z.sh \\n\\n\" >> .zshrc<\/code>.\u00a0This command appends<\/strong>\u00a0. ~\/z.sh<\/code>\u00a0to\u00a0.zshrc<\/code>\u00a0file, which tells it to run Z on start-up.<\/li>\n
        2. Reload shell<\/strong>\u00a0source ~\/.zshrc<\/code>.<\/li>\n<\/ol>\n

          Note:\u00a0If you do not like the default settings, you can update the Zsh shell configuration by editing the\u00a0.zshrc<\/code>\u00a0file (in your home directory), or by running the following commands:<\/p>\n

          autoload -U zsh-newuser-install\r\nzsh-newuser-install -f\r\n<\/code><\/pre>\n

          Conclusion<\/strong><\/h2>\n

          Z and Zsh are useful tools that may drastically help increase your productivity.<\/strong><\/p>\n

          Other Versions<\/h3>\n

          CentOS<\/a><\/strong><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","manualknowledgebasecat":[247],"manual_kb_tag":[312],"_links":{"self":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2485"}],"collection":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/comments?post=2485"}],"version-history":[{"count":2,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2485\/revisions"}],"predecessor-version":[{"id":2766,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2485\/revisions\/2766"}],"wp:attachment":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/media?parent=2485"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manualknowledgebasecat?post=2485"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb_tag?post=2485"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}