検索
ホームページ運用・保守Linuxの運用と保守Linux および MacOS 端末における大文字と小文字の区別の問題について簡単に説明します (コード付き)

前回の記事「この記事では更新なしのajaxアップロードとダウンロードの実装について解説します(詳細なコード説明)」では、更新なしのajaxアップロードとダウンロードの実装について学びました。次の記事は、Linux および MacOS 端末における大文字と小文字の区別の問題を理解するのに役立ちます。

Linux および MacOS 端末における大文字と小文字の区別の問題について簡単に説明します (コード付き)

Linux および MacOS ターミナルで大文字と小文字が区別されないことを示すプロンプトが表示される

ターミナルを開き、cdユーザーに移動home ディレクトリに次のように入力します:

echo "set completion-ignore-case on" >> .inputrc

ターミナルを閉じて再度開きます

上記の問題をすぐに解決したい場合は、3 番目の部分だけを見てください。

inputrc ファイルの紹介

Bash およびその他のほとんどの shell は、入力関連ライブラリとして Readline ライブラリを使用します。 Readline ライブラリにはデフォルトのキーマップがいくつかありますが、inputrc ファイルを変更してキーマップをカスタマイズすることもできます。

inputrc ファイルは、Readline ライブラリの起動ファイルです。Readline を入力ライブラリとして使用するプログラムが起動すると、 inputrc設定ファイルを自動的に読み取り、カスタマイズされたキーボード マッピングを初期化します。

inputrcファイルの場所は、shell 環境変数 INPUTRC によって制御されます。この変数が設定されていない場合、デフォルトの inputrcファイルのパスは ~/.inputrc です。

ファイル ~/.inputrc が存在しない場合、システム レベル (すべてのユーザーに有効) inputrc ファイル /etc/inputrc#利用される。 ##。ユーザーがシステムのデフォルトの inputrc 構成を変更する必要がある場合は、~/.inputrc を変更できます。これにより、システムのデフォルト構成が上書きされます。

inputrc ファイルの編集方法については、info bash を実行し、bash## の info ページを参照してください。 # #Readline Init Fileこのセクションでは、info readline を実行して、readline 自身の info ページを参照します。 inputrc 設定

inputrc

ファイルには 2 つの設定があります。1 つは

inputrc 変数、もう 1 つはキーボード マッピングです。このファイルを構成するときは、コメントを別の行に入力する必要があることに注意してください。そうしないと問題が発生する可能性があります。 inputrc 変数設定

変数設定の構文は次のとおりです:

set variable value

共通の変数と設定は次のとおりです:

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&#39;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&#39;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&#39;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&#39;s type is appended to the filename when listing possible completions. The default is ‘off’.

キーマップ設定

Configurationinputrc

変数の構文は次のとおりです:

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.
MacOS での自動補完を次のように設定します。大文字と小文字を区別しない

上記の導入により、この問題は十分に解決できるはずです。ユーザーのホーム ディレクトリにあるファイル ~/.inputrc を開き (

ファイルが存在しない場合は、新しいファイルを作成します)、次の設定をそれに追加します:

# 设置自动补全不区分大小写
set completion-ignore-case on
# 当有一个以上自动补全结果时,直接列出,不用beep提示
set show-all-if-ambiguous on
ファイルを保存します。コマンド ラインを再起動すると、オートコンプリートが大文字と小文字を区別せずに有効になっていることがわかります。インターネット上の多くの結果の中から、次の構成を追加する必要があります:
TAB: menu-complete

この構成の目的は、オートコンプリート結果を一覧表示し、

tab

キーをもう一度押すことです。常にオートコンプリート リストを表示するのではなく、オートコンプリート リストから。

推奨学習: Mac OS 入門チュートリアル

Linux ビデオ チュートリアル

以上がLinux および MacOS 端末における大文字と小文字の区別の問題について簡単に説明します (コード付き)の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明
この記事は禅境花园で複製されています。侵害がある場合は、admin@php.cn までご連絡ください。
Linux操作:ネットワーキングとネットワーク構成Linux操作:ネットワーキングとネットワーク構成Apr 27, 2025 am 12:09 AM

Linuxネットワークの構成は、次の手順で完了できます。1。ネットワークインターフェイスを構成し、IPコマンドを使用して、構成ファイルの永続性設定を一時的に設定または編集します。 2。固定IPを必要とするデバイスに適した静的IPを設定します。 3.ファイアウォールを管理し、iPtablesまたはFirewalldツールを使用してネットワークトラフィックを制御します。

Linuxのメンテナンスモード:システム管理者ガイドLinuxのメンテナンスモード:システム管理者ガイドApr 26, 2025 am 12:20 AM

メンテナンスモードは、Linuxシステム管理において重要な役割を果たし、修復、アップグレード、構成の変更を支援します。 1.メンテナンスモードを入力します。 Grubメニューから選択するか、コマンド「sudosystemctlisolaterscue.target」を使用できます。 2。メンテナンスモードでは、ファイルシステムの修理およびシステムの更新操作を実行できます。 3.高度な使用法には、ルートパスワードのリセットなどのタスクが含まれます。 4.メンテナンスモードに入ったり、ファイルシステムをマウントできないなどの一般的なエラーは、GRUB構成をチェックしてFSCKコマンドを使用して固定できます。

Linuxのメンテナンスモード:それを使用する時期と理由Linuxのメンテナンスモード:それを使用する時期と理由Apr 25, 2025 am 12:15 AM

