FullStack Labs

Please Upgrade Your Browser.

Unfortunately, Internet Explorer is an outdated browser and we do not currently support it. To have the best browsing experience, please upgrade to Microsoft Edge, Google Chrome or Safari.
Upgrade

Your Terminal is a Powerful Productivity Tool

Written by 
Fabio Posada
,
React Native Developer
Your Terminal is a Powerful Productivity Tool
blog post background
Jira Time Tracking
Must-Have Productivity Tools for Working from Home
Hybrid Business Analyst / Project Manager Role in Agile Software-Development Projects
Node.js Developer Salaries
Comparing Hourly Rates Between Software Consultancies
React Native App Of The Week: Honey

The terminal is an important tool for developers, so in this blog post, we are going to talk about how it can improve your productivity.

When you use the terminal, it allows you to do many complicated things just by typing a few commands. Here are a few of my favorites:

Zsh

Z Shell (Zsh) is a UNIX command interpreter originally written by Paul Falstad. You can find the instructions for the installation here and it works for Linux, Mac, and Windows as well.

There is a popular framework for zsh called oh-my-zsh. Oh My Zsh can help in managing your zsh configuration and comes with a themes repository. By combining this with the preferences of your terminal you can create a beautiful shell to work with. Personally, I like the robbyrussell and agnoster themes; the latter works better using fonts from PowerLine fonts.

Zsh has some interesting features. For example, the autocomplete works for both paths and commands, and it's great when you don't remember exactly how to write them.

screenshot

Zsh + Visual Studio 

If you are using VSCode as your code editor, you can integrate zsh into its features. Just go to Settings and edit the configuration of the terminal inside the features/terminal option.

screenshot

In my case, I use Linux, so my settings look like this:

-- CODE language-bash keep-markup --
"terminal.integrated.automationShell.linux": "/bin/zsh"

	
"terminal.integrated.automationShell.linux": "/bin/zsh"
	

Scripts for common tasks

Let’s say you want to build and deploy a react application and that app will be inside an Nginx web server.

Normally, you would have to do a fresh install of the application, the npm dependencies, build the react app, copy the output of the build into Nginx, and then restart Nginx service. This is a repetitive task that you can eliminate by writing a script.

Let's see how to do it from a script file:

1. Create a file deploy.sh on the root directory

2. Write the commands that you need, for example:

	
#!/bin/bash
npm install
npm run build
cp dist/* /var/www/html
service nginx restart
	

3. Change the file to execute mode:

By default a bash file does not have the execution permission enabled, so we will need to add this permission explicitly.

-- CODE language-bash keep-markup --
chmod u+x ./deploy.sh

4. Execute the file:

-- CODE language-bash keep-markup --
./deploy.sh

And that's it! So, the next time you want to deploy, you just need to execute one file instead of four commands.

Some more useful commands

chmod

Changes the file mode.

-- CODE language-bash keep-markup --
chmod u+x ./deploy.sh

which

If you want to know where is located the executable bin try

-- CODE language-bash keep-markup --
which git
/usr/bin/git

history

Provides you a list of your previous command

	
history
...
1990  neofetch
1991  which ls
1992  which
1993  which git
1994  chmod --help
1995  which git
	

man 

Allows you to see the manual about a command

-- CODE language-bash keep-markup --
man chmod

cp 

Allows you to copy files or directories, in this example, we are copying all files in dist folder to /var/www/html folder.

-- CODE language-bash keep-markup --
cp dist/* /var/www/html

mv 

Allows you to move files or directories, let’s see an example.

-- CODE language-bash keep-markup --
mv file.txt target_directory

cat

If you need to read the content of a file this command is useful

	
cat file.txt
File content
	


I hope this brief overview gives you an idea of the things you can do with your terminal. 

Fabio Posada
Written by
Fabio Posada
Fabio Posada

When I was 22 years old, a developer told me,  "Development is not just code, it's an entire world in your head ready to emerge and create amazing things. It's your mark in the world." I abandoned my degree in design for one in systems engineering and I never looked back. As a Software Engineer, I love the fresh challenges and acquired knowledge that each project brings. I thrive on working on projects that matter in people's lives; currently, I'm writing the code to manage Philips's ultrasound technology. I'm most at home using React and other JavaScript frameworks for their ability to seemingly do anything. When I'm not programming, I enjoy playing videogames, watching soccer, and playing with my son.

FullStack Labs Icon

Let's Talk!

We’d love to learn more about your project. Contact us below for a free consultation with our CEO.
Projects start at $50,000.

company name
name
email
phone
Type of project
Reason for contact
How did you hear about us?
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.