DeveloperBreeze

Introduction

When you log into your VPS via SSH, you might want to start in a specific directory rather than your home directory. This is especially useful for developers and system administrators who frequently work in a particular project folder.

In this tutorial, we'll guide you through how to set a default directory when you SSH into your VPS.


Prerequisites

  • ✅ Access to your VPS via SSH
  • ✅ Basic knowledge of the command line
  • ✅ A text editor installed on your VPS (nano, vim, etc.)

Step-by-Step Guide

Step 1: SSH into Your VPS

ssh your-username@your-vps-ip

Replace your-username with your SSH username and your-vps-ip with your VPS IP address.


Step 2: Determine Your Shell

Check which shell you're using:

echo $SHELL
  • If the output includes /bash, you're using bash.
  • If it includes /zsh, you're using zsh.

Step 3: Edit the Shell Configuration File

Depending on your shell, you'll edit a different file:

ShellConfiguration File
bash~/.bashrc or ~/.bash_profile
zsh~/.zshrc

> Example below assumes you're using bash (.bashrc).

Open the .bashrc file:

nano ~/.bashrc

_or_

vim ~/.bashrc

Add the cd Command at the End of the File:

cd /home/examplewebsite/htdocs/examplewebsite.com

This command will change the directory automatically when you log in via SSH.


Save and Exit:

  • If using nano:

Press CTRL + OEnterCTRL + X.

  • If using vim:

Press ESC, then type :wqEnter.


Step 4: Apply the Changes

Apply the changes immediately without logging out:

source ~/.bashrc

_or just log out and back in._


Step 5: Verify the Configuration

Logout and reconnect via SSH:

exit
ssh your-username@your-vps-ip

✅ You should now start in the /home/examplewebsite/htdocs/examplewebsite.com directory.


Troubleshooting

  • ⚠️ Permission Issues:

Make sure your SSH user has permission to access the specified directory.

  • ⚠️ Directory Existence:

Double-check that the directory exists.

  • ⚠️ Shell Type:

Ensure you're editing the correct configuration file for your shell (.bashrc, .zshrc, etc.).


Conclusion

By following these steps, you can set a default directory when SSHing into your VPS, streamlining your workflow and saving time navigating to your project folders. This simple tweak can greatly enhance your efficiency when working on your server.

Continue Reading

Discover more amazing content handpicked just for you

Tutorial

How to Stop SSH From Timing Out

On your local machine, edit or create:

nano ~/.ssh/config

Aug 21, 2025
Read More
Tutorial

How to Translate URLs in React (2025 Guide)

Install necessary dependencies:

npm install react-router-dom i18next react-i18next i18next-browser-languagedetector

May 04, 2025
Read More
Tutorial

Globalization in React (2025 Trends & Best Practices)

body[dir='rtl'] {
  direction: rtl;
  text-align: right;
}

Switch dir dynamically:

May 04, 2025
Read More
Tutorial

Implementing Internationalization (i18n) in a Large React Application (2025 Guide)

const { t } = useTranslation('dashboard');
  • ✅ Add lang attribute dynamically to <html lang="...">
  • ✅ Use language subpaths (e.g., /en/home, /fr/home) for SEO indexing
  • ✅ Translate all visible UI, not just text
  • ✅ Localize URLs and metadata (title, description)
  • ✅ Use hreflang tags in SSR setups (Next.js, Remix)

May 04, 2025
Read More
Tutorial

Building Micro-Frontends with Webpack Module Federation (2025 Guide)

Install dependencies for Webpack configuration:

npm install -D webpack webpack-cli webpack-dev-server html-webpack-plugin

May 04, 2025
Read More
Tutorial

State Management Beyond Redux: Using Zustand for Scalable React Apps

Key Features:

  • Simplicity: Create stores using a straightforward API without the need for reducers or action types.
  • Performance: Optimized for performance with selective rendering and minimal re-renders.
  • Flexibility: Supports custom hooks, middleware, and integration with other libraries.
  • No Providers: Unlike Redux, Zustand doesn't require wrapping your app with context providers.

May 03, 2025
Read More
Tutorial

Mastering React Rendering Performance with Memoization and Context

import React from 'react';

const Greeting = React.memo(function Greeting({ name }) {
  console.log("Greeting rendered");
  return <h3>Hello{name && ', '}{name}!</h3>;
});

In this example, Greeting will only re-render when the name prop changes. This optimization is particularly beneficial for components that render frequently with the same props.([React][4], [Content That Scales][5])

May 03, 2025
Read More
Tutorial

✅ How to Disable MySQL Password Validation on Ubuntu 25.04

If successful, you'll see:

Query OK, 0 rows affected

May 01, 2025
Read More
Tutorial

How to Move the MySQL Data Directory to a New Location on Ubuntu 25.04