Linuxメンテナンスモードを使用するタイミングと理由:1)システムが起動するとき、2)主要なシステムの更新またはアップグレードを実行するとき、3)ファイルシステムメンテナンスを実行するとき。メンテナンスモードは、安全で制御された環境を提供し、運用上の安全性と効率を確保し、ユーザーへの影響を減らし、システムセキュリティを強化します。

Linux:必須コマンドと操作Linux:必須コマンドと操作Apr 24, 2025 am 12:20 AM

Linuxの不可欠なコマンドは次のとおりです。1.LS:リストディレクトリの内容; 2.CD:作業ディレクトリを変更します。 3.mkdir:新しいディレクトリを作成します。 4.RM:ファイルまたはディレクトリを削除します。 5.CP:ファイルまたはディレクトリをコピーします。 6.MV:ファイルまたはディレクトリの移動または名前を変更します。これらのコマンドは、カーネルと対話することにより、ユーザーがファイルとシステムを効率的に管理するのに役立ちます。

Linux操作:ファイル、ディレクトリ、およびアクセス許可の管理Linux操作:ファイル、ディレクトリ、およびアクセス許可の管理Apr 23, 2025 am 12:19 AM

Linuxでは、ファイルおよびディレクトリ管理ではLS、CD、MKDIR、RM、CP、MVコマンドを使用し、許可管理はCHMOD、CHOWN、およびCHGRPコマンドを使用します。 1。LS-Lなどのファイルおよびディレクトリ管理コマンドは、詳細情報、MKDIR-Pを再帰的に作成するディレクトリを再帰的に作成します。 2。CHMOD755FILEセットファイル許可、CHOWNUSERFILEファイル所有者、CHGRPGROUPFILEの変更ファイルグループなどの許可管理コマンド。これらのコマンドは、ファイルシステム構造とユーザーおよびグループシステムに基づいており、システムコールとメタデータを介して動作および制御します。

Linuxのメンテナンスモードとは何ですか?説明したLinuxのメンテナンスモードとは何ですか?説明したApr 22, 2025 am 12:06 AM

メンテナンスメモデンリンリンアスピアルブーテンビロンメント、criticalsystemmaincencetasks.itallowsadministratorstopertopertopertopersetstingtingpasswords、Repainingfilesystems、およびRecoveringfrombootfailurureSinaMinimalenvironment.

Linux:基本的な部分に深く潜りますLinux:基本的な部分に深く潜りますApr 21, 2025 am 12:03 AM

Linuxのコアコ​​ンポーネントには、カーネル、ファイルシステム、シェル、ユーザー、カーネルスペース、デバイスドライバー、パフォーマンスの最適化とベストプラクティスが含まれます。 1)カーネルは、ハードウェア、メモリ、プロセスを管理するシステムのコアです。 2)ファイルシステムはデータを整理し、Ext4、BTRFS、XFSなどの複数のタイプをサポートします。 3)シェルは、ユーザーがシステムと対話するためのコマンドセンターであり、スクリプトをサポートします。 4)システムの安定性を確保するために、ユーザースペースをカーネルスペースから分離します。 5)デバイスドライバーは、ハードウェアをオペレーティングシステムに接続します。 6)パフォーマンスの最適化には、システム構成とベストプラクティスのチューニングが含まれます。

Linuxアーキテクチャ:5つの基本コンポーネントを発表しますLinuxアーキテクチャ:5つの基本コンポーネントを発表しますApr 20, 2025 am 12:04 AM

Linuxシステムの5つの基本コンポーネントは次のとおりです。1。Kernel、2。Systemライブラリ、3。Systemユーティリティ、4。グラフィカルユーザーインターフェイス、5。アプリケーション。カーネルはハードウェアリソースを管理し、システムライブラリは事前コンパイルされた機能を提供し、システムユーティリティはシステム管理に使用され、GUIは視覚的な相互作用を提供し、アプリケーションはこれらのコンポーネントを使用して機能を実装します。

See all articles

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

Video Face Swap

Video Face Swap

完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

PhpStorm Mac バージョン

PhpStorm Mac バージョン

最新(2018.2.1)のプロフェッショナル向けPHP統合開発ツール

mPDF

mPDF

mPDF は、UTF-8 でエンコードされた HTML から PDF ファイルを生成できる PHP ライブラリです。オリジナルの作者である Ian Back は、Web サイトから「オンザフライ」で PDF ファイルを出力し、さまざまな言語を処理するために mPDF を作成しました。 HTML2FPDF などのオリジナルのスクリプトよりも遅く、Unicode フォントを使用すると生成されるファイルが大きくなりますが、CSS スタイルなどをサポートし、多くの機能強化が施されています。 RTL (アラビア語とヘブライ語) や CJK (中国語、日本語、韓国語) を含むほぼすべての言語をサポートします。ネストされたブロックレベル要素 (P、DIV など) をサポートします。

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

このプロジェクトは osdn.net/projects/mingw に移行中です。引き続きそこでフォローしていただけます。 MinGW: GNU Compiler Collection (GCC) のネイティブ Windows ポートであり、ネイティブ Windows アプリケーションを構築するための自由に配布可能なインポート ライブラリとヘッダー ファイルであり、C99 機能をサポートする MSVC ランタイムの拡張機能が含まれています。すべての MinGW ソフトウェアは 64 ビット Windows プラットフォームで実行できます。

MantisBT

MantisBT

Mantis は、製品の欠陥追跡を支援するために設計された、導入が簡単な Web ベースの欠陥追跡ツールです。 PHP、MySQL、Web サーバーが必要です。デモおよびホスティング サービスをチェックしてください。

EditPlus 中国語クラック版

EditPlus 中国語クラック版

サイズが小さく、構文の強調表示、コード プロンプト機能はサポートされていません