Ash's profile pictureAsh
Joined in 2018
Ash is an experienced tech writer with an endless passion for technology. She enjoys retro gaming, 3D printing, and making awesome projects on the Raspberry Pi.
Share this guide!
Related to this guide:
How to Check Your WiFi SpeedHow to Check Your WiFi Speed
Do you know how fast your network was going, sir?
Ash's profile picture AshView
In these interests: networkingrouter
How to Find WiFi PasswordHow to Find WiFi Password
Log in to your wireless network ASAP.
Ash's profile picture AshView
In these interests: networkingrouter
Open a Port on a RouterOpen a Port on a Router
Manually configure the port settings on your router.
Ash's profile picture AshView
In these interests: networkingrouter
People also read:
Change Channel on Router
Wi-Fi trouble? Try this quick fix.
How to Use a Router
Understand what your wireless router is capable of and what you can do with it.
How to Find My Router IP Address
Find the IP address you need to access your router.
Changing your WiFi password is an easy way to add a little more security to your wireless network or change the random default password to something you can remember.
Posted in these interests:
routerrouter
router
PRIMARY
internetinternet
A series of tubes.
Discuss this guide:
We’re hiring!
Are you a passionate writer or editor? We want to hear from you!
We’re hiring!
Are you a passionate writer or editor? We want to hear from you!

Want to support Howchoo? When you buy a tool or material through one of our Amazon links, we earn a small commission as an Amazon Associate.

Want to support Howchoo? When you buy a tool or material through one of our Amazon links, we earn a small commission as an Amazon Associate.

Ash's profile pictureAsh
Joined in 2018
Ash is an experienced tech writer with an endless passion for technology. She enjoys retro gaming, 3D printing, and making awesome projects on the Raspberry Pi.
Share this guide!
Related to this guide:
How to Check Your WiFi SpeedHow to Check Your WiFi Speed
Do you know how fast your network was going, sir?
Ash's profile picture AshView
In these interests: networkingrouter
How to Find WiFi PasswordHow to Find WiFi Password
Log in to your wireless network ASAP.
Ash's profile picture AshView
In these interests: networkingrouter
Open a Port on a RouterOpen a Port on a Router
Manually configure the port settings on your router.
Ash's profile picture AshView
In these interests: networkingrouter
People also read:
Change Channel on Router
Wi-Fi trouble? Try this quick fix.
How to Use a Router
Understand what your wireless router is capable of and what you can do with it.
How to Find My Router IP Address
Find the IP address you need to access your router.
Changing your WiFi password is an easy way to add a little more security to your wireless network or change the random default password to something you can remember.
Posted in these interests:
routerrouter
router
PRIMARY
internetinternet
A series of tubes.
Discuss this guide:
We’re hiring!
Are you a passionate writer or editor? We want to hear from you!
We’re hiring!
Are you a passionate writer or editor? We want to hear from you!

Want to support Howchoo? When you buy a tool or material through one of our Amazon links, we earn a small commission as an Amazon Associate.

Want to support Howchoo? When you buy a tool or material through one of our Amazon links, we earn a small commission as an Amazon Associate.