sudo mkdir -p /var/run/mysqld
sudo chown mysql:mysql /var/run/mysqld
sudo systemctl start mysql

May 01, 2025
Read More
Tutorial

How to Install PHP, MySQL, and phpMyAdmin on Ubuntu 25.04 (LAMP Stack Setup Guide)

This script will prompt you to set a root password, remove anonymous users, disallow remote root login, remove the test database, and reload privilege tables.

Install phpMyAdmin along with necessary PHP extensions:

May 01, 2025
Read More
Tutorial

How to Fix NVIDIA Driver Issues on Ubuntu (Dell Vostro 3521)

Let’s purge conflicting or broken drivers:

sudo apt purge 'nvidia-*'
sudo apt remove --purge xserver-xorg-video-nouveau
sudo apt autoremove

Apr 14, 2025
Read More
Tutorial

Avoiding Memory Leaks in C++ Without Smart Pointers

  • Prevents memory leaks.
  • Simplifies exception handling.
  • Keeps your code clean and maintainable.

In newer projects, always prefer std::unique_ptr and std::shared_ptr. But in legacy systems, RAII with simple wrappers like ScopedPointer can save you.

Apr 11, 2025
Read More
Tutorial

Deep Copy in C++: How to Avoid Shallow Copy Pitfalls

If your class handles dynamic memory:

  • Copy Constructor
  • Copy Assignment Operator
  • Destructor

Apr 11, 2025
Read More
Tutorial

🛡️ Protect Your Forms Like a Pro: Anti-Spam Techniques That Actually Work

document.querySelector('form').dataset.start = Date.now();

Then send that timestamp with the form, and on the server:

Apr 04, 2025
Read More
Tutorial

Build a Custom Rate Limiter in Node.js with Redis

When developing web apps or APIs, it’s critical to prevent users from overwhelming your server. That’s where rate limiting comes in. In this guide, we’ll build a custom rate limiter in Node.js using Redis—no libraries, no magic, just code you control and understand.

  • How to use Redis to count and throttle requests
  • How to implement reusable middleware in Express
  • How to rate limit by IP or API key
  • Why this method is better for learning and customization

Apr 04, 2025
Read More
Tutorial
javascript

Building a Real-Time Object Detection Web App with TensorFlow.js and p5.js

  • Filtering Detections: Display only specific classes (e.g., only people or vehicles).
  • Custom UI Elements: Use p5.js to add buttons or controls that modify detection settings in real time.
  • Performance Optimization: Experiment with frame rate adjustments or model parameters for faster detection.

Congratulations! You’ve built a real-time object detection web application using TensorFlow.js and p5.js. This project demonstrates how to integrate machine learning models into a browser-based environment and interact with live video feeds. With further experimentation, you can adapt this tutorial to a variety of creative projects, from interactive art installations to practical surveillance tools.

Feb 12, 2025
Read More
Tutorial

Building a Cross-Platform Desktop App with Tauri and Svelte: A Step-by-Step Tutorial

Once you’re ready to distribute your app, build it using:

npm run build
npx tauri build

Feb 12, 2025
Read More
Tutorial

Implementing a Domain-Specific Language (DSL) with LLVM and C++

Your CMakeLists.txt should find and link LLVM libraries. For example:

cmake_minimum_required(VERSION 3.15)
project(MyDSL)

find_package(LLVM REQUIRED CONFIG)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")

include_directories(${LLVM_INCLUDE_DIRS})
add_definitions(${LLVM_DEFINITIONS})

set(SOURCE_FILES
    src/main.cpp
    src/Lexer.cpp
    src/Parser.cpp
    src/AST.cpp
    src/CodeGen.cpp
)

add_executable(mydsl ${SOURCE_FILES})
llvm_map_components_to_libnames(llvm_libs support core irreader nativecodegen)
target_link_libraries(mydsl ${llvm_libs})

Feb 12, 2025
Read More
Tutorial
python

دليل عملي: بناء روبوت دردشة (Chatbot) باستخدام Python و NLP

import nltk

# تنزيل الموارد الأساسية
nltk.download('punkt')
nltk.download('wordnet')

لنبدأ بإنشاء مجموعة بيانات بسيطة تتضمن الأسئلة الشائعة والردود:

Dec 12, 2024
Read More
Tutorial
python

كيف تبدأ رحلتك مع الذكاء الاصطناعي: دليل عملي للمبتدئين

3. هل يمكنني تطبيق الذكاء الاصطناعي في مشروعي الحالي؟

نعم، سواء كنت تعمل على تطبيق ويب، متجر إلكتروني، أو أي مشروع آخر، هناك دائمًا مجال للاستفادة من الذكاء الاصطناعي.

Dec 12, 2024
Read More

Discussion 0

Please sign in to join the discussion.

No comments yet. Start the discussion!