《k8s权威指南学习》--Service
7z
ab
accept
ack
ag
alias
apachectl
apk
apropos
apt-get
apt-key
apt-sortpkgs
aptitude
ar
arch
arj
arp
arpd
arping
arptables
arpwatch
as
ASCII码表
at
atop
atq
atrm
awk
axel
badblocks
base64
basename
batch
bc
bg
bind
blkid
blockdev
bmodinfo
break
builtin
bunzip2
bye
bzcat
bzcmp
bzdiff
bzgrep
bzip2
bzip2recover
bzless
bzmore
cal
Calico容器网络
cancel
cat
cd
cdrecord
centos检测新的硬盘
CentOS调整磁盘大小【磁盘空间移动】
cgroup
chage
chattr
chcon
chfn
chgrp
chkconfig
chmod
chown
chpasswd
chroot
chsh
cksum
clear
clock
clockdiff
cmp
col
colrm
comm
command
compress
conntrack相关字段
consoletype
continue
convertquota
cp
cpio
crontab
csplit
cu
cupsdisable
cupsenable
curl
cut
date
dc
dd
declare
depmod
df
dhclient
dhcpd
dhcrelay
diff
diff3
diffstat
dig
dircolors
dirname
dirs
disown
dmesg
dmidecode
dnf
dnsdomainname
domainname
dos2unix
dpkg
dpkg-deb
dpkg-divert
dpkg-preconfigure
dpkg-query
dpkg-reconfigure
dpkg-split
dpkg-statoverride
dpkg-trigger
dris
dstat
du
dump
e2fsck
e2label
eBPF_cilium
eBPF入门
echo
ed
edquota
egrep
eject
elinks
elm
emacs
enable
env
ethtool
ex
exec
exit
expand
export
exportfs
expr
false
fc
fdisk
fg
fgrep
file
find
findfs
finger
firewall-cmd
fishshell
fmt
fold
fping
free
fsck
ftp
ftpcount
ftpshut
ftptop
ftpwho
fuser
gcc
gcov
gdb
get_module
getenforce
getsebool
git
gpasswd
gpm
grep
groupadd
groupdel
groupmems
groupmod
groups
grpck
grpconv
grpunconv
grub
grub2-mkconfig
grub2-set-default
gunzip
gzexe
gzip
halt
hdparm
head
help
hexdump
history
host
hostid
hostname
hostnamectl
hping3
htdigest
htop
htpasswd
hwclock
hypervisor
iconv
id
ifcfg
ifconfig
ifconfig配置命令
ifdown
ifstat
iftop
ifup
indent
info
init
inotifywait
insmod
install
Internet和internet
iostat
iotop
ip
ip link
ip6tables
ip6tables-restore
ip6tables-save
ipcalc
ipcrm
ipcs
iperf
iptables
iptables-restore
iptables-save
iptables的数据包的流程介绍
iptables详解
iptraf
iptstate
ispell
jed
jobs
joe
join
journalctl
jq
jwhois
k8s downward API
k8s网络
kernelversion
kexec
kill
kill 命令的用途
killall
last
lastb
lastlog
ld
ldconfig
ldd
less
let
lftp
lftpget
lha
lilo
linux cat
linux cron表达式
linux tmp文件
linux_lldptool
linux修改系统语言
linux日志轮转
linux用户态与内核态
linux自动化交互工具:expect示例
ln
lnstat
local
locate
logger
login
logname
logout
logrotate
logsave
logwatch
look
losetup
lp
lpadmin
lpc
lpq
lpr
lprm
lpstat
ls
lsattr
lsb_release
lsblk
lscpu
lsmod
lsof
lspci
lsusb
ltrace
lvcreate
lvdisplay
lvextend
lvreduce
lvremove
lvresize
lvscan
lynx
mail
mailq
mailstat
make
man
mapfile
md5sum
mesg
mii-tool
mkbootdisk
mkcert
mkdir
mke2fs
mkfs
mkinitrd
mkisofs
mknod
mkswap
mktemp
modprobe
more
mount
mpstat
mtools
mv
mysql
mysqladmin
mysqldump
mysqlimport
mysqlshow
named-checkzone
nano
nc
ncftp
neofetch
nethogs
netstat
newusers
nfsstat
ngrep
nice
nisdomainname
nl
nm
nmap
nmcli
nohup
nologin
nproc
nslookup
ntpdate
ntsysv
objdump
od
openssl
parted
partprobe
passwd
paste
patch
pathchk
perl
pfctl
pgrep
php
pico
pidof
pidstat
pigz
ping
pkill
pmap
popd
poweroff
ppp-off
pr
printf
protoize
ps
pssh
pstack
pstree
pushd
pv
pvchange
pvck
pvcreate
pvdisplay
pvremove
pvs
pvscan
pwck
pwconv
pwd
pwunconv
python setup.py编写参考
quota
quotacheck
quotaoff
quotaon
rcconf
rcp
read
readelf
readonly
reboot
reject
rename
renice
repquota
resize
restore
restorecon
return
rev
rexec
rlogin
rm
rmdir
rmmod
route
rpm
rpm2cpio
rpmbuild
rpmdb
rpmquery
rpmsign
rpmverify
rsh
rsync
runlevel
sar
scp
screen
script
scriptreplay
sed
sed替换命令收集
seinfo
semanage
sendmail
seq
service
sesearch
set
setfacl
setpci
setsebool
setsid
sftp
sftp-server
sh
shell中=和~的用法
shift
shopt
showmount
shuf
shutdown
skill
slabtop
sleep
slocate
smbclient
smbpasswd
SNAT和DNAT
sort
source
speedtest-cli
spell
split
squid
squidclient
ss
ssh
ssh-add
ssh-agent
ssh-copy-id
ssh-keygen
ssh-keyscan
sshd
startx
stat
strace
strings
stty
su
sudo
sum
supervisord
suspend
swapoff
swapon
sync
sysctl
syslog
systemctl
systool
tac
tail
tailf
talk
tar
tcpdump
tcpdump参数
tcpreplay
tee
telinit
telnet
tempfile
test
tftp
time
timedatectl
times
tload
tmux
top
touch
tput
tr
tracepath
traceroute
trap
tree
true
tty
type
ulimit
umask
umount
unalias
uname
unarj
uncompress
unexpand
uniq
unlink
unprotoize
unrar
unset
unzip
updatedb
uptime
useradd
userdel
usermod
usernetctl
users
uucico
uupick
uuto
vdfuse
vgchange
vgconvert
vgcreate
vgdisplay
vgextend
vgreduce
vgremove
vgrename
vgscan
vi
vim常用的一些命令记录
vmstat
volname
w
wait
wall
watch
wc
wget
whatis
whereis
which
who
whoami
write
xargs
xauth
xclip
xhost
xinit
xlsatoms
xlsclients
xlsfonts
xrandr
xset
xz
yes
ypdomainname
yum
zcat
zfore
zip
zipinfo
zipsplit
znew
主机通过dhcp获取ip的过程
二层交换机和三层交换机区别
修改Centos官方云镜像的root密码
修改rpm包
如何解决虚拟机断电重启后进入紧急模式的问题
容器化和kvm的区别
建立一个名为agetest的账号,该账号第一次登陆后使用默认密码,但必须更改密码后使用新密码才能够登陆系统使用bash环境
收藏专题
查看POD的IP地址
网卡的混杂模式
解压缩
输入输出定向
2024-08-08    2024-08-08    579 字  2 分钟