Updated: July 23rd, 2020
woodworking
PRIMARY
18 guides
diy
32 guides
woodworking
PRIMARY
18 guides
diy
32 guides
Dayne's profile pictureDayne
Joined in 2015
Software engineer, co-founder of Howchoo, and renaissance man. Lifelong amateur woodworker, espresso mechanic, freestyle lyricist, drummer, artist, runner, coffee roaster, electrical engineer, gamer, inventor, churner, psychoanalyst, photographer, pizza chef, pit master, audiophile, guitarist, entrepreneur, dad, yogi, cyclist, and barista.
Get the easiest and safest wood finish with homemade Danish Oil.
Dayne's profile picture DayneView
In these interests: woodworking
I recently received a copy of Paul Sellers’ book on hand tools. In it, he describes the mallet he designed and gives some tips on reproducing it.
Dayne's profile picture DayneView
In these interests: woodworking
A gift for my mother in law, a simple coat rack made from old walnut.
Dayne's profile picture DayneView
In these interests: woodworking
I built a walking cane for my grandfather from some scrap walnut. I love using hand tools so I stuck to that for the whole project.
I built a cedar stool for my 2 year old nephew for Christmas. I only used hand tools so it took a long time but I learned a lot in the process.
This table lives outside next to a hot tub. I used cedar because it lives at a cabin in Tennessee that already has a bunch of outdoor cedar.
We needed a new dinner table. I wanted to learn about woodworking. This table was built using mostly hand tools and as much traditional joinery as I could figure out.
It can be tricky to cut a mortise without the help of machines but using this method, I find I end up with mortises as clean or cleaner than what I could get with a drill.
This bookcase was inspired by the Ikea bookcase system called Ivar. It was heavily modified (and slightly over engineered). I will take you through my process and hopefully you’ll learn something!
The dado (or housing joint as its called in the UK) is a dead simple joint used for many things. This guide will take you through making the dado joint completely by hand.
“He who works with his hands is a laborer. He who works with his hands and his head is a craftsman. He who works with his hands and his head and his heart is an artist.” – Francis of Assisi
“It takes half your life before you discover life is a do-it-yourself project.” – Napoleon Hill
Ash's profile pictureAsh
Joined in 2018
Ash is an experienced tech writer with an endless passion for technology. She enjoys retro gaming, 3D printing, and making awesome projects on the Raspberry Pi.
Related to this guide:
Raspberry Pi HQ Camera TelescopeRaspberry Pi HQ Camera Telescope
This Raspberry Pi project takes us to the stars.
Ash's profile picture AshView
In these interests: pinews
8GB Raspberry Pi 4 Model Released8GB Raspberry Pi 4 Model Released
In these interests: pinews
GitHub CodespacesGitHub Codespaces
GitHub Codespaces is officially in beta.
Ash's profile picture AshView
In these interests: newsgithub
People also read:
See how 3D printer manufacturer, Prusa Research, is helping meet the demand for hand sanitizer by repurposing equipment.
Screaming Roomba
Removing the cold inhuman experience of a silent Roomba.
Raspberry Pi Call Recorder
Saving the best conversations for later.
Raspberry Pi Robot
Leave the house without leaving the house.
Raspberry Pi Streaming Handheld
Stream your favorite PC games to the Raspberry Pi!
Nintendo Game Boy
But you definitely can’t have one unless you’re 95.
Posted in these interests:
Howchoo NewsHowchoo News
news
PRIMARY
Get the latest news from our most popular interests including 3D printing, Raspberry Pi, Retro Gaming, Python, and more!
pipi
The Raspberry Pi is a small, inexpensive computer developed by the Raspberry Pi Foundation in the United Kingdom.
RaspbianRaspbian
Raspbian is the official Raspberry Pi operating system.
Discuss this guide:
We’re hiring!
Are you a passionate writer or editor? We want to hear from you!
We’re hiring!
Are you a passionate writer or editor? We want to hear from you!

Want to support Howchoo? When you buy a tool or material through one of our Amazon links, we earn a small commission as an Amazon Associate.

Want to support Howchoo? When you buy a tool or material through one of our Amazon links, we earn a small commission as an Amazon Associate.

Raspbian OS Gets New Name and 64-bit Beta

Raspbian OS Gets New Name and 64-bit BetaRaspbian OS Gets New Name and 64-bit Beta
New changes to the classic Raspberry Pi operating system.
Ash Ash (295)
0
Updated: July 22nd, 2020

Earlier this week, the Raspberry Pi Foundation released an 8 GB edition of the Raspberry Pi 4 and announced a name change for the Raspbian operating system. From now on, it and future releases will be known as Raspberry Pi OS.

Posted in these interests:

Howchoo News
news
PRIMARY
39 guides
pi
213 guides
Raspbian
raspbian
10 guides

The news also comes with the release of a 64-bit beta edition of Raspberry Pi OS, perfect for checking out on the new 8 GB model. The new beta has the same desktop environment as the 32-bit edition but built on top of the Debian arm64 port.

Why the name change?

According to a blog post from Raspberry Pi Ltd CEO Eben Upton, the team wanted to create an official name to build confidence with new users. They also hope the name change will make it easier for users to find the OS.

This is all the information we have so far, more details are expected to come this week. In the meantime, you can download the Raspberry Pi OS 64-bit beta on the Raspberry Pi forums.

We’re hiring!
Are you a passionate writer? We want to hear from you!

Want to support Howchoo? When you buy a tool or material through one of our Amazon links, we earn a small commission as an Amazon Associate.

How to Calculate Percentage Change

Tyler Tyler (285)
Total time: 5 minutes 
Updated: July 22nd, 2020

Calculating percentage change isn’t too difficult, but it’s easy to forget. For this guide, we’ll assume you are trying to calculate the percentage change of rainfall from last year to this year. Suppose the total rainfall last year was 18″, and this year is 22″.

Posted in these interests:

math
PRIMARY
5 guides

In order to calculate the increase we simply need to subtract the first number (18) from the second (22).

