The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Your Bash prompt is controlled mainly by PS1. Test a new value in the current interactive shell, then put the working assignment in the startup file that your VPS uses for interactive Bash sessions. A practical baseline is u@h:w$ : it shows the logged-in user, the VPS hostname, the current directory, and $ for a regular user or # when the effective user is root.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
This guide covers permanent prompts, useful Bash escape sequences, safe color handling, compact paths, exit-status and Git indicators, startup-file differences, and the failures that make customized prompts confusing or cause command lines to wrap incorrectly.
As an Amazon Associate I earn from qualifying purchases.
What the Bash prompt controls
Bash expands and displays PS1 before it reads each command. That makes it the primary prompt you see after connecting over SSH and after every command finishes. The value can contain literal text and documented backslash escapes that Bash replaces with session information.
| Variable | When it appears | Typical use |
|---|---|---|
PS1 |
Before each primary command line | User, host, directory, time, privilege marker, or other context |
PS2 |
When Bash is waiting for continuation input | A clear marker such as continue> for an unfinished command, quoted string, or compound construct |
PS0 |
In the interactive command-reading sequence before execution | Optional visual separation or command-state text |
PS4 |
When execution tracing is enabled with set -x |
A prefix that makes traced commands easier to distinguish |
Most VPS customization only needs PS1. Change PS2, PS0, or PS4 only when you have a specific continuation, debugging, or tracing problem to solve.
#1 Best Overall
- BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
- EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
- COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
- LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
- WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
Check the shell and current prompt first
Run these commands inside an interactive Bash session on the VPS. They tell you whether the session is actually Bash and show the current prompt as an escaped value rather than as formatted screen output.
printf 'shell=%snPS1=%qn' "$SHELL" "$PS1"
bash --version | head -n 1
$SHELL identifies the account’s configured login shell, while the second command confirms the Bash version available in the current environment. A terminal can be configured with one shell while an SSH command, a control panel, or a container starts another, so verify the process you are editing before changing startup files.
Prompt assignments affect the current shell process only. Opening another SSH connection, starting a new login shell, or switching users creates a different shell with its own startup sequence. That is why a temporary test is the safest first step.
Useful Bash prompt escapes
Put these escapes in the PS1 value. Bash expands them when it draws the prompt, so the displayed information stays current as you change directories or switch users.
| Escape | Displays | Why it helps on a VPS |
|---|---|---|
u |
Current username | Shows which account is active when several administrators use the same server. |
h |
Short hostname | Identifies the machine without filling the line with a fully qualified name. |
H |
Full hostname | Useful when short hostnames are duplicated across environments. |
w |
Current working directory, with the home directory abbreviated as ~ |
Provides location context for file and deployment commands. |
W |
Basename of the current directory | Keeps prompts short when the full path is unwieldy. |
d |
Date in Bash’s date format | Can help correlate a shell session with maintenance notes, although it consumes horizontal space. |
t |
Current time in 24-hour HH:MM:SS form |
Makes long-running maintenance sessions easier to follow. |
n |
A newline | Separates command output from the next input line and gives a two-line prompt. |
$ |
$ for a normal user or # for an effective root user |
Provides an immediate privilege warning before a destructive command. |
Use single quotes around a prompt assignment so the backslashes reach Bash’s prompt expansion instead of being interpreted by the assignment command itself. Literal punctuation, spaces, and labels can be added around the escapes.
Test a prompt temporarily
A balanced one-line prompt
Start with the smallest useful identity and location display:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Rank #2
- WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
- AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
- PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
- ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
- COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
PS1='u@h:w$ '
Move between the home directory, a project directory, and a privileged shell to verify that the username, hostname, path, and privilege marker change as expected. The final space is intentional: it keeps your command visually separate from the prompt.
A two-line prompt for busy terminal output
If logs or command output run directly into your input line, put the prompt on two lines:
PS1='nu@h w$ '
The leading newline creates a clean boundary before each command. This is often easier to read during package installation, service restarts, or game-server log inspection, but it uses an extra terminal row for every command.
A continuation marker
Make unfinished commands obvious without changing the primary prompt:
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →PS2='continue> '
Try it with a multiline command or an unterminated quoted string. Restore the previous value if scripts or team conventions rely on a different continuation marker.
Make the tested prompt permanent
For most interactive, non-login Bash sessions, the per-user file is ~/.bashrc. Login shells can use files such as ~/.bash_profile or ~/.profile, and many distributions arrange for a login file to source ~/.bashrc. VPS images also add provider or distribution logic of their own, so inspect the existing files rather than replacing them wholesale.
Rank #3
- Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
- Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
- Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
- ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
- Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
- Back up the interactive startup file.
- Add the exact assignment that worked in the temporary test.
- Reload the file in the current shell.
- Open a new SSH session to confirm that a fresh interactive shell receives the same configuration.
cp ~/.bashrc ~/.bashrc.bak
printf "nPS1='\u@\h:\w\$ 'n" >> ~/.bashrc
. ~/.bashrc
The backup gives you a quick recovery path: cp ~/.bashrc.bak ~/.bashrc restores the previous file. The dot command (equivalent to source) reads the updated file into the current shell; it does not start a separate process.
If the new prompt appears only after running . ~/.bashrc but disappears in a new login session, trace the login startup chain. Check whether ~/.bash_profile or ~/.profile exists and whether it sources ~/.bashrc. If a provider image has a system-wide profile that assigns PS1 later, put your user assignment after that logic in the appropriate file. Keep distribution-provided setup intact.
Free tools Windows power users keep installed
One-click scans. No signup required.
Guard prompt-only code when the same file may be read by a non-interactive shell. A common pattern is:
case $- in
*i*) ;;
*) return ;;
esac
Place interactive prompt assignments after this guard when the surrounding startup file uses it. Non-interactive commands such as automation jobs should not receive terminal prompt output.
Add color without breaking line wrapping
Terminal color sequences do not occupy columns, but Bash needs to know that. Enclose every non-printing control sequence in [ and ] inside the prompt definition. Without those markers, Bash counts invisible bytes as visible characters and may redraw a long command at the wrong column.
if [[ $- == *i* ]]; then
BLUE='[e[34m]'
RESET='[e[0m]'
PS1="${BLUE}u@h${RESET}:w$ "
fi
This example colors only the user-and-host portion and resets the terminal before the path. The interactive test prevents the color variables from being used by non-interactive shells. You can choose another ANSI color code, but keep both the opening color and the reset sequence inside their own non-printing delimiters.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Rank #4
- Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
- Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
- 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
- Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
- USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
Test the width, not just the appearance
- Reload the startup file.
- Change into a directory with a long path.
- Recall a long command with the Up Arrow and edit it past the terminal width.
- Use Left and Right Arrow to cross the wrap point.
If the cursor jumps, overwrites characters, or wraps one position early, inspect every color, bold, title, or other terminal-control sequence. Each invisible sequence must be enclosed by matching [ and ]. Remove styling temporarily to determine whether the problem is the prompt or the terminal emulator.
Keep deep paths readable with PROMPT_DIRTRIM
A full w path is valuable until nested deployment or repository directories push the prompt off screen. Set PROMPT_DIRTRIM to the number of trailing directory components you want to retain:
PROMPT_DIRTRIM=3
PS1='u@h:w$ '
When Bash expands w or W, it replaces omitted leading components with an ellipsis while retaining the specified number of trailing components. The setting changes what is displayed, not the shell’s actual working directory, so commands continue to run from the same location.
Choose a value that preserves enough context to distinguish nearby projects. If you regularly work in directories whose final names repeat, increase the value or use a two-line design rather than hiding the path entirely.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Show dynamic state with PROMPT_COMMAND
PROMPT_COMMAND runs immediately before Bash prints the primary prompt. It is the right place to calculate values that change after every command, such as the previous exit status or the current Git branch. Because it runs for every prompt, keep the function short and avoid network calls, package-manager queries, or other expensive work.
Display a non-zero exit status
Capture $? as the first operation in the hook; any command run before that would replace the status you want to show.
Best Value
- Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
- Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
- Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
- Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
- Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
prompt_status() {
local status=$?
if (( status == 0 )); then
PS1='u@h:w$ '
else
PS1="(status ${status}) u@h:w$ "
fi
}
PROMPT_COMMAND=prompt_status
A successful command leaves the normal prompt. After a failure, the next prompt starts with the numeric status, which is especially useful after a long pipeline or a service-management command. The indicator describes the command immediately preceding the hook; running another command before examining it changes the value.
Include the current Git branch
For VPS deployments kept in Git repositories, this hook adds a branch label and retains a failure indicator:
prompt_context() {
local status=$?
local branch=''
if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
branch=$(git symbolic-ref --quiet --short HEAD 2>/dev/null || git rev-parse --short HEAD 2>/dev/null)
fi
PS1='u@h:w'
[[ -n $branch ]] && PS1+=" [$branch]"
(( status != 0 )) && PS1+=" (status ${status})"
PS1+='$ '
}
PROMPT_COMMAND=prompt_context
The symbolic-ref command shows a named branch; the fallback displays a short commit identifier when the repository is in a detached-HEAD state. Outside a repository, no bracketed label is added. This performs Git checks before every prompt, so omit the branch feature on hosts where prompt latency matters more than repository context.
Do not accidentally discard existing hooks
Some VPS images already use PROMPT_COMMAND for directory tracking, cloud tooling, or their own status display. Assigning PROMPT_COMMAND=prompt_context replaces the existing value. Inspect it first with:
declare -p PROMPT_COMMAND 2>/dev/null
If it is already configured, incorporate your function into the existing command or append it using the same scalar or array form that the image uses. Test the complete startup sequence afterward; preserving the provider’s hook is more important than keeping a particular prompt decoration.
Choose a prompt design deliberately
| Design | Information | Strength | Trade-off |
|---|---|---|---|
Minimal: $ |
Only privilege marker | Maximum space for commands and logs | No host or directory protection against mistakes |
Identity: u@h:w$ |
User, host, path, privilege | Strong default for multiple VPS sessions | Long paths consume width |
| Two-line identity | Identity on one line, input on the next | Readable with long output and commands | Uses an extra row per prompt |
| Colorized identity | Identity plus visual grouping | Fast scanning across several terminals | Requires correct non-printing delimiters and a color-capable terminal |
| Dynamic status or Git | Previous result and repository state | Surfaces context without a separate command | Hook code runs before every prompt and can add latency |
For administration, prioritize host visibility and the $ privilege marker over decoration. When you routinely switch between staging and production VPSs, use a full hostname or an unmistakable host label. When command editing is the priority, trim paths or move the prompt to two lines before adding more dynamic data.
Troubleshoot common prompt problems
The prompt reverts after reconnecting
- Confirm that the assignment is in the startup file read by the new session, not only in the current shell.
- Check whether the session is Bash with
printf '%sn' "$BASH_VERSION". - Inspect login files for a later
PS1assignment or a conditional that returns before your code. - Verify that you edited the same user’s home directory; root and an ordinary account have separate startup files.
Colors display as text or wrapping is wrong
- Ensure each non-printing escape starts with
[and ends with]. - Ensure a reset sequence follows colored text before the path and command input.
- Reload the file and test with a long recalled command, not only a short prompt.
- Remove all styling, confirm correct wrapping, and reintroduce one color sequence at a time.
The prompt shows the wrong host or user
his intentionally only the short hostname; useHwhen the full name is required.$reflects the effective user, so a root shell correctly shows#.- After
su,sudo -s, or a container shell, check which account and hostname are actually active.
Git information slows every command
- Remember that
PROMPT_COMMANDruns before every primary prompt, including prompts after trivial commands. - Remove the Git hook when outside repositories or when the check is noticeably slow.
- Keep status indicators local; do not invoke network services from a prompt hook.
A script behaves differently after editing the prompt
Prompt settings belong in interactive startup logic. Keep them behind the file’s interactive-shell guard and do not rely on PS1 being set in automation. Scripts should check command results explicitly rather than parsing what a human prompt displays.
Quick Recap
A safe final checklist
- Confirm the session is interactive Bash.
- Test a plain
PS1assignment before adding color or hooks. - Verify user, hostname, path, and privilege behavior in both ordinary and root shells.
- Back up the startup file before editing it.
- Place the assignment in the file actually read by your VPS’s interactive login path.
- Use
[and]around every non-printing terminal sequence. - Set
PROMPT_DIRTRIMwhen full paths crowd out commands. - Capture
$?before any other operation in a dynamic prompt function. - Preserve an existing
PROMPT_COMMANDinstead of overwriting provider or distribution logic. - Reload the file, then verify the result in a brand-new SSH session and with a long command.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




