


Learn about case sensitivity issues in Linux and MacOS terminals in simple terms (with code)
In the previous article "This article explains the implementation of ajax upload and download without refresh (detailed code explanation)", we learned about the implementation of ajax without refresh upload and download. The following article will help you understand the case sensitivity issue in Linux and MacOS terminals. Come and take a look.
Linux and MacOS terminal prompts that case is not sensitive
Open the terminal and cd
go to userhome
Directory, enter:
echo "set completion-ignore-case on" >> .inputrc
Close and reopen the terminal
If you just want to quickly solve the above problem, just look at the third part.
inputrc file introduction
Bash
and most other shell
use the Readline
library as their input-related library. The Readline
library has some default keymaps. In addition, you can also customize the keymap by modifying the inputrc
file. The
inputrc
file is the startup file of the Readline
library. When a program that uses Readline
as the input library starts, it will automatically readinputrc
Configuration file, initialize customized keyboard mapping.
inputrc
The location of the file is controlled by the shell
environment variable INPUTRC
. If this variable is not set, the default inputrc
The path of the file is ~/.inputrc
.
If the file ~/.inputrc
does not exist, the system-level (effective for all users) inputrc
file /etc/inputrc# will be used. ##. If a user needs to modify the system's default
inputrc configuration, he can change
~/.inputrc, which will overwrite the system's default configuration.
inputrc file, run
info bash and refer to the
info page of
bash #Readline Init File
In this section, run info readline
to reference readline
's own info
page. inputrc configuration
In the
inputrc file, there are two configurations: one is the inputrc
variable, and the other is the keyboard mapping. Note that when configuring this file, comments must occupy a separate line, otherwise problems may occur.
The syntax of variable configuration is as follows:
set variable value
Common variables and configuration are as follows:
completion-ignore-case #如果设置为开(on),在自动补全时不区分大小写。该配置默认是关。 show-all-if-ambiguous #这个配置该变了自动补全函数的默认行为。如果设置为开(on),当自动补全的结果有一个以上时,会直接列出这些结果。如果设置为关(off),就会提示一个beep蜂鸣声,当再按下tab时才会列出自动补全的结果。默认这项配置为关。 bell-style #Controls what happens when Readline wants to ring the terminal bell. If set to ‘none’, Readline never rings the bell. If set to ‘visible’, Readline uses a visible bell if one is available. If set to ‘audible’ (the default), Readline attempts to ring the terminal's bell. bind-tty-special-chars #If set to ‘on’, Readline attempts to bind the control characters treated specially by the kernel's terminal driver to their Readline equivalents. comment-begin #The string to insert at the beginning of the line when the insert-comment command is executed. The default value is "#". completion-prefix-display-length #When set to a value greater than zero, common prefixes longer than this value are replaced with an ellipsis when displaying possible completions. #e.g. set completion-prefix-display-length 4 completion-query-items #The number of possible completions that determines when the user is asked whether the list of possibilities should be displayed. If the number of possible completions is greater than this value, Readline will ask the user whether or not he wishes to view them; otherwise, they are simply listed. This variable must be set to an integer value greater than or equal to 0. A negative value means Readline should never ask. The default limit is 100. convert-meta #If set to ‘on’, Readline will convert characters with the eighth bit set to an ascii key sequence by stripping the eighth bit and prefixing an <ESC> character, converting them to a meta-prefixed key sequence. The default value is ‘on’. disable-completion #If set to ‘On’, Readline will inhibit word completion. Completion characters will be inserted into the line as if they had been mapped to self-insert. The default is ‘off’. editing-mode #The editing-mode variable controls which default set of key bindings is used. By default, Readline starts up in Emacs editing mode, where the keystrokes are most similar to Emacs. This variable can be set to either ‘emacs’ or ‘vi’. echo-control-characters #When set to ‘on’, on operating systems that indicate they support it, readline echoes a character corresponding to a signal generated from the keyboard. The default is ‘on’. enable-keypad #When set to ‘on’, Readline will try to enable the application keypad when it is called. Some systems need this to enable the arrow keys. The default is ‘off’. enable-meta-key #When set to ‘on’, Readline will try to enable any meta modifier key the terminal claims to support when it is called. On many terminals, the meta key is used to send eight-bit characters. The default is ‘on’. expand-tilde #If set to ‘on’, tilde expansion is performed when Readline attempts word completion. The default is ‘off’. history-preserve-point #If set to ‘on’, the history code attempts to place the point (the current cursor position) at the same location on each history line retrieved with previous-history or next-history. The default is ‘off’. history-size #Set the maximum number of history entries saved in the history list. If set to zero, the number of entries in the history list is not limited. horizontal-scroll-mode #This variable can be set to either ‘on’ or ‘off’. Setting it to ‘on’ means that the text of the lines being edited will scroll horizontally on a single screen line when they are longer than the width of the screen, instead of wrapping onto a new screen line. By default, this variable is set to ‘off’. input-meta #If set to ‘on’, Readline will enable eight-bit input (it will not clear the eighth bit in the characters it reads), regardless of what the terminal claims it can support. The default value is ‘off’. The name meta-flag is a synonym for this variable. isearch-terminators #The string of characters that should terminate an incremental search without subsequently executing the character as a command. If this variable has not been given a value, the characters <ESC> and C-J will terminate an incremental search. keymap #Sets Readline's idea of the current keymap for key binding commands. Acceptable keymap names are emacs, emacs-standard, emacs-meta, emacs-ctlx, vi, vi-move, vi-command, and vi-insert. vi is equivalent to vi-command; emacs is equivalent to emacs-standard. The default value is emacs. The value of the editing-mode variable also affects the default keymap. mark-directories #If set to ‘on’, completed directory names have a slash appended. The default is ‘on’. mark-modified-lines #This variable, when set to ‘on’, causes Readline to display an asterisk (*) at the start of history lines which have been modified. This variable is ‘off’ by default. mark-symlinked-directories #If set to ‘on’, completed names which are symbolic links to directories have a slash appended (subject to the value of mark-directories). The default is ‘off’. match-hidden-files #This variable, when set to ‘on’, causes Readline to match files whose names begin with a ‘.’ (hidden files) when performing filename completion, unless the leading ‘.’ is supplied by the user in the filename to be completed. This variable is ‘on’ by default. output-meta #If set to ‘on’, Readline will display characters with the eighth bit set directly rather than as a meta-prefixed escape sequence. The default is ‘off’. page-completions #If set to ‘on’, Readline uses an internal more-like pager to display a screenful of possible completions at a time. This variable is ‘on’ by default. print-completions-horizontally #If set to ‘on’, Readline will display completions with matches sorted horizontally in alphabetical order, rather than down the screen. The default is ‘off’. revert-all-at-newline If set to ‘on’, Readline will undo all changes to history lines before returning when accept-line is executed. By default, history lines can be modified and retain individual undo lists across calls to readline. The default is ‘off’. show-all-if-unmodified #This alters the default behavior of the completion functions in a fashion similar to show-all-if-ambiguous. If set to ‘on’, words which have more than one possible completion without any possible partial completion (the possible completions don't share a common prefix) cause the matches to be listed immediately instead of ringing the bell. The default value is ‘off’. skip-completed-text #If set to ‘on’, this alters the default completion behavior when inserting a single match into the line. It's only active when performing completion in the middle of a word. If enabled, readline does not insert characters from the completion that match characters after point in the word being completed, so portions of the word following the cursor are not duplicated. For instance, if this is enabled, attempting completion when the cursor is after the ‘e’ in ‘Makefile’ will result in ‘Makefile’ rather than ‘Makefilefile’, assuming there is a single possible completion. The default value is ‘off’. visible-stats #If set to ‘on’, a character denoting a file's type is appended to the filename when listing possible completions. The default is ‘off’.Keymap configuration
Configuration
inputrcThe syntax of the variable is as follows: <pre class='brush:php;toolbar:false;'>keyname: function-name or macro
#keyname必须是英文,可以是Control-u、Control-k等。并且keyname和冒号之间不能有空格,如果有空格会被认为是keyname的一部分。keyname的写法多样,取决于自己的喜好。
#下面是一些键盘映射配置的例子:
Control-u: universal-argument C-u is bound to the function universal-argument
Meta-Rubout: backward-kill-word M-DEL is bound to the function backward-kill-word
Control-o: "> output" C-o is bound to run the macro expressed on the right hand side (that is, to insert the text ‘> output’ into the line)
Control-j: menu-complete C-j is bound to cycle through the available tab completions.
Control-k: menu-complete-backward C-k is bound to cycle backwards through the available tab completions.
"\t": menu-complete Use tab to cycle through all the possible completions.
"\C-p": history-search-backward Map control-p to allow search for completions to the current line from your history. e.g. type “git” and then hit control-p to cycle through all the recent git commands.
"\ep": history-search-backward Map escape-p to allow search for completions to the current line from your history. e.g. type “git” and then hit escape-p to cycle through all the recent git commands.
"\e[A": history-search-backward Map Up arrow to allow search for completions to the current line from your history. e.g. type “git” and then hit UP to cycle through all the recent git commands.
"\e[B": history-search-forward Map Down arrow to allow search for completions to the current line from your history. e.g. type “git” and then hit DOWN to cycle back through all the recent git commands.
"\C-d": kill-whole-line Map control-d to kill the whole line.</pre>
Through the above introduction, it should be more than enough to solve this problem. Open the file
~/.inputrc in the user's home directory (If it does not exist, create a new file), and add the following configuration to it: <pre class='brush:php;toolbar:false;'># 设置自动补全不区分大小写
set completion-ignore-case on
# 当有一个以上自动补全结果时,直接列出,不用beep提示
set show-all-if-ambiguous on</pre>
Save the file, and then restart the command line , you will find that the auto-completion is not case-sensitive and has taken effect. Among many results on the Internet, you need to add the following configuration:
TAB: menu-complete
The purpose of this configuration is to list the auto-complete results and press the
tab key again. Automatically select from the autocomplete list instead of always showing the autocomplete list. Recommended learning:
The above is the detailed content of Learn about case sensitivity issues in Linux and MacOS terminals in simple terms (with code). For more information, please follow other related articles on the PHP Chinese website!

