The story of transitioning from Windows to Linux/Unix - thanks to zsh and oh-my-zsh

The story of transitioning from Windows to Linux/Unix - thanks to zsh and oh-my-zsh

Daily short news for you
  • swapy is a library that helps you create drag-and-drop actions to easily swap the positions of components.

    The library supports a wide range of platforms, making it perfect for building something personalized like a user’s Dashboard.

    » Read more
  • After waking up, I saw the news feed flooded with articles about Microsoft rewriting the TypeScript compiler - tsc in Go, achieving performance that is 10 times faster than the current one. Wow!

    But when I saw this news, the question immediately popped into my head: "Why not Rust?" You know, the trend of rewriting everything in Rust is hotter than ever, and it’s not an exaggeration to say that it's sweeping through the rankings of previous legacy tools.

    What’s even more interesting is the choice of Go - which supposedly provides the best performance to date - as they say. Many people expressed disappointment about why it wasn’t C# instead 😆. When something is too famous, everything is scrutinized down to the smallest detail, and not everyone listens to what is said 🥶

    Why Go? #411

    » Read more
  • I read this article Migrating Off Oh-My-Zsh and other recent Yak Shavings - the author essentially states that he has been using Oh-My-Zsh (OMZ) for a long time, but now the game has changed, and there are many more powerful tools that have come out, so he realizes, oh, he doesn't need OMZ as much anymore.

    I also tried to follow along because I find this situation quite similar to the current state. It was surprising to discover something new. I hope to soon write a post about this next migration for my readers 😁

    » Read more

The Problem

Since the ancient times when I first got introduced to computers, I have been taught how to use Windows. Later on in university, apart from Windows, I also got to know about Ubuntu and MacOS as operating systems that developers often use. I still remember the first time I encountered Ubuntu because my laptop had modest specifications and would lag when running Windows, so many people advised me to "install Ubuntu, it'll be smoother." From the very first login, my first impression of Ubuntu wasn't great: the interface was ugly, difficult to use, and it couldn't install as many software as Windows. It even had a Vietnamese input method that didn't work.

After using it for a while, I decided to switch back to Windows and mocked Ubuntu as something both mediocre and worthless, and I never touched it again. Time went on, and I was equipped with a more powerful gaming laptop, with better specifications and of course, running Windows smoothly. At that time, I thought Windows was "cool", it could do anything and everything.

In my third year of university, I started my internship as a Fresher Node.js developer. I installed many tools for Node.js programming, including the Node.js version itself and the code editor VSCode. I thought everything would go smoothly, but the reality turned out to be the opposite. Many incidents occurred that changed my daily habits. Sometimes, I couldn't install packages using npm; it would throw out some incomprehensible errors, or I couldn't run the npm install command every time I reinstalled the entire project. Sometimes, I couldn't start the project or encountered errors when running the run build command... These errors were annoying and it took me quite a long time to find ways to fix them as a clueless person. As a result, my Trainer recommended that I install Linux, specifically Ubuntu, which would have fewer errors.

Fate had its way, and in the end, I had to resort to Ubuntu. I learned about dual booting, which means I could install both Windows and Ubuntu side by side on my machine and use whichever I preferred. I used Ubuntu for work and Windows for home. After a period of using Ubuntu, I grew accustomed to it, despite the initial struggles. I encountered fewer issues that I used to experience with Windows, and I started to find it intriguing. I explored more, such as how to use the Terminal and how to use command lines in programming.

While Windows excels in graphical representation, Ubuntu does the opposite. Almost everything can be done via the Terminal - at least that's what I think. Gradually, I discovered the real power of Ubuntu lies in the command lines; it brings forth a wide array of commands and grants us "supreme" power within the system. Since discovering that, I started using command lines more and "forgot" about Windows for a long time. Even if I used Windows again later on, it didn't feel as familiar as Ubuntu. Perhaps the utility of the command lines made me abandon Windows.

The story didn't end there. In recent years, when I started working and had some money, I dared to invest in a Macbook because I heard people saying that Macbooks offer a beautiful interface "like" Windows and the "powerfulness" of Linux. It turned out to be true; Mac brought in a new experience and I still had a beautiful interface along with the power of command lines. The first thing I did after buying the machine was to install zsh and oh-my-zsh.

Shell, zsh Shell, and oh-my-zsh

