Skip to main content

16 posts tagged with "linux"

View All Tags

How to install Oh-My-ZSH

5 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

How to install Oh-My-ZSH

ZSH is a powerful alternative to Linux Bash offering a lot of features like auto-completion (I like this so much), plugins and even themes.

The idea here is to empower your Linux console, both the command line like, f.i. new aliases out-of-the-box and make the look and feel even better.

I've chosen Oh My ZSH since years, let's see how to install it followed by a discovering some features.

Compare environment files in the Linux console

4 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Compare environment files in the Linux console

This is a very common source of problems using .env files: you've two or more different .env file like .env and .env.example.

You're a programmer and coding a new amazing feature. You're adding one or more new environment variables to your local .env file and everything is working fine on your computer.

Boum! Your feature is buggy.

A colleague copy the source code from a versioning system like Github/GitLab or, second scenario, someone will deploy the feature on a server and your feature is broken.

Why? Because the variable(s) you've added have been added in your local .env file, on your computer only.

As you know, you have to create the variables in the .env.example file too but let's be honest, nobody thinks about it.

Batch edit of environment file

4 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Batch edit of environment file

When deploying a project on servers, we need to pay particular attention to the .env file. This file is crucial and will determine whether our application works properly (or crashes).

The normal way of doing things is to run a git clone command to get the latest version of the application from a repository (branch test for a test server, dev for an acceptance server, main for a production server).

Once cloned, the next command will be to create the .env file and it's done using cp .env.example .env.

And that's where the obligation to be meticulous begins.

Search and replace (or add) using sed

3 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

Search and replace (or add) using sed

Today, I was facing (once more) with the following need: I need to update a setting in a text file but if the variable is not yet present, I need to add it.

So, in short, I need to make a search and replace or insert new line.

Using sed it's quite easy to automate the search & replace but how to append?

The jq utility for Linux

3 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

The jq utility for Linux

jq is a powerful utility for Linux allowing manipulating JSON data from the command line and can be integrated into shell scripts.

Using jq you can beautify JSON output but also filter it like f.i. showing only a given node.

The xmlstarlet utility for Linux

3 min read
Christophe
Markdown, WSL and Docker lover ~ PHP developer ~ Insatiable curious.

The xmlstarlet utility for Linux

xmlstarlet is a powerful utility for Linux allowing manipulating XML data from the command line and can be integrated into shell scripts.

Using xmlstarlet you can beautify XML output but also filter it like f.i. showing only a given node.