How to change Adjust Scrollback - Konsole, via Bash?

Abstract: Modifies the scrollback buffer size in Konsole by editing the ~/.config/konsolerc file via Bash.

Created: 2026-08-31 by
To change the scrollback buffer size in Konsole via Bash, you must modify the internal configuration file located at ~/.config/konsolerc. Specifically, edit the <General> section to set the NumberOfHistoryLines key to your desired integer value. This method bypasses the graphical interface and allows for scriptable, automated terminal configuration management on Linux systems.

Understanding Konsole Configuration Structure

Konsole stores its user-specific settings in a plain text INI-style configuration file rather than using environment variables or registry entries. This file is typically found in the XDG config directory within your home folder. The structure is hierarchical, with sections denoted by bracketed headers like [General] or [Appearance]. The specific setting that controls how many lines of history are retained is stored under the <General> section. By default, this value might be set to 1000 or another standard number. When you adjust this value programmatically, you are directly editing the persistent state of the application. It is important to note that these changes do not take effect immediately in currently open sessions; they apply when Konsole is restarted or a new window is opened. For users managing multiple machines or deploying standardized environments, understanding this file structure is crucial. Unlike some other terminals that rely on shell-level variables, Konsole’s scrollback is an application-level constraint. Therefore, manipulating it requires direct file manipulation or specialized tools that parse the KDE configuration format.

Manual Editing Method

The most reliable way to ensure the correct syntax is used is to manually edit the configuration file using a command-line text editor such as nano, vim, or sed. You can open the file directly from your bash prompt. Use the following command to open the configuration file:
nano ~/.config/konsolerc
Once the file is open, locate the line that begins with NumberOfHistoryLines=. If this line does not exist, you may need to add it under the [General] header. Change the value after the equals sign to your preferred number of lines. For example, to set a large buffer:
NumberOfHistoryLines=5000
Save the file and exit the editor. To verify the change, close all instances of Konsole and reopen it. You can test the depth of your scrollback by generating a significant amount of output, such as running cat /usr/include/linux/*.h | wc -l or simply scrolling up through previous commands. If you prefer a non-interactive approach, you can use sed to replace the existing value in one line. Be cautious with regular expressions to avoid unintended replacements. A safe command would look like this:
sed -i 's/^NumberOfHistoryLines=.*/NumberOfHistoryLines=5000/' ~/.config/konsolerc
This command searches for any line starting with NumberOfHistoryLines= and replaces the entire line with the new value. This is particularly useful in shell scripts where interactive editors are not feasible.

Using kwriteconfig5 for Programmatic Changes

Since Konsole is part of the KDE ecosystem, it integrates well with KDE’s configuration utilities. The tool kwriteconfig5 allows you to write configuration values without manually parsing INI files. This reduces the risk of syntax errors and ensures that the configuration is written in the exact format expected by the system. To update the scrollback limit using this utility, run the following command in your terminal:
kwriteconfig5 --file konsolerc --group General --key NumberOfHistoryLines 5000
Here, --file specifies the target configuration file (konsolerc), --group identifies the section (General), and --key targets the specific parameter (NumberOfHistoryLines). The final argument is the new value. This method is cleaner than raw string replacement because it handles missing keys gracefully and respects the underlying data types. After executing this command, restart Konsole to apply the changes. This approach is highly recommended for automation scripts because it is less prone to breaking if the configuration file structure changes slightly between updates, provided the key name remains consistent.

Verifying and Troubleshooting

After applying the changes, it is essential to verify that the new limit is active. Open Konsole and generate enough output to exceed your previous limit. Try scrolling up using the mouse wheel or keyboard shortcuts. If you hit the end of the buffer before reaching the oldest command, the setting has not applied correctly. Common issues include:
  • Cached Settings: Sometimes Konsole caches certain UI states. A full quit (closing all windows) is necessary, not just closing a single tab.
  • Profile Overrides: If you are using custom profiles in Konsole, ensure that the profile settings are not overriding the global defaults. Check the profile manager to see if "Number of History Lines" is explicitly set there.
  • File Permissions: Ensure that ~/.config/konsolerc is writable by your user. If you modified the file as root, ownership issues may prevent the application from reading it correctly.
For more advanced terminal customization, you might also want to explore other bash configurations. For instance, understanding how to manage variable declarations can improve your overall scripting robustness. See How to Force Declare -f to Respect Semicolons for related shell mechanics. Additionally, if you are dealing with file naming conventions in your scripts, knowing how to manipulate strings efficiently is valuable. Check out Bash Shell - Shorter Way to Remove Last Characters from the File Name for practical string manipulation techniques.

Frequently Asked Questions

Does changing the scrollback affect performance?

Yes, increasing the scrollback buffer consumes more RAM because the terminal emulator must store more text in memory. Extremely large values (e.g., over 100,000 lines) may cause slight lag during startup or scrolling on systems with limited resources.

Can I set different scrollback limits for different Konsole profiles?

Yes, Konsole allows you to create multiple profiles. Each profile can have its own NumberOfHistoryLines setting. You can switch between profiles via the Tools menu or by launching Konsole with specific profile arguments.

Why doesn't my change take effect immediately?

Konsole reads its configuration file only at startup. Any changes made to konsolerc while the application is running will not be reflected until you completely close all Konsole windows and start a new session.

Is there a way to reset the scrollback to default?

To reset to the default, you can either delete the NumberOfHistoryLines key from the ~/.config/konsolerc file or set it to the factory default value, which is typically 1000. Alternatively, you can reset your entire Konsole configuration by deleting the ~/.config/konsolerc file, though this will remove all other custom settings.

How do I check the current scrollback limit via command line?

You can grep the configuration file to find the current value by running grep NumberOfHistoryLines ~/.config/konsolerc. This will output the current setting, allowing you to verify what is currently configured before making changes.

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