简介
A
ab
accept
ack
ag
alias
apachectl
apk
apropos
apt-get
aptitude
apt-key
apt-sortpkgs
ar
arch
arj
arp
arpd
arping
arptables
arpwatch
as
at
atop
atq
atrm
awk
axel
B
badblocks
base64
basename
batch
bc
bg
bind
blkid
blockdev
bmodinfo
break
builtin
bunzip2
bye
bzcat
bzcmp
bzdiff
bzgrep
bzip2
bzip2recover
bzless
bzmore
C
cal
cancel
cat
cd
cdrecord
chage
chattr
chcon
chfn
chgrp
chkconfig
chmod
chown
chpasswd
chroot
chsh
cksum
clear
clock
clockdiff
cmp
col
colrm
column
comm
command
compress
consoletype
continue
convertquota
cp
cpio
createrepo
crontab
csplit
cu
cupsdisable
cupsenable
curl
cut
D
date
dc
dd
declare
depmod
df
dhclient
dhcpd
dhcrelay
diff
diff3
diffstat
dig
dircolors
dirname
dirs
disown
dmesg
dmidecode
dnf
dnsdomainname
docker
domainname
dos2unix
dpkg-deb
dpkg-divert
dpkg-preconfigure
dpkg-query
dpkg-reconfigure
dpkg-split
dpkg-statoverride
dpkg-trigger
dpkg
dris
dstat
du
dump
E
e2fsck
e2label
echo
ed
edquota
egrep
eject
elinks
elm
emacs
enable
env
ethtool
ex
exec
exit
expand
export
exportfs
expr
F
false
fc
fdisk
fg
fgrep
file
find
findfs
finger
firewall-cmd
fishshell
fmt
fold
fping
free
fsck
ftp
ftpcount
ftpshut
ftptop
ftpwho
fuser
G
gcc
gcov
gdb
get_module
getenforce
getent
getsebool
git
gpasswd
gpm
grep
groupadd
groupdel
groupmems
groupmod
groups
grpck
grpconv
grpunconv
grub
grub2-mkconfig
grub2-set-default
gunzip
gzexe
gzip
H
halt
hcitool
hdparm
head
help
hexdump
history
host
hostid
hostname
hostnamectl
hping3
htdigest
htop
htpasswd
hwclock
I
iconv
id
ifcfg
ifconfig
ifdown
ifstat
iftop
ifup
indent
info
init
inotifywait
insmod
install
iostat
iotop
ip
ip6tables-restore
ip6tables-save
ip6tables
ipcalc
ipcrm
ipcs
iperf
iptables-restore
iptables-save
iptables
iptraf
iptstate
iscsiadm
ispell
J
jed
jobs
joe
join
journalctl
jq
jwhois
K
kernelversion
kexec
kill
killall
L
last
lastb
lastlog
ld
ldconfig
ldd
less
let
lftp
lftpget
lha
lilo
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
M
mail
mailq
mailstat
make
man
mapfile
md5sum
mesg
mii-tool
mkbootdisk
mkcert
mkdir
mke2fs
mkfs
mkinitrd
mkisofs
mknod
mkswap
mktemp
modetest
modprobe
more
mount
mpstat
mtools
mtr
mv
mysql
mysqladmin
mysqldump
mysqlimport
mysqlshow
N
named-checkzone
nano
nc
ncftp
neofetch
nethogs
netstat
newusers
nfsstat
ngrep
nice
nisdomainname
nl
nm
nmap
nmcli
nohup
nologin
nproc
nslookup
ntpdate
ntsysv
O
objdump
od
openssl
P
pacman
parted
partprobe
passwd
paste
patch
pathchk
perl
pfctl
pgrep
php
pico
pidof
pidstat
pigz
ping
ping6
pip
pkexec
pkill
pmap
popd
poweroff
ppp-off
pr
printf
protoize
prtstat
ps
pssh
pstack
pstree
pushd
pv
pvchange
pvck
pvcreate
pvdisplay
pvremove
pvs
pvscan
pwck
pwconv
pwd
pwdx
pwunconv
Q
quota
quotacheck
quotaoff
quotaon
R
rcconf
rcp
read
readelf
readonly
reboot
reject
rename
renice
reposync
repquota
resize
restore
restorecon
return
rev
rexec
rlogin
rm
rmdir
rmmod
route
rpm
rpm2cpio
rpmbuild
rpmdb
rpmquery
rpmsign
rpmverify
rsh
rsync
runlevel
S
sar
scp
screen
script
scriptreplay
sed
seinfo
semanage
sendmail
seq
service
sesearch
set
setfacl
setpci
setsebool
setsid
sftp-server
sftp
sh
sha256sum
shift
shopt
showmount
shuf
shutdown
skill
slabtop
sleep
slocate
smartmontools
smbclient
smbpasswd
sort
source
speedtest-cli
spell
split
squid
squidclient
ss
ssh-add
ssh-agent
ssh-copy-id
ssh-keygen
ssh-keyscan
ssh
sshd
sshpass
startx
stat
strace
strings
stty
su
sudo
sum
supervisord
suspend
swapoff
swapon
sync
sysctl
syslog
systemctl
systool
T
tac
tail
tailf
talk
tar
tcpdump
tcpreplay
tee
telinit
telnet
tempfile
test
tftp
time
timedatectl
times
tload
tmux
top
touch
tput
tr
tracepath
traceroute
trap
tree
true
tty
type
U
ulimit
umask
umount
unalias
uname
unarj
uncompress
unexpand
uniq
unlink
unprotoize
unrar
unset
unzip
updatedb
uptime
useradd
userdel
usermod
usernetctl
users
uucico
uupick
uuto
V
vdfuse
vgchange
vgconvert
vgcreate
vgdisplay
vgextend
vgreduce
vgremove
vgrename
vgscan
vi
vmstat
volname
W
w
wait
wall
watch
wc
wget
whatis
whereis
which
who
whoami
write
X
xargs
xauth
xclip
xhost
xinit
xlsatoms
xlsclients
xlsfonts
xrandr
xset
xz
Y
yes
ypdomainname
yum
Z
zcat
zfore
zip
zipinfo
zipsplit
znew
其他
7z
pssh - Linux命令大全 - 笔下光年
网站首页
pssh
批量管理执行 ## 补充说明 **pssh命令** 是一个python编写可以在多台服务器上执行命令的工具,同时支持拷贝文件,是同类工具中很出色的,类似pdsh,个人认为相对pdsh更为简便,使用必须在各个服务器上配置好密钥认证访问。 ### 安装pssh 在CentOS系统环境下,介绍yum的安装和源码安装的方式: **yum方法** ```shell yum install pssh ``` **编译安装** ```shell wget http://parallel-ssh.googlecode.com/files/pssh-2.3.1.tar.gz tar xf pssh-2.3.1.tar.gz cd pssh-2.3.1/ python setup.py install ``` ### 选项 ```shell --version:查看版本 --help:查看帮助,即此信息 -h:主机文件列表,内容格式”[user@]host[:port]” -H:主机字符串,内容格式”[user@]host[:port]” -:登录使用的用户名 -p:并发的线程数【可选】 -o:输出的文件目录【可选】 -e:错误输入文件【可选】 -t:TIMEOUT 超时时间设置,0无限制【可选】 -O:SSH的选项 -v:详细模式 -A:手动输入密码模式 -x:额外的命令行参数使用空白符号,引号,反斜线处理 -X:额外的命令行参数,单个参数模式,同-x -i:每个服务器内部处理信息输出 -P:打印出服务器返回信息 ``` ### 实例 获取每台服务器的uptime: ```shell # pssh -h ip.txt -i uptime [1] 11:15:03 [SUCCESS] Mar.mars.he 11:15:11 up 4 days, 16:25, 1 user, load average: 0.00, 0.00, 0.00 [2] 11:15:03 [SUCCESS] Jan.mars.he 11:15:12 up 3 days, 23:26, 0 users, load average: 0.00, 0.00, 0.00 [3] 11:15:03 [SUCCESS] Feb.mars.he 11:15:12 up 4 days, 16:26, 2 users, load average: 0.08, 0.02, 0.01 ``` 查看每台服务器上mysql复制IO/SQL线程运行状态信息: ```shell # pssh -h IP.txt -i "/usr/local/mysql/bin/mysql -e 'show slave status \G'"|grep Running: Slave_IO_Running: yes Slave_SQL_Running: Yes Slave_IO_Running: Yes Slave_SQL_Running: Yes Slave_IO_Running: Yes Slave_SQL_Running: Yes ``` 保存每台服务器运行的结果: ```shell # pssh -h IP.txt -i -o /tmp/pssh/ uptime [1] 11:19:47 [SUCCESS] Feb.mars.he 11:19:55 up 4 days, 16:31, 2 users, load average: 0.02, 0.03, 0.00 [2] 11:19:47 [SUCCESS] Jan.mars.he 11:19:56 up 3 days, 23:30, 0 users, load average: 0.01, 0.00, 0.00 [3] 11:19:47 [SUCCESS] Mar.mars.he 11:19:56 up 4 days, 16:30, 1 user, load average: 0.00, 0.00, 0.00 ``` 我们来看一下/tmp/pssh/下的文件及其内容 ```shell # ll /tmp/pssh/ 总用量 12 -rw-r--r--. 1 root root 70 12月 1 11:19 Feb.mars.he -rw-r--r--. 1 root root 70 12月 1 11:19 Jan.mars.he -rw-r--r--. 1 root root 69 12月 1 11:19 Mar.mars.he # cat /tmp/pssh/* 11:19:55 up 4 days, 16:31, 2 users, load average: 0.02, 0.03, 0.00 11:19:56 up 3 days, 23:30, 0 users, load average: 0.01, 0.00, 0.00 11:19:56 up 4 days, 16:30, 1 user, load average: 0.00, 0.00, 0.00 ``` 上面介绍的是pssh命令很少的一部分,大家可以将其用到适合自己的场景,发挥它的最大功效。
上一篇:
ps
下一篇:
pstack