cat
아니요-n
user@linux:~$ cat /etc/sysctl.conf | head -4
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additional system variables.
# See sysctl.conf (5) for information.
user@linux:~$
-n
명령에는 cat
파일의 줄 번호를 표시하는 옵션이 있습니다.
user@linux:~$ cat -n /etc/sysctl.conf | head -4
1 #
2 # /etc/sysctl.conf - Configuration file for setting system variables
3 # See /etc/sysctl.d/ for additional system variables.
4 # See sysctl.conf (5) for information.
user@linux:~$
user@linux:~$ cat -n /etc/sysctl.conf | tail -4
74 # Debian kernels have both set to 1 (restricted)
75 # See https://www.kernel.org/doc/Documentation/sysctl/fs.txt
76 #fs.protected_hardlinks=0
77 #fs.protected_symlinks=0
user@linux:~$
head
그리고 tail
주문은 어떻습니까? head
줄 번호를 보고 출력을 사용하거나 사용하지 않고 파이프할 수 있는 옵션이 있습니까 ?tail
cat -n
head
tail
head -n <filename>
이것을 시도했지만 tail -n <filename>
출력에 줄 번호가 표시되지 않습니다.
user@linux:~$ head -n4 /etc/sysctl.conf
#
# /etc/sysctl.conf - Configuration file for setting system variables
# See /etc/sysctl.d/ for additional system variables.
# See sysctl.conf (5) for information.
user@linux:~$
user@linux:~$ tail -n4 /etc/sysctl.conf
# Debian kernels have both set to 1 (restricted)
# See https://www.kernel.org/doc/Documentation/sysctl/fs.txt
#fs.protected_hardlinks=0
#fs.protected_symlinks=0
user@linux:~$
답변1
답변2
less
명령을 사용하는 방법 ?
less -N +F /etc/sysctl.conf