Linux(Almalinux, Rockylinux, Ubuntu)に標準搭載されるnanoエディタに行番号を付加する設定の備忘録です。
nanoエディタの設定は/etc/nanorcに記述されています。
管理者権限をとります。
RockyLinux(Red Hat系)の場合 [falcon@localhost ~]$ su パスワード: [root@localhost falcon]# Ubuntu(Debian系)の場合 [falcon@localhost ~]$ sudo su パスワード: [root@localhost falcon]#
/etc/nanorcを編集します。
[root@localhost falcon]# nano /etc/nanorc #77行目のset linenubersのコメントアウト#を外す ## Display line numbers to the left (and any anchors in the margin). set linenumbers
次回起動より行番号が付加されます。
[root@localhost falcon]# nano /etc/nanorc ---- 1 ## This is a system-wide configuration file for the nano editor. 2 ## 3 ## Each user can save his own configuration to ~/.nanorc 4 ## 5 ## See the nanorc(5) man page for details. 6 7 ## Sample initialization file for GNU nano. 8 ## 9 ## For the options that take parameters, the default value is shown. 10 ## Other options are unset by default. To make sure that an option 11 ## is disabled, you can use "unset <option>". 12 ## 13 ## Characters that are special in a shell should not be escaped here. 14 ## Inside string parameters, quotes should not be escaped -- the last 15 ## double quote on the line will be seen as the closing quote. 16 17 ## Make 'nextword' (Ctrl+Right) and 'chopwordright' (Ctrl+Delete) 18 ## stop at word ends instead of at beginnings. 19 # set afterends ----以下略
簡単ですね!

