Google Chrome Alias Mac



My shell means everything to me. It is the first program I start in the morning and the last one I close in the evening. It is the program that I regularly tweak to boost my overall productivity. From my perspective, Microsoft’s release of Windows Terminal 1.0 and WSL 2.0 will boost overall Shell adoption. Over the past decade, I have seen numerous users installing and using different shells. However, the number of people that invest time in configuring their shell to be more productive is just a small percentage. And that is a shame!

Google

You can also stick with tools like Finder or Windows Explorer if you install and use a shell without customizing it. Shells like ZSH shine once they have individual configurations: configurations that make you - the user - super productive. I wrote this article for inspiration. It should demonstrate how you can increase your overall productivity with simple things like adopting the 5 types of aliases in ZSH. Aliases are the first step towards a tailored shell experience. Aliases are a super individual thing.

I use Docker, Kubernetes, and Microsoft Azure every day. That said, it makes sense for me to have aliases supporting me with these tools and environments. However, maybe you are using different clouds and command-line tools so that you will end up with different aliases. The key takeaway should be that you create and use aliases to help you get your job done.

When the.bashprofile or.zshrc file is created you are ready to enter your alias commands. So here I am using the alias ‘l’ to alias the command ‘ls -lah’ alias l='ls -lah' In nano ‘control+o’ to write the file out and ‘control+x’ to exit the file. Refresh the shell environment by entering the command below: source /.bash. With suffix aliases, you can launch files with a specific extension (or suffix) in your favorite tool. To register a suffix alias, we use the alias -s extension=name-of-the-tool pattern. The following samples assume that VisualStudio Code is installed and can be launched using the code command from the terminal.

. 1.0.4 – Released Jan 3, 2021 Safari version for macOS now supports both Apple Silicon (M1 Chip) and Intel-based Mac computers. Added a copy to clipboard prompt after adding a new alias. 1.0.3 – Released Dec 9, 2020 Supports custom domains, usernames, triggering digests and now includes filtering for aliases. Run Headless Chrome From the Command Line. Running Headless Chrome from the command line is relatively easy. On a Mac, you can set an alias for Chrome and run using the —headless command line.

All your aliases are defined in ~/.zshrc. ZSH loads the configuration file during startup. However, you can always force to reload your configuration file use source ~/.zshrc.

This article will teach you how to create and use these five types of aliases:

Simple Aliases

Simple Aliases are a good starting point. I use them to reduce the number of keystrokes to fire up a command. The definition of a simple alias uses the alias my-alias='command' pattern.

Having those aliases registered in my ~/.zshrc, I can navigate quickly to commonly used directories and to fire-up commands that I use frequently using just a few keystrokes.

Suffix Aliases

Suffix Aliases are defined using the -s flag. With suffix aliases, you can launch files with a specific extension (or suffix) in your favorite tool. To register a suffix alias, we use the alias -s extension=name-of-the-tool pattern. The following samples assume that VisualStudio Code is installed and can be launched using the code command from the terminal.

Load the modified ~/.zshrc and execute the following:

The suffix alias translates sample.md into code sample.md, and you should see VisualStudio Code launching and showing the content of sample.md.

Functions for Aliases With Parameters

Sometimes you want to create aliases that require some contextual information. Parameters are used to describe this contextual information for shell commands. The registration of aliases with parameters looks pretty similar to a function definition in regular programming languages. We use the following pattern to define aliases with parameters:

For example, consider you want to optimize the process of listing Azure Kubernetes Service (AKS) instances in your Azure Subscription. To achieve this, Azure CLI provides the az aks list command. The command allows further configuration by adding several parameters.

The following alias accepts two parameters—first, the Resource Group Name (Resource Groups are logical containers in Azure). The second parameter specifies the desired output format.

We can now use the getaks alias with parameters to look for AKS instances in resource-group-1 and print results in colored JSON (jsonc) using getaks resource-group-1 jsonc.

Global Aliases

Google Chrome Alias Mac Terminal

Global aliases are defined using the -g flag. A global alias is aggressive. Once registered, it replaces all occurrences of the alias name with the specified command. The definition follows the pattern alias -g aliasName='command'.

Google chrome mac version

Having qId registered as a global alias, I can optimize my performance when asking for unique resource identifiers using Azure CLI. See the following snippet comparing the regular command, to the optimized one using my global alias:

Operating system specific aliases

An operating system specific alias is not a real type. However, I think platform-specific aliases are important—especially when using multiple platforms. I use macOS as a daily driver, so I also have some aliases tied to my rig.

Make Alias Mac

However, I love VisualStudio Codespaces that are using Linux as an operating system. In both situations, I want to use my dotfiles. To achieve this, I use simple if-statements.

Google Chrome Alias Mac

See the following image showing all my platform related aliases for macOS:

Google Chrome Alias Mac Terminal

Use Aliases To Edit and Reload .zshrc

I have two aliases in my ~/.zshrc, which are super-efficient. I open my ~/.zshrc in my favorite editor with ec and source it (apply the current state of ~/.zshrc to your ZSH session) with sc. The alias definition for both looks like this:

Conclusion

You have seen five different types of ZSH aliases (counting os-specific aliases as dedicated type) that will boost your productivity. Foud different types of aliases used to achieve almost everything in your shell.

Take your time. Do some research. Identify the command-line tools you are using daily or regularly, find patterns, and create corresponding aliases that increase your productivity by reducing keystrokes.

Having powerful shells on all operating systems (finally including windows using WSL 2.0), you should care about your shell performance. Make ZSH your own.

I do a lot of conference speaking; if you are presenting at conferences or meetups too, you should start your presentation by quickly explaining the aliases you will use throughout the talk to onboard your audience. Maybe they are using kc instead of k for kubectl. 😂

Update Google Chrome Mac

Special thanks to Sundeep Agarwal for pointing me to some typos and to simohamed for the tip regarding bulk association for suffix aliases.