MobaXterm: Display Colored Files Normally in Linux (Without Singularity Container)

Abstract: Resolve missing file colors in MobaXterm Linux by forcing ls --color and configuring LS_COLORS.

Created: 2026-09-24 by

To display colored files normally in Linux using MobaXterm, you must ensure your terminal emulator supports ANSI color codes and that the shell's LS_COLORS environment variable is correctly configured. The most direct method to verify this functionality is running the command ls -l --color, which forces color output regardless of standard aliases, allowing you to visually distinguish file types such as directories, executables, and symbolic links immediately.

Understanding Terminal Color Support

MobaXterm acts as a comprehensive SSH and X server client for Windows, providing a robust terminal environment that mimics native Linux terminals. However, color support depends on several layers: the underlying operating system, the SSH protocol negotiation, and the specific configuration of the shell session (typically Bash or Zsh). When you connect to a remote Linux host, MobaXterm negotiates the terminal type, usually setting it to xterm-256color or similar. If this negotiation fails or if the remote shell does not export color variables, file listings will appear in monochrome. The core mechanism for file coloring in Linux is controlled by the GNU ls command, part of the GNU Coreutils package. This command uses the --color flag to enable or disable colorized output. By default, many distributions alias ls to ls --color=auto, which means colors are only shown when the output is connected to a terminal (TTY) rather than being piped to another command. In MobaXterm, since you are interacting directly with a TTY, this alias should trigger automatically. If it does not, the issue often lies in how the shell initializes its environment variables upon connection.

Forcing Color Output with ls

If your file listings appear gray or black and white despite having a fully functional Linux environment, the first diagnostic step is to explicitly invoke the color option. Run the following command in your MobaXterm terminal:
ls -l --color
This command bypasses any potential alias conflicts and forces the ls utility to interpret and emit ANSI escape sequences for colors. If the output displays distinct colors for different file types (e.g., blue for directories, green for executables), then your terminal and shell are capable of rendering colors. The problem is likely that the default alias for ls has been removed or overridden in your current session. To make this permanent, you should check your shell configuration files, typically .bashrc or .profile, and ensure that an alias exists:
alias ls='ls --color=auto'
Adding this line to your .bashrc ensures that every new shell session started within MobaXterm will automatically apply colors to directory listings. After adding the alias, run source ~/.bashrc to apply the changes without restarting the terminal.

Configuring LS_COLORS

Even with the correct alias, you might encounter situations where colors are missing or incorrect. This is often due to the LS_COLORS environment variable not being set or being corrupted. This variable defines exactly which ANSI color code corresponds to which file attribute. You can inspect the current value by running:
echo $LS_COLORS
If this returns empty, your shell lacks the necessary definitions. Most modern Linux distributions provide a script to generate these defaults. You can regenerate them by sourcing the /etc/profile.d/colorls.sh script or by using the dircolors command. For example:
dircolors -b > ~/.dircolors
source ~/.dircolors
This creates a personal configuration file in your home directory that overrides system defaults. It is crucial to source this file in your .bashrc so that it loads every time you open a new session in MobaXterm. Without proper LS_COLORS definitions, even a correctly aliased ls command may fail to display meaningful colors.

Troubleshooting Connection and Session Issues

Sometimes, color issues are symptomatic of broader connectivity problems between MobaXterm and the remote host. If your terminal frequently disconnects or behaves erratically, it may affect how environment variables are transmitted. For instance, sudden inactivity can cause SSH sessions to drop, leading to incomplete initialization of the shell environment. If you experience disconnections, refer to guides on handling MobaXterm and WinSCP disconnect issues to stabilize your network settings. Additionally, network interruptions can sometimes result in "Remote side unexpectedly closed network connection" errors, which indicate that the SSH daemon on the remote host terminated the session prematurely. This abrupt closure can prevent the proper loading of shell configurations, including color aliases. Troubleshooting these network stability issues ensures that your shell starts cleanly every time, preserving all customizations like file coloring. It is also worth noting that while MobaXterm includes X11 forwarding capabilities, file coloring is a purely terminal-based feature and does not rely on graphical X11 protocols. Therefore, X11 troubleshooting steps are generally irrelevant to this specific problem unless you are attempting to run GUI-based file managers. Focus instead on the text-based terminal configuration within MobaXterm’s integrated bash window.

Verifying and Customizing Colors

Once you have ensured that ls --color works and LS_COLORS is populated, you can customize the appearance further. The .dircolors file allows you to change specific colors for specific file types. For example, you can change the color of backup files or compressed archives. Experiment with different color schemes by editing this file and reloading it. Remember that MobaXterm’s terminal emulator settings (found in Tools > Options > Terminal) also influence how colors are rendered. Ensure that your terminal profile supports 256-color mode, as older 8-color modes may truncate or distort the vibrant palettes defined by LS_COLORS. Finally, if you are writing scripts that depend on colored output, be aware that piping commands to other tools disables color by default to preserve data integrity. Use --color=always if you absolutely need colors in pipes, but understand that this can break downstream parsers. For interactive use in MobaXterm, sticking to --color=auto is the safest and most standard approach.

Frequently Asked Questions

Why do my files look colored locally but not remotely?

This indicates that the remote shell is not exporting the LS_COLORS variable or lacks the ls alias. Check the remote host's .bashrc or .profile files to ensure they contain the necessary color definitions and aliases.

Can I change the specific colors used for directories and files?

Yes, by editing the .dircolors file in your home directory. You can modify the hex codes or color names associated with different file attributes and then source the file to apply changes.

Does MobaXterm require special plugins to show colors?

No, MobaXterm supports ANSI color codes natively. As long as the remote Linux system is configured to send color codes and the terminal emulator is set to handle them, no additional plugins are needed.

What should I do if ls --color still shows no colors?

Verify that your terminal type is set to something like xterm-256color. You can check this with the echo $TERM command. If it is incorrect, update your SSH configuration or terminal settings in MobaXterm.

Is it safe to use --color=always in scripts?

It is generally unsafe because it embeds escape characters into the output, which can corrupt data processing by other commands. Use it only for interactive visual inspection, not for automated scripting.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More