When talking about command lines and Terminal, we can't leave out Shell. Shell is a command-line interface program that allows users to interact with a computer's operating system by entering commands and performing tasks through the operating system's command interpreter. Shell also provides an environment for running scripts, command files, and other programs. Terminal serves as software that helps communicate with the Shell.

To put it simply, while common software allows you to perform tasks via their graphical interfaces, Shell allows you to execute commands by typing them. GUI software often consumes a large amount of resources for displaying graphics, but Shell doesn't require those things. However, Shell may not provide the same richness in visual representation.

Shell is a software, so there are many different types of Shell. For example, in Ubuntu, most users use bash by default. For MacOS, they used to use bash as well, but starting from macOS Catalina, they switched to zsh. As for Windows, we have cmd.exe prior to Windows 10, then Microsoft introduced a new Shell called Windows PowerShell with many improvements and powerful features. Moreover, we also have other Shells in Linux/Unix, such as sh, csh, zsh...

So if Windows also has Shell, why did I still use Linux or Unix? Actually, there are many factors that led to this decision, and one of them is that Shells on Linux/Unix are much more powerful compared to Windows. Perhaps it's due to the characteristics of each operating system and the reasons why they became popular. For example, Linux is widely used as a server operating system, so communicating with it often involves using Shell, causing more people to learn Shell on Linux systems, and Shell has developed strongly from there.

Powerful means maximum support in work. Take a simple example, if you frequently work with command lines, what do you want most from tools and Shells? Speed, command recall, syntax highlighting...

I used bash for some time before I found out about zsh. When I first learned how to use Terminal, I only needed to know how to type commands, hit Tab for suggestions, or add some configurations to bash settings to get by. Later on, as the amount of command-line work increased, the number of commands I had to remember also increased, so I needed to find a way to improve my command-line tool in terms of command recall, command memory, and information display...

I didn't find zsh to be much different from bash, which means that while using bash, I could switch to zsh and use it as normal. But the advantage of zsh is truly reflected in its rich selection of plugins. One of them is oh-my-zsh.

Installing oh-my-zsh is very simple; you can just run one command:

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

Or you can refer to the detailed installation instructions at Welcome to Oh My Zsh!.

After installation, you will see a change in the appearance of the Terminal.

And if you move into a directory that contains a git repository, you will notice more apparent changes.

To achieve that, thanks to the git plugin of oh-my-zsh, which has over 275 plugins. If you like any of them or you're using a particular tool, you can enable it by modifying the configuration in the ~/.zshrc file.

$ vi ~/.zshrc

Find the line that contains "plugins=(git)" and add it. For example, I'm using Docker, and I want to enable the docker command reminder plugin, so I modify it to "plugins=(git docker)", save the file, and reload the configuration using the command:

source ~/.zshrc

Then try typing docker service and press Tab, you will see a helpful command reminder.

In addition, there are many other plugins for you to explore. Currently, I'm also using 4 additional plugins to assist with syntax highlighting and command reminders: zsh-autosuggestions, zsh-syntax-highlighting, fast-syntax-highlighting, and zsh-autocomplete. You can refer to the installation guide here.

While zsh-syntax-highlighting and fast-syntax-highlighting provide syntax highlighting, zsh-autosuggestions and zsh-autocomplete offer command suggestion and command auto-completion.

After installing the plugins, basically, we will have a Terminal that is quite different from the "original" one. To fully experience and evaluate its usefulness, I recommend that you try it out yourself.

In addition to the mentioned features, oh-my-zsh also supports themes, aliases (shortened versions of long, complex commands), and many other plugins that you can explore through Google.

Premium
Hello

Me & the desire to "play with words"

Have you tried writing? And then failed or not satisfied? At 2coffee.dev we have had a hard time with writing. Don't be discouraged, because now we have a way to help you. Click to become a member now!

Have you tried writing? And then failed or not satisfied? At 2coffee.dev we have had a hard time with writing. Don't be discouraged, because now we have a way to help you. Click to become a member now!

View all

Subscribe to receive new article notifications

or
* The summary newsletter is sent every 1-2 weeks, cancel anytime.

Comments (1)

Leave a comment...
Avatar
Thọ1 year ago
tôi có nên chuyển từ macos sang ubuntu không?
Reply
Avatar
Xuân Hoài Tống1 year ago
Đó là sở thích cá nhân thôi nếu bạn thích thì có thể chuyển sang không vấn đề gì :D @gif [75Xh6bEVpEleyM237R]