22 - 18 = 4

The difference is 4 – or in other words – this year it rained 4 more inches than last year. It’s important to always subtract the numbers in this order. If your second number is lower than the first, you will have a negative number, and you’ll be calculating percentage decrease instead of increase. Because the difference is positive we are calculating increase.

Finding the increase was easy. What we really want to know is the percentage change – that is what percentage of the original number is the difference. In the terms of our problem – last year it rained 18″ and we want to know what percentage of 18 is 4.

4 / 18 = 0.222

This will give us the decimal solution, but since we are calculating the percentage we will need to multiple the answer by 100:

0.222 x 100 = 22.2

So the solution is 22.2%. In the terms of our problem, this year there has been a 22.2% increase in rainfall compared to last year.

We’re hiring!
Are you a passionate writer? We want to hear from you!

Want to support Howchoo? When you buy a tool or material through one of our Amazon links, we earn a small commission as an Amazon Associate.

Total time: 15 minutes 
Updated: July 22nd, 2020
python
PRIMARY
67 guides
Calling all writers!

We’re hiring. Write for Howchoo

python
PRIMARY
67 guides
Note

Of course, if you have to solve these problems by hand on a test, you’ll need to make sure you can do that. Don’t depend too heavily on your functions and forget the equations.

Calling all writers!

We’re hiring. Write for Howchoo

Tyler's profile pictureTyler
Joined in 2015
Software Engineer and creator of howchoo.
Get the latest edition of Python in just minutes.
Ash's profile picture AshView
In these interests: codewindowspython
Run Python scripts in command prompt without typing the whole path.
Ash's profile picture AshView
In these interests: windowscodepython
You can run any Python script in a command-line interface.
Ash's profile picture AshView
In these interests: python
Got a Python question? We’ve probably answered it here.
Not sure what version of Python you’re running? Time to find out!
Python is a very popular programming language for data visualization.
In Python, comprehensions are a useful construct that allows us to create new sequences in a very concise way.
Slack has become one of the most important tools for communication in many companies, mine included.
If you’re familiar with Python’s keyword-only arguments, then you’ve probably wondered why the same constraint doesn’t exist for positional arguments. This changes with Python 3.
Specify a parallel filesystem cache for compiled bytecode
Learn how to use formatted string literals in Python
While this requirement may seem rare, learning how to nest defaultdicts properly in Python can be extremely powerful and save you from bloated and confusing initialization code.
python
PRIMARY
Python is howchoo’s favorite programming language. We believe python promotes the most organized and performant codebase possible. We also love Django so, naturally, we love Python.

How to Parse a URL in JavaScript

Jeremy Jeremy (10)
Total time: 2 minutes 
Updated: July 22nd, 2020

Sure there are plugins that will do this for you, but here’s a quick and easy way.

Posted in these interests:

javascript
PRIMARY
27 guides
webdev
58 guides

Create an “a” tag and set the href to the URL you want to parse:

var parser = document.createElement("a"); parser.href = "http::8000/interests?query=1#bottom";

Now use the parser object to get the URL parts:

parser.protocol; // =>"http:" parser.hostname; // => "howchoo.com" parser.port; // =>"8000" parser.pathname; // => "/interests" parser.search; // => "?query=1" parser.hash; // => "#bottom" parser.host; // => "howchoo.com:8000"

This article expands on this idea to provide a little more functionality.

How to Parse a URL in JavaScript

Jeremy Jeremy (10)
Total time: 2 minutes 
Updated: July 22nd, 2020

Sure there are plugins that will do this for you, but here’s a quick and easy way.

Posted in these interests:

javascript
PRIMARY
27 guides
webdev
58 guides

Create an “a” tag and set the href to the URL you want to parse:

var parser = document.createElement("a"); parser.href = "http::8000/interests?query=1#bottom";

Now use the parser object to get the URL parts:

parser.protocol; // =>"http:" parser.hostname; // => "howchoo.com" parser.port; // =>"8000" parser.pathname; // => "/interests" parser.search; // => "?query=1" parser.hash; // => "#bottom" parser.host; // => "howchoo.com:8000"

This article expands on this idea to provide a little more functionality.

Jump to step

How to Parse a URL in JavaScript

Jeremy Jeremy (10)
Total time: 2 minutes 
Updated: July 22nd, 2020

Sure there are plugins that will do this for you, but here’s a quick and easy way.

Posted in these interests:

javascript
PRIMARY
27 guides
webdev
58 guides

Create an “a” tag and set the href to the URL you want to parse:

var parser = document.createElement("a"); parser.href = "http::8000/interests?query=1#bottom";

