iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
Your Bash prompt is controlled mainly by PS1. Set it temporarily to test a design, then place the working assignment in the interactive startup file for your VPS account. With Bash’s prompt escapes, you can show the user, hostname, current directory, privilege level, Git context, or command status while keeping the line readable and correctly sized for command editing.
What the Bash prompt controls
Bash displays a primary prompt before it reads each command. The value of PS1 determines that prompt. A normal prompt might show only $, while an administrative shell often uses #. A useful VPS prompt normally identifies at least the account, the machine and the directory, because those three details reduce mistakes when several remote sessions are open.
Bash has additional prompt variables for different situations:
PS1is the primary prompt shown before an ordinary command.PS2appears when Bash is waiting for continuation input, such as after an unfinished quote, pipe or compound command. Its default is usually>.PS0is used in interactive contexts immediately after Bash reads a command and before execution.PS4prefixes lines shown by execution tracing whenset -xis enabled.
Most customization work concerns PS1, but changing PS2 can make multiline commands easier to recognize without altering how Bash parses them.
#1 Best Overall
- Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
- With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
- Wide Application:Upgraded attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
- Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
- Warranty & Support: Our Electric air duster comes with 5 years warranty and 24/7 customer service. During this period, if you have any questions,pls kindly feel free to contact us.
Inspect your VPS shell before changing anything
Run these commands from an interactive Bash session on the VPS:
printf 'shell=%snPS1=%qn' "$SHELL" "$PS1"
bash --version | head -n 1
The first command identifies the account’s declared shell and prints the current PS1 in a reusable, escaped form. The second confirms the Bash version of the executable you are invoking. The prompt will not behave as expected if the SSH session is running a different shell such as dash, zsh or a distribution-specific shell configuration.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Check that the session is interactive as well. Bash reads interactive startup files and expands PS1 before reading commands in an interactive shell; a non-interactive script generally does not display a prompt. You can check the interactive flag with:
case $- in
*i*) echo 'interactive Bash' ;;
*) echo 'not interactive' ;;
esac
Do not put prompt code in a system-wide file simply because it is convenient. A per-account configuration in the user’s home directory is safer and avoids changing other administrators’ sessions.
Use Bash prompt escapes to show useful context
Bash expands backslash escapes in PS1 when it displays the prompt. The most useful escapes for a Linux VPS are:
| Escape | Displayed value | Typical use |
|---|---|---|
u |
Current username | Distinguishes accounts |
h |
Short hostname up to the first dot | Quick server identification |
H |
Full hostname | Useful when hostnames contain domains |
w |
Current working directory, with ~ for the home directory |
Shows where a command will run |
W |
Basename of the current directory | Keeps a long path compact |
d |
Date in a locale-dependent format | Time context without seconds |
t |
Current time in 24-hour HH:MM:SS format |
Useful for long-running maintenance sessions |
n |
A newline | Separates identity from the command-entry line |
$ |
$ for a regular effective user or # for effective UID 0 |
Makes privilege visible |
Keep the backslashes in the assignment. They are prompt instructions, not values to expand while the assignment is being read. Single quotes are a straightforward way to preserve them.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Test a prompt temporarily
A practical one-line prompt
Start with a design that exposes identity, host, location and privilege:
PS1='u@h:w$ '
For example, a normal user in /var/www might see deploy@web01:/var/www$ . The same prompt in a root shell ends with # . This assignment affects only the current shell process. Open a new SSH session or exit the shell and it disappears, which makes temporary testing low risk.
Rank #2
- Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
- Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
- Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
- Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
- Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
A two-line prompt for busy terminals
A long path can push the command-entry point far to the right. Put the identity on one line and leave a clean line for the command:
PS1='nu@h w$ '
The initial newline separates the next prompt from output produced by the previous command. This is particularly useful when logs or package-manager output end immediately beside the next prompt.
Change the continuation prompt separately
When a command continues across lines, use a marker that cannot be mistaken for a fresh prompt:
PS2='cont> '
Try it with an unfinished command such as:
printf '%sn' "first line
second line"
Pressing Enter after the opening quote causes Bash to display cont> until the quote is closed. This changes only the visual cue; it does not alter multiline syntax.
Make the prompt permanent in the correct startup file
For an ordinary interactive Bash login on a VPS, the per-user interactive configuration is commonly ~/.bashrc. Some distributions or hosting images arrange login startup through ~/.bash_profile, ~/.bash_login or ~/.profile. Inspect existing files before editing so you preserve distribution-provided aliases, environment setup and cloud-image logic.
After testing the assignment, back up the file and append the setting:
PC 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 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutecp ~/.bashrc ~/.bashrc.bak
printf "nPS1='\u@\h:\w\$ 'n" >> ~/.bashrc
. ~/.bashrc
The final command sources the file in the current shell, so you do not need to disconnect and reconnect. The backup lets you restore the previous version quickly:
cp ~/.bashrc.bak ~/.bashrc
. ~/.bashrc
If a new SSH login does not show the change, check whether the login file sources ~/.bashrc. A common pattern is:
Rank #3
- 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
- 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
- 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
- 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
- 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
Do not blindly add this block if the file already has equivalent logic. The objective is to ensure the interactive login reaches one maintained prompt definition, not to source the same file repeatedly.
Use an interactive guard when the file serves other shells
Startup files can be read in contexts that are not displaying a prompt. Guard prompt-only code so command substitutions, automated jobs or non-interactive SSH commands do not receive interactive formatting:
Free tools Windows power users keep installed
One-click scans. No signup required.
case $- in
*i*)
PS1='u@h:w$ '
;;
esac
An equivalent Bash-specific test is if [[ $- == *i* ]]; then ... fi. Keep the guard around prompt assignments and related display functions, while leaving environment variables that scripts genuinely need outside it.
Add color without breaking line wrapping
ANSI color sequences occupy no terminal columns, but Bash’s line editor must be told that they occupy no width. Enclose every non-printing control sequence in [ and ]. Define the sequences once and compose the prompt from them:
if [[ $- == *i* ]]; then
BLUE='[e[34m]'
RESET='[e[0m]'
PS1="${BLUE}u@h${RESET}:w$ "
fi
The color variables include the width markers themselves. The visible text remains the username, host, path and privilege symbol; only the username and host are blue in this example.
Test color with command editing, not just by looking at an empty prompt. Recall a long command with the Up Arrow, move the cursor through it and type until the line wraps. If the cursor jumps, wraps early or overwrites characters, inspect every escape sequence. A common error is to include e[34m but omit the surrounding [ and ], causing Bash to count invisible bytes as visible columns. A second error is to wrap ordinary prompt text in those markers, which gives Bash an incorrect width in the opposite direction.
Always include a reset sequence after colored text. Without it, command output printed after the prompt can inherit the prompt’s color, making logs harder to read.
Keep deep directory paths readable
The w escape is informative but can become very wide in a source tree or deployment directory. Bash’s PROMPT_DIRTRIM variable limits how many trailing directory components are shown when Bash expands w or W:
Rank #4
- 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
- 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
- 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
- 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
- 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.
PROMPT_DIRTRIM=3
PS1='u@h:w$ '
With this setting, Bash keeps the final three directory components and replaces omitted leading components with an ellipsis. The exact visible result depends on the current path, but the command still runs in the full directory; only the display is shortened. Set the value alongside PS1 in the same interactive configuration file so it applies in every session.
Recommended Free Tools
If you need the complete path for a sensitive operation, use pwd rather than relying on the abbreviated prompt. A compact prompt should never be treated as proof of the current directory.
Show command status with PROMPT_COMMAND
PROMPT_COMMAND runs immediately before Bash prints each primary prompt. It is useful for values that must be calculated after the previous command finishes, such as its exit status. A small function can put a nonzero status directly into the next prompt:
prompt_status() {
local status=$?
if (( status == 0 )); then
PS1='u@h:w$ '
else
PS1="(status ${status}) u@h:w$ "
fi
}
PROMPT_COMMAND=prompt_status
The first statement saves $? before other commands in the function change it. A successful command restores the normal prompt; a failed command produces a prefix such as (status 2). The status code is the previous command’s exit value, not the result of drawing the prompt.
Keep prompt hooks short. They run before every prompt, so an expensive directory scan, network request or external service lookup adds work after every command and can make the terminal feel sluggish. Prefer shell builtins and local state. If the image already defines PROMPT_COMMAND, inspect it before replacing it; overwriting an existing value can disable distribution or administrator features. Bash versions and existing configurations may represent the variable as a string or an array, so preserve the form already in use when adding your function.
A simple status indicator can also be represented by a symbol, but a numeric code is more diagnostic when you are troubleshooting a failed deployment or script.
Decide what belongs in a VPS prompt
There is no universally best prompt. Compare a design against the conditions in which you administer the server:
| Decision axis | Minimal design | Information-rich design | What to check |
|---|---|---|---|
| Information density | One symbol or a short directory name | User, host, path, time and status | Whether each item prevents a real mistake |
| Host visibility | Hard to distinguish sessions | Short or full hostname is always visible | Whether production and staging look unmistakably different |
| Privilege clarity | Same marker for every account | $ shows $ or # |
Whether root sessions are obvious before a destructive command |
| Readability | Short line and few colors | More context, possibly two lines | Wrapping and cursor movement with long commands |
| Dynamic cost | No work before the prompt | Status or repository information calculated each time | Whether the hook delays every command |
| Portability | Documented Bash escapes | Shell-specific functions and integrations | Whether the same file is used on all VPS images |
For a fleet, use unmistakable host naming and privilege markers before adding decorative color. For a single-purpose application server, a compact path and status indicator may be more useful than a clock that changes on every prompt.
Best Value
- 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
- 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
- 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
- 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
- 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.
Include Git context without making every prompt expensive
A repository branch can be valuable during deployments, but computing it on every prompt can be costly in large working trees. If you add Git data, limit the work to directories that are actually repositories and use a cached or shell-native solution already present on the VPS image. Do not run network operations from a prompt hook. The prompt should describe local state; it should not block while contacting a remote server.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesIf branch information is not essential for the session, leave it out. The core Bash escapes work in any directory and have predictable performance, while repository detection introduces additional logic and more opportunities for stale or misleading display.
Troubleshoot common prompt problems
The change disappears after logout
- Confirm that you tested in Bash and that the assignment was written to the account that opens the SSH session.
- Check whether the login startup file sources
~/.bashrc. - Look for a later
PS1=...assignment that overrides your line. - Source the file manually with
. ~/.bashrcand watch for syntax errors.
The prompt shows literal backslashes or expands at the wrong time
Use a quoted assignment such as PS1='u@h:w$ '. In a double-quoted assignment, Bash still preserves these prompt escapes, but command substitutions, variables and embedded quotes can make a complex definition harder to reason about. Avoid backslash stripping when generating the line with printf; compare the result with printf '%qn' "$PS1".
Colors are visible as characters or wrapping is wrong
- Put every non-printing ANSI sequence between
[and]. - Do not include visible letters inside those markers.
- Close the color with a reset sequence.
- Test recalled commands of different lengths, including a command that wraps onto a second terminal line.
The status shown is always zero
Capture $? as the first operation in the PROMPT_COMMAND function. Running another command before saving it replaces the status you intended to display. Also verify that another hook runs later and rewrites PS1.
An existing prompt or tool stops working
Replacing PROMPT_COMMAND can remove functions installed by a distribution, framework or administrator. Print the current value before editing:
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →declare -p PROMPT_COMMAND 2>/dev/null
Back up the startup file, preserve existing entries and add your function in the same style. If the prompt becomes unusable, start a clean shell without reading startup files and restore the backup:
bash --noprofile --norc
The prompt is correct in one terminal but not another
Different terminals can use different login modes, shell executables or account startup files. Compare $SHELL, the result of bash --version | head -n 1, the interactive flag and the files sourced by the login path. A terminal emulator’s local profile does not change the remote VPS’s Bash configuration.
A maintainable example configuration
The following example combines an interactive guard, a compact path, carefully wrapped color and a status prefix. Add only after testing each part separately:
case $- in
*i*)
PROMPT_DIRTRIM=3
BLUE='[e[34m]'
RESET='[e[0m]'
prompt_status() {
local status=$?
if (( status == 0 )); then
PS1="${BLUE}u@h${RESET}:w$ "
else
PS1="(status ${status}) ${BLUE}u@h${RESET}:w$ "
fi
}
PROMPT_COMMAND=prompt_status
;;
esac
This keeps the path compact, makes the host and account visible, marks root through $, colors only nonessential identity text and reports the previous command’s failure. If the VPS already supplies a prompt hook, merge the function rather than assigning over the existing hook. If you do not need status reporting, remove the function and use a direct PS1 assignment; fewer moving parts are easier to maintain.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteQuick Recap
Safe workflow for changing a production VPS prompt
- Open an interactive Bash session and record
$SHELL, the Bash version and the currentPS1. - Apply a plain, uncolored
PS1assignment temporarily. - Move between the home directory, a deep path and a root shell to verify host, path and privilege clues.
- Test any
PS2or newline design with an intentionally incomplete command. - Add
PROMPT_DIRTRIMif paths are too wide. - Add color only after the uncolored design works, enclosing every non-printing sequence with
[and]. - Add a
PROMPT_COMMANDhook only when the dynamic value answers a real operational question. - Back up the interactive startup file, add the tested code under an interactive guard and source it.
- Open a fresh SSH session and test long command editing, command recall and failure status.
- Keep the backup until a new login has confirmed the final configuration.
Final design checklist
- The prompt clearly identifies the account and VPS host.
$makes effective root sessions visibly different.- The path is useful without consuming the entire terminal width.
- Colors reset correctly and do not confuse Bash’s line editor.
- Dynamic hooks finish immediately and preserve existing configuration.
- Prompt-only code runs only in interactive Bash sessions.
- The tested assignment is stored in the startup file used by the actual SSH login.
- A backup exists and can be restored from a clean shell.
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.