Linux maintenance mode can be entered through the GRUB menu. The specific steps are: 1) Select the kernel in the GRUB menu and press 'e' to edit, 2) Add 'single' or '1' at the end of the 'linux' line, 3) Press Ctrl X to start. Maintenance mode provides a secure environment for tasks such as system repair, password reset and system upgrade.

The steps to enter Linux recovery mode are: 1. Restart the system and press the specific key to enter the GRUB menu; 2. Select the option with (recoverymode); 3. Select the operation in the recovery mode menu, such as fsck or root. Recovery mode allows you to start the system in single-user mode, perform file system checks and repairs, edit configuration files, and other operations to help solve system problems.

The core components of Linux include the kernel, file system, shell and common tools. 1. The kernel manages hardware resources and provides basic services. 2. The file system organizes and stores data. 3. Shell is the interface for users to interact with the system. 4. Common tools help complete daily tasks.

The basic structure of Linux includes the kernel, file system, and shell. 1) Kernel management hardware resources and use uname-r to view the version. 2) The EXT4 file system supports large files and logs and is created using mkfs.ext4. 3) Shell provides command line interaction such as Bash, and lists files using ls-l.

The key steps in Linux system management and maintenance include: 1) Master the basic knowledge, such as file system structure and user management; 2) Carry out system monitoring and resource management, use top, htop and other tools; 3) Use system logs to troubleshoot, use journalctl and other tools; 4) Write automated scripts and task scheduling, use cron tools; 5) implement security management and protection, configure firewalls through iptables; 6) Carry out performance optimization and best practices, adjust kernel parameters and develop good habits.