Now use the parser object to get the URL parts:

parser.protocol; // =>"http:" parser.hostname; // => "howchoo.com" parser.port; // =>"8000" parser.pathname; // => "/interests" parser.search; // => "?query=1" parser.hash; // => "#bottom" parser.host; // => "howchoo.com:8000"

This article expands on this idea to provide a little more functionality.

How to Parse a URL in JavaScript

Jeremy Jeremy (10)
Total time: 2 minutes 
Updated: July 22nd, 2020

Sure there are plugins that will do this for you, but here’s a quick and easy way.

Posted in these interests:

javascript
PRIMARY
27 guides
webdev
58 guides

How to Parse a URL in JavaScript

javascriptwebdev
Jeremy Jeremy (10)
Total time: 2 minutes 
Updated: July 22nd, 2020
Jeremy
1
 

Posted in these interests:

javascript
PRIMARY
27 guides
webdev
58 guides
javascript
PRIMARY
27 guides
webdev
58 guides
PRIMARY
Jump to step
Calling all writers!

We’re hiring. Write for Howchoo

1
 
In these interests
javascript
PRIMARY
27 guides
webdev
58 guides
javascript
PRIMARY
27 guides
webdev
58 guides
PRIMARY
Jump to step

Create an “a” tag and set the href to the URL you want to parse:

var parser = document.createElement("a"); parser.href = "http::8000/interests?query=1#bottom";

Now use the parser object to get the URL parts:

parser.protocol; // =>"http:" parser.hostname; // => "howchoo.com" parser.port; // =>"8000" parser.pathname; // => "/interests" parser.search; // => "?query=1" parser.hash; // => "#bottom" parser.host; // => "howchoo.com:8000"

This article expands on this idea to provide a little more functionality.

Create an “a” tag and set the href to the URL you want to parse:

var parser = document.createElement("a"); parser.href = "http::8000/interests?query=1#bottom";

Create an “a” tag and set the href to the URL you want to parse:

var parser = document.createElement("a"); parser.href = "http::8000/interests?query=1#bottom";

Create an “a” tag and set the href to the URL you want to parse

Now use the parser object to get the URL parts:

parser.protocol; // =>"http:" parser.hostname; // => "howchoo.com" parser.port; // =>"8000" parser.pathname; // => "/interests" parser.search; // => "?query=1" parser.hash; // => "#bottom" parser.host; // => "howchoo.com:8000"

Now use the parser object to get the URL parts:

parser.protocol; // =>"http:" parser.hostname; // => "howchoo.com" parser.port; // =>"8000" parser.pathname; // => "/interests" parser.search; // => "?query=1" parser.hash; // => "#bottom" parser.host; // => "howchoo.com:8000"

Now use the parser object to get the URL parts

This article expands on this idea to provide a little more functionality.

This article expands on this idea to provide a little more functionality.

Further reading

Calling all writers!

We’re hiring. Write for Howchoo

