nl命令

枫奇丶宛南發表於2024-07-17

1.命令格式:

nl [選項]... [檔案]...

2.命令引數:

-b :指定行號指定的方式,主要有兩種:

-b a :表示不論是否為空行,也同樣列出行號(類似 cat -n);

-b t :如果有空行,空的那一行不要列出行號(預設值);

-n :列出行號表示的方法,主要有三種:

-n ln :行號在螢幕的最左方顯示;

-n rn :行號在自己欄位的最右方顯示,且不加 0 ;

-n rz :行號在自己欄位的最右方顯示,且加 0 ;

-w :行號欄位的佔用的位數。

-p 在邏輯定界符處不重新開始計算。

例項

-ba 空行也顯示
-nrz 行號顯示在最左邊,行號前面補位0
-w3 行號位數為三位

nl -ba -nrz -w3 t1
001	root:x:0:0:root:/root:/bin/bash
002	bin:x:1:1:bin:/bin:/sbin/nologin
003	daemon:x:2:2:daemon:/sbin:/sbin/nologin
004	 
005	adm:x:3:4:adm:/var/adm:/sbin/nologin
006	 
007	lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
008	sync:x:5:0:sync:/sbin:/bin/sync
009	shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
010	halt:x:7:0:halt:/sbin:/sbin/halt
011	mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
012	operator:x:11:0:operator:/root:/sbin/nologin
013	games:x:12:100:games:/usr/games:/sbin/nologin
014	ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
015	nobody:x:65534:65534:Kernel Overflow User:/:/sbin/nologin
016	dbus:x:81:81:System message bus:/:/sbin/nologin
017	systemd-coredump:x:999:997:systemd Core Dumper:/:/sbin/nologin
018	systemd-resolve:x:193:193:systemd Resolver:/:/sbin/nologin
019	tss:x:59:59:Account used for TPM access:/dev/null:/sbin/nologin
020	polkitd:x:998:996:User for polkitd:/:/sbin/nologin
021	unbound:x:997:993:Unbound DNS resolver:/etc/unbound:/sbin/nologin
022	postfix:x:89:89::/var/spool/postfix:/sbin/nologin
023	libstoragemgmt:x:996:992:daemon account for libstoragemgmt:/var/run/lsm:/sbin/nologin
024	setroubleshoot:x:995:991::/var/lib/setroubleshoot:/sbin/nologin
025	cockpit-ws:x:994:990:User for cockpit web service:/nonexisting:/sbin/nologin
026	cockpit-wsinstance:x:993:989:User for cockpit-ws instances:/nonexisting:/sbin/nologin
027	sssd:x:992:988:User for sssd:/:/sbin/nologin
028	chrony:x:991:987::/var/lib/chrony:/sbin/nologin
029	sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
030	tcpdump:x:72:72::/:/sbin/nologin
031	saslauth:x:990:76:Saslauthd user:/run/saslauthd:/sbin/nologin
032	pesign:x:989:986:Group for the pesign signing daemon:/run/pesign:/sbin/nologin
033	rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin
034	geoclue:x:988:984:User for geoclue:/var/lib/geoclue:/sbin/nologin
035	rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
036	eoaddm:x:320398:65534:Used for ADDM scanning for the GICs:/var/lib/eoaddm:/bin/bash
037	nscd:x:28:28:NSCD Daemon:/:/sbin/nologin
038	cmkagent:x:7176723:513:Used to run CheckMK:/var/lib/cmkagent:/bin/bash
039	postgres:x:26:26:PostgreSQL Server:/var/lib/pgsql:/bin/bash
040	rtkit:x:172:172:RealtimeKit:/proc:/sbin/nologin
041	pipewire:x:987:511:PipeWire System Daemon:/var/run/pipewire:/sbin/nologin
042	pulse:x:171:171:PulseAudio System Daemon:/var/run/pulse:/sbin/nologin
043	dnsmasq:x:983:983:Dnsmasq DHCP and DNS server:/var/lib/dnsmasq:/sbin/nologin
044	gluster:x:982:508:GlusterFS daemons:/run/gluster:/sbin/nologin
045	usbmuxd:x:113:113:usbmuxd user:/:/sbin/nologin
046	avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
047	clevis:x:981:506:Clevis Decryption Framework unprivileged user:/var/cache/clevis:/sbin/nologin
048	qemu:x:107:107:qemu user:/:/sbin/nologin
049	flatpak:x:980:505:User for flatpak system helper:/:/sbin/nologin
050	colord:x:979:504:User for colord:/var/lib/colord:/sbin/nologin
051	gdm:x:42:42::/var/lib/gdm:/sbin/nologin
052	gnome-initial-setup:x:978:978::/run/gnome-initial-setup/:/sbin/nologin
053	ctxsrvr:x:977:503::/home/ctxsrvr:/bin/false
054	e2clxservice1:x:7661031:65534:e2c linux service account 1:/var/adm/e2clxservice1:/bin/bash
055	e2clxservice2:x:7661032:65534:e2c linux service account 2:/var/adm/e2clxservice2:/bin/bash

相關文章