Linux maintenance mode is entered by adding init=/bin/bash or single parameters at startup. 1. Enter maintenance mode: Edit the GRUB menu and add startup parameters. 2. Remount the file system to read and write mode: mount-oremount,rw/. 3. Repair the file system: Use the fsck command, such as fsck/dev/sda1. 4. Back up the data and operate with caution to avoid data loss.

This article discusses how to improve Hadoop data processing efficiency on Debian systems. Optimization strategies cover hardware upgrades, operating system parameter adjustments, Hadoop configuration modifications, and the use of efficient algorithms and tools. 1. Hardware resource strengthening ensures that all nodes have consistent hardware configurations, especially paying attention to CPU, memory and network equipment performance. Choosing high-performance hardware components is essential to improve overall processing speed. 2. Operating system tunes file descriptors and network connections: Modify the /etc/security/limits.conf file to increase the upper limit of file descriptors and network connections allowed to be opened at the same time by the system. JVM parameter adjustment: Adjust in hadoop-env.sh file

This guide will guide you to learn how to use Syslog in Debian systems. Syslog is a key service in Linux systems for logging system and application log messages. It helps administrators monitor and analyze system activity to quickly identify and resolve problems. 1. Basic knowledge of Syslog The core functions of Syslog include: centrally collecting and managing log messages; supporting multiple log output formats and target locations (such as files or networks); providing real-time log viewing and filtering functions. 2. Install and configure Syslog (using Rsyslog) The Debian system uses Rsyslog by default. You can install it with the following command: sudoaptupdatesud


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version
God-level code editing software (SublimeText3)