head

显示文件的开头部分。

概要

1
head [OPTION]... [FILE]...

主要用途

  • 在未指定行数时默认显示前10行。
  • 处理多个文件时会在各个文件之前附加含有文件名的行。
  • 当没有文件或文件为-时,读取标准输入。

选项

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
-c, --bytes=[-]NUM       显示前NUM字节;如果NUM前有"-",那么会打印除了文件末尾的NUM字节以外的其他内容。
-n, --lines=[-]NUM       显示前NUM行而不是默认的10行;如果NUM前有"-",那么会打印除了文件末尾的NUM行以外的其他行。
-q, --quiet, --silent    不打印文件名行。
-v, --verbose            总是打印文件名行。
-z, --zero-terminated    行终止符为NUL而不是换行符。
--help                   显示帮助信息并退出。
--version                显示版本信息并退出。

NUM可以有一个乘数后缀:
b 512
kB 1000
k 1024
MB 1000*1000
M 1024*1024
GB 1000*1000*1000
G 1024*1024*1024
T、P、E、Z、Y等以此类推。

也可以使用二进制前缀:
KiB=K
MiB=M
以此类推。

参数

FILE(可选):要处理的文件,可以为一或多个。

返回值

返回0表示成功,返回非0值表示失败。

例子

1
2
3
4
5
6
7
8
# 查看历史文件的前6行:
[user2@pc ~]$ head -n 6 ~/.bash_history
#1575425555
cd ~
#1575425558
ls -lh
#1575425562
vi ~/Desktop/ZhuangZhu-74.txt
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 查看多个文件:
[user2@pc ~]$ head -n ~/.bash_history ~/.bashrc
==> /allhome/user2/.bash_history <==
#1575425555
cd ~
#1575425558
ls -lh
#1575425562
vi ~/Desktop/ZhuangZhu-74.txt
#1575425566
uptime
#1575425570
find ~/ -maxdepth 3 -name 'test.sh' -exec lh {} \;

==> /allhome/user2/.bashrc <==
# .bashrc

# forbid use Ctrl+D to exit shell.
set -o ignoreeof

# Source global definitions.
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

注意

  1. 该命令是GNU coreutils包中的命令,相关的帮助信息请查看man -s 1 headinfo coreutils 'head invocation'