Jeremy's profile pictureJeremy
Joined in 2015
Programmer, brogrammer, whoagrammer.
Jeremy's profile picture
Share this guide!
RedditEmailText
Related to this guide:
How to Pretty Print JSON in Chrome Developer ConsoleHow to Pretty Print JSON in Chrome Developer Console
In these interests: codejavascriptwebdev
Remove Elements From an Array in JavaScriptRemove Elements From an Array in JavaScript
When working with arrays in JavaScript, we often need to remove elements.
Tyler's profile picture TylerView
In these interests: codejavascript
Enumerable Properties in JavaScriptEnumerable Properties in JavaScript
Enumerable properties are properties whose internal enumerable flag set to true.
Tyler's profile picture TylerView
In these interests: codejavascript
How to Pretty Print JSON in Chrome Developer ConsoleHow to Pretty Print JSON in Chrome Developer Console
In these interests: codejavascriptwebdev
Zach's profile pictureViewcodejavascriptwebdev
Remove Elements From an Array in JavaScriptRemove Elements From an Array in JavaScript
When working with arrays in JavaScript, we often need to remove elements.
Tyler's profile picture TylerView
In these interests: codejavascript
Tyler's profile pictureViewcodejavascript
Enumerable Properties in JavaScriptEnumerable Properties in JavaScript
Enumerable properties are properties whose internal enumerable flag set to true.
Tyler's profile picture TylerView
In these interests: codejavascript
Tyler's profile pictureViewcodejavascript
People also read:
This guide demonstrates multiple ways to iterate over a JavaScript object’s properties and values.
There are two very similar statements in JavaScript: for…in and for…of. And while they can be easily confused, they’re actually quite different.
My journey trying to find the one loop operator to rule them all
As a JavaScript developer, you’ll often need to construct URLs and query string parameters. One sensible way to construct query string parameters is to use a one layer object with key value pairs.
Writing tests is an important part of software development process. Unit tests form a core part of testing process where each functional block is tested as an independent unit.
Making a deep copy of an object in JavaScript is fairly challenging. Fortunately, there are a few ways to accomplish this without much code.
At some point you’ll want to read, set, and remove cookies using JavaScript.
Learn how to split a string into an array.
This guide will teach you how to concatenate, or join, all elements of an array into a single string.
Learn how to merge two arrays together in JavaScript.
This guide demonstrates multiple ways to iterate over a JavaScript object’s properties and values.
There are two very similar statements in JavaScript: for…in and for…of. And while they can be easily confused, they’re actually quite different.
My journey trying to find the one loop operator to rule them all
As a JavaScript developer, you’ll often need to construct URLs and query string parameters. One sensible way to construct query string parameters is to use a one layer object with key value pairs.
Writing tests is an important part of software development process. Unit tests form a core part of testing process where each functional block is tested as an independent unit.
Learn Multiple Ways to Iterate Over JavaScript Object Properties and Values
The Difference Between “for…in” and “for…of” in JavaScript
JavaScript for loops
How to Turn an Object into Query String Parameters in JavaScript
Unit Testing in JavaScript – Mocha, Chai and Sinon – a Beginner’s Guide
Making a deep copy of an object in JavaScript is fairly challenging. Fortunately, there are a few ways to accomplish this without much code.
At some point you’ll want to read, set, and remove cookies using JavaScript.
Learn how to split a string into an array.
This guide will teach you how to concatenate, or join, all elements of an array into a single string.
Learn how to merge two arrays together in JavaScript.
How to Copy an Object in JavaScript
How to Manage Cookies in JavaScript
How to Split a String into an Array in JavaScript
How to Join All Elements of an Array in JavaScript
How to Merge Two Arrays in JavaScript
Posted in these interests:
javascriptjavascript
javascript
PRIMARY
Array(16).join(“wat” – 1) + ” Batman!”;
webdevwebdev
All things web development.
javascriptjavascript
javascript
PRIMARY
Array(16).join(“wat” – 1) + ” Batman!”;
PRIMARY
Explore
webdevwebdev
All things web development.
Explore
Discuss this guide:
We’re hiring!
Are you a passionate writer? We want to hear from you!
We’re hiring!
Are you a passionate writer? We want to hear from you!
View openings

Want to support Howchoo? When you buy a tool or material through one of our Amazon links, we earn a small commission as an Amazon Associate.

Donate

Adjust the Length of Your Bash Prompt on the Fly

Tyler Tyler (285)
Total time: 5 minutes 
Updated: July 22nd, 2020

As a developer, I’ve customized my bash prompt to always show the current git branch if I’m in an initialized git repository. This is convenient, but it can make for a very long bash prompt. When I need more space, it’s nice to be able to shorten the bash prompt on the fly.

Posted in these interests:

webdev
PRIMARY
58 guides
bash
5 guides

According to the gnu.org bash reference regarding the PROMPT_COMMAND. If set, the value is interpreted as a command to execute before the printing of each primary prompt. One way to change your prompt on the fly is to simply set the value of PROMPT_COMMAND.

josephtyler@tylermbp[~] # PROMPT_COMMAND='PS1=# '

I’ve set two functions in my bashrc file to make this process easier. I’ve called the functions eep for expand prompt and ccp for contract prompt but you can call them whatever you’d like. Open your bashrc file to edit:

vim ~/.bashrc

Add the following at the end:

INITIAL_PROMPT_COMMAND=$PROMPT_COMMAND
function ccp() {
    PROMPT_COMMAND="PS1='# '"
}
function eep() {
    PROMPT_COMMAND=$INITIAL_PROMPT_COMMAND
}

The first line simply sets the initial command prompt to a new variable so that we can access it later.

INITIAL_PROMPT_COMMAND=$PROMPT_COMMAND

The next two lines are functions eep and ccp that you can use to expand and contract your bash prompt.

After saving this file, you’ll need to source it for it to take effect.

source ~/.bashrc

Adjust the Length of Your Bash Prompt on the Fly

Tyler Tyler (285)
Total time: 5 minutes 
Updated: July 22nd, 2020

As a developer, I’ve customized my bash prompt to always show the current git branch if I’m in an initialized git repository. This is convenient, but it can make for a very long bash prompt. When I need more space, it’s nice to be able to shorten the bash prompt on the fly.

Posted in these interests:

webdev
PRIMARY
58 guides
bash
5 guides

According to the gnu.org bash reference regarding the PROMPT_COMMAND. If set, the value is interpreted as a command to execute before the printing of each primary prompt. One way to change your prompt on the fly is to simply set the value of PROMPT_COMMAND.

josephtyler@tylermbp[~] # PROMPT_COMMAND='PS1=# '

I’ve set two functions in my bashrc file to make this process easier. I’ve called the functions eep for expand prompt and ccp for contract prompt but you can call them whatever you’d like. Open your bashrc file to edit:

vim ~/.bashrc

Add the following at the end:

INITIAL_PROMPT_COMMAND=$PROMPT_COMMAND
function ccp() {
    PROMPT_COMMAND="PS1='# '"
}
function eep() {
    PROMPT_COMMAND=$INITIAL_PROMPT_COMMAND
}

The first line simply sets the initial command prompt to a new variable so that we can access it later.

INITIAL_PROMPT_COMMAND=$PROMPT_COMMAND

The next two lines are functions eep and ccp that you can use to expand and contract your bash prompt.

After saving this file, you’ll need to source it for it to take effect.

source ~/.bashrc
Jump to step

Adjust the Length of Your Bash Prompt on the Fly

Tyler Tyler (285)
Total time: 5 minutes 
Updated: July 22nd, 2020

As a developer, I’ve customized my bash prompt to always show the current git branch if I’m in an initialized git repository. This is convenient, but it can make for a very long bash prompt. When I need more space, it’s nice to be able to shorten the bash prompt on the fly.

Posted in these interests:

webdev
PRIMARY
58 guides
bash
5 guides

According to the gnu.org bash reference regarding the PROMPT_COMMAND. If set, the value is interpreted as a command to execute before the printing of each primary prompt. One way to change your prompt on the fly is to simply set the value of PROMPT_COMMAND.

josephtyler@tylermbp[~] # PROMPT_COMMAND='PS1=# '

I’ve set two functions in my bashrc file to make this process easier. I’ve called the functions eep for expand prompt and ccp for contract prompt but you can call them whatever you’d like. Open your bashrc file to edit:

vim ~/.bashrc

Add the following at the end:

INITIAL_PROMPT_COMMAND=$PROMPT_COMMAND
function ccp() {
    PROMPT_COMMAND="PS1='# '"
}
function eep() {
    PROMPT_COMMAND=$INITIAL_PROMPT_COMMAND
}

The first line simply sets the initial command prompt to a new variable so that we can access it later.

INITIAL_PROMPT_COMMAND=$PROMPT_COMMAND

The next two lines are functions eep and ccp that you can use to expand and contract your bash prompt.

After saving this file, you’ll need to source it for it to take effect.

source ~/.bashrc

Adjust the Length of Your Bash Prompt on the Fly

Tyler Tyler (285)
Total time: 5 minutes 
Updated: July 22nd, 2020

As a developer, I’ve customized my bash prompt to always show the current git branch if I’m in an initialized git repository. This is convenient, but it can make for a very long bash prompt. When I need more space, it’s nice to be able to shorten the bash prompt on the fly.

Posted in these interests:

webdev
PRIMARY
58 guides
bash
5 guides

Adjust the Length of Your Bash Prompt on the Fly

webdevbash
Tyler Tyler (285)
Total time: 5 minutes 
Updated: July 22nd, 2020
Tyler
1
 

Posted in these interests:

webdev
PRIMARY
58 guides
bash
5 guides
webdev
PRIMARY
58 guides
bash
5 guides
PRIMARY
Jump to step
Calling all writers!

We’re hiring. Write for Howchoo

1
 
In these interests
webdev
PRIMARY
58 guides
bash
5 guides
webdev
PRIMARY
58 guides
bash
5 guides
PRIMARY
Jump to step

According to the gnu.org bash reference regarding the PROMPT_COMMAND. If set, the value is interpreted as a command to execute before the printing of each primary prompt. One way to change your prompt on the fly is to simply set the value of PROMPT_COMMAND.

josephtyler@tylermbp[~] # PROMPT_COMMAND='PS1=# '

I’ve set two functions in my bashrc file to make this process easier. I’ve called the functions eep for expand prompt and ccp for contract prompt but you can call them whatever you’d like. Open your bashrc file to edit:

vim ~/.bashrc

Add the following at the end:

INITIAL_PROMPT_COMMAND=$PROMPT_COMMAND
function ccp() {
    PROMPT_COMMAND="PS1='# '"
}
function eep() {
    PROMPT_COMMAND=$INITIAL_PROMPT_COMMAND
}

The first line simply sets the initial command prompt to a new variable so that we can access it later.

INITIAL_PROMPT_COMMAND=$PROMPT_COMMAND

The next two lines are functions eep and ccp that you can use to expand and contract your bash prompt.

After saving this file, you’ll need to source it for it to take effect.

source ~/.bashrc

According to the gnu.org bash reference regarding the PROMPT_COMMAND. If set, the value is interpreted as a command to execute before the printing of each primary prompt. One way to change your prompt on the fly is to simply set the value of PROMPT_COMMAND.

josephtyler@tylermbp[~] # PROMPT_COMMAND='PS1=# '

According to the gnu.org bash reference regarding the PROMPT_COMMAND. If set, the value is interpreted as a command to execute before the printing of each primary prompt. One way to change your prompt on the fly is to simply set the value of PROMPT_COMMAND.

josephtyler@tylermbp[~] # PROMPT_COMMAND='PS1=# '

Set the PROMPT_COMMAND

I’ve set two functions in my bashrc file to make this process easier. I’ve called the functions eep for expand prompt and ccp for contract prompt but you can call them whatever you’d like. Open your bashrc file to edit:

vim ~/.bashrc

Add the following at the end:

INITIAL_PROMPT_COMMAND=$PROMPT_COMMAND
function ccp() {
    PROMPT_COMMAND="PS1='# '"
}
function eep() {
    PROMPT_COMMAND=$INITIAL_PROMPT_COMMAND
}

The first line simply sets the initial command prompt to a new variable so that we can access it later.

INITIAL_PROMPT_COMMAND=$PROMPT_COMMAND

The next two lines are functions eep and ccp that you can use to expand and contract your bash prompt.

After saving this file, you’ll need to source it for it to take effect.

source ~/.bashrc

I’ve set two functions in my bashrc file to make this process easier. I’ve called the functions eep for expand prompt and ccp for contract prompt but you can call them whatever you’d like. Open your bashrc file to edit:

vim ~/.bashrc

Add the following at the end:

INITIAL_PROMPT_COMMAND=$PROMPT_COMMAND
function ccp() {
    PROMPT_COMMAND="PS1='# '"
}
function eep() {
    PROMPT_COMMAND=$INITIAL_PROMPT_COMMAND
}

The first line simply sets the initial command prompt to a new variable so that we can access it later.

INITIAL_PROMPT_COMMAND=$PROMPT_COMMAND

The next two lines are functions eep and ccp that you can use to expand and contract your bash prompt.

After saving this file, you’ll need to source it for it to take effect.

source ~/.bashrc

Set functions in your .bashrc to make it easier

Calling all writers!

We’re hiring. Write for Howchoo

Tyler's profile pictureTyler
Joined in 2015
Software Engineer and creator of howchoo.
Tyler's profile picture
Share this guide!
RedditEmailText
Related to this guide:
MySQL vs PostgreSQLMySQL vs PostgreSQL
Comparing performance, syntax, replication, and features.
Gilad's profile picture GiladView
In these interests: postgresqlwebdevmysql
How to export clean HTML from Google DocsHow to export clean HTML from Google Docs
By default, the HTML exported from Google Docs includes tons of classes, styles, and is generally messy. This short guide will teach you how to export clean HTML devoid of classes and inline styles.
Zach's profile picture ZachView
In these interests: googledocswebdevcode
Filtering Google Analytics language spamFiltering Google Analytics language spam
Google Analytics spam is nothing new. But now spammers have realized that, since language appears in the initial Google Analytics dashboard view, spoofing the language code reaches eyeballs.
Zach's profile picture ZachView
In these interests: webdev
MySQL vs PostgreSQLMySQL vs PostgreSQL
Comparing performance, syntax, replication, and features.
Gilad's profile picture GiladView
In these interests: postgresqlwebdevmysql
Gilad's profile pictureViewpostgresqlwebdevmysql
How to export clean HTML from Google DocsHow to export clean HTML from Google Docs
By default, the HTML exported from Google Docs includes tons of classes, styles, and is generally messy. This short guide will teach you how to export clean HTML devoid of classes and inline styles.
Zach's profile picture ZachView
In these interests: googledocswebdevcode
Zach's profile pictureViewgoogledocswebdevcode
Filtering Google Analytics language spamFiltering Google Analytics language spam
Google Analytics spam is nothing new. But now spammers have realized that, since language appears in the initial Google Analytics dashboard view, spoofing the language code reaches eyeballs.
Zach's profile picture ZachView
In these interests: webdev
Zach's profile pictureViewwebdev
People also read:
Converting XML files to JSON is a good practice for providing easy manipulation and preparing service responses. You can accomplish this efficiently with just three lines of code.
Part of being a web developer is testing things that will inevitably break in insane and unexpected ways in Internet Explorer.
This guide will show you how to set up a LAMP environment in macOS and OS X.
I’ll spoil it – “printenv” is your friend. This guide will show a few examples of how to use it.
Surprisingly, normal YouTube embeds are not automatically sized to the browser window as it is resized.
I started programming in PHP, so by default I would use apache even when I just wanted to test basic HTML files. As I was learning Python, I discovered a great HTTP request handler.
As a web developer, I stare at Chrome’s developer tools — particularly the Elements and Console tabs — all day long. As a result, all light and no dark makes Zach’s eyes dull and tired.
You can echo the current MODX resource’s full page URL without the use of a snippet call.
Renaming a MySQL table is very simple, but sometimes the syntax is hard to remember.
Converting XML files to JSON is a good practice for providing easy manipulation and preparing service responses. You can accomplish this efficiently with just three lines of code.
Part of being a web developer is testing things that will inevitably break in insane and unexpected ways in Internet Explorer.
This guide will show you how to set up a LAMP environment in macOS and OS X.
I’ll spoil it – “printenv” is your friend. This guide will show a few examples of how to use it.
How to Convert XML to JSON in PHP
How to Run Internet Explorer on Mac (For Free)
How to Set Up a LAMP server in macOS
How to Print Environment Variables in Linux/Unix
GitHub Pull Requests: How and Why to Use Pull Requests
Surprisingly, normal YouTube embeds are not automatically sized to the browser window as it is resized.
I started programming in PHP, so by default I would use apache even when I just wanted to test basic HTML files. As I was learning Python, I discovered a great HTTP request handler.
As a web developer, I stare at Chrome’s developer tools — particularly the Elements and Console tabs — all day long. As a result, all light and no dark makes Zach’s eyes dull and tired.
You can echo the current MODX resource’s full page URL without the use of a snippet call.
Renaming a MySQL table is very simple, but sometimes the syntax is hard to remember.
Make YouTube Video Embeds Responsive Using Pure HTML and CSS
Using Python’s simple HTTP server
Tell Chrome Developer Tools to Use a Dark Theme
How to Print the Current Page URL in MODX
Rename a MySQL table
Posted in these interests:
webdevwebdev
webdev
PRIMARY
All things web development.
webdevwebdev
webdev
PRIMARY
All things web development.
PRIMARY
ExploreExplore
Discuss this guide:
We’re hiring!
Are you a passionate writer? We want to hear from you!
We’re hiring!
Are you a passionate writer? We want to hear from you!
View openings

Want to support Howchoo? When you buy a tool or material through one of our Amazon links, we earn a small commission as an Amazon Associate.

Donate
Total time: 10 minutes 
Updated: July 22nd, 2020
python
PRIMARY
67 guides
code
68 guides
Calling all writers!

We’re hiring. Write for Howchoo

python
PRIMARY
67 guides
code
68 guides
Calling all writers!

We’re hiring. Write for Howchoo

Tyler's profile pictureTyler
Joined in 2015
Software Engineer and creator of howchoo.
Get the latest edition of Python in just minutes.
Ash's profile picture AshView
In these interests: codewindowspython
Run Python scripts in command prompt without typing the whole path.
Ash's profile picture AshView
In these interests: windowscodepython
You can run any Python script in a command-line interface.
Ash's profile picture AshView
In these interests: python
Got a Python question? We’ve probably answered it here.
Not sure what version of Python you’re running? Time to find out!
Python is a very popular programming language for data visualization.
In Python, comprehensions are a useful construct that allows us to create new sequences in a very concise way.
Slack has become one of the most important tools for communication in many companies, mine included.
If you’re familiar with Python’s keyword-only arguments, then you’ve probably wondered why the same constraint doesn’t exist for positional arguments. This changes with Python 3.
Specify a parallel filesystem cache for compiled bytecode
Learn how to use formatted string literals in Python
While this requirement may seem rare, learning how to nest defaultdicts properly in Python can be extremely powerful and save you from bloated and confusing initialization code.
python
PRIMARY
Python is howchoo’s favorite programming language. We believe python promotes the most organized and performant codebase possible. We also love Django so, naturally, we love Python.
Code is poetry — one line at a time.