pstree工具可以查看进程的树型结构,tree工具可以查看目录的树形结构
qingsong@db2a:/tmp$ pstree
init-+-atd
|-cron
|-db2fmcd
|-db2syscr-+-db2fmp---4*[{db2fmp}]
| |-db2fmp---3*[{db2fmp}]
| |-db2sysc---13*[{db2sysc}]
| |-3*[db2syscr]
| |-db2vend
| `-{db2syscr}
|-dbus-daemon
|-dhclient
|-dockerd-+-docker-containe---7*[{docker-containe}]
| `-9*[{dockerd}]
|-5*[getty]
|-login---bash
|-master-+-pickup
| `-qmgr
|-mdadm
|-rpc.idmapd
|-rpc.mountd
|-rpc.statd
|-rpcbind
|-rsyslogd---3*[{rsyslogd}]
|-sshd-+-sshd---sshd---bash-+-bash---command-not-fou
| | |-pstree
| | `-sudo
| `-sshd---sshd---bash
|-sudo---su---bash---mysqld---27*[{mysqld}]
|-systemd-logind
|-systemd-udevd
|-upstart-file-br
|-upstart-socket-
|-upstart-udev-br
|-vmtoolsd---{vmtoolsd}
`-vmware-vmblock----4*[{vmware-vmblock-}]
root@db2a:~# pstree -p
init(1)-+-atd(33478)
|-cron(1126)
|-db2fmcd(1385)
|-db2syscr(26240)-+-db2fmp(26788)-+-{db2fmp}(26789)
| | |-{db2fmp}(26790)
| | |-{db2fmp}(26791)
| | `-{db2fmp}(5376)
| |-db2fmp(26256)-+-{db2fmp}(26257)
| | |-{db2fmp}(26258)
| | `-{db2fmp}(26259)
| |-db2sysc(26242)-+-{db2sysc}(26243)
| | |-{db2sysc}(26244)
| | |-{db2sysc}(26245)
| | |-{db2sysc}(26246)
| | |-{db2sysc}(26247)
| | |-{db2sysc}(26251)
| | |-{db2sysc}(26253)
| | |-{db2sysc}(26254)
| | |-{db2sysc}(26770)
| | |-{db2sysc}(5377)
| | |-{db2sysc}(32555)
| | |-{db2sysc}(32558)
| | `-{db2sysc}(35950)
| |-db2syscr(26248)
| |-db2syscr(26249)
| |-db2syscr(26250)
| |-db2vend(26252)
| `-{db2syscr}(26241)
|-dbus-daemon(674)
|-dhclient(893)
|-dockerd(976)-+-docker-containe(1534)-+-{docker-containe}(1535)
| | |-{docker-containe}(1536)
| | |-{docker-containe}(1537)
| | |-{docker-containe}(1538)
| | |-{docker-containe}(1539)
| | |-{docker-containe}(1540)
| | `-{docker-containe}(28885)
| |-{dockerd}(1427)
| |-{dockerd}(1428)
| |-{dockerd}(1429)
| |-{dockerd}(1526)
| |-{dockerd}(1527)
| |-{dockerd}(1546)
| |-{dockerd}(1547)
| |-{dockerd}(1548)
| `-{dockerd}(1656)
|-getty(1076)
|-getty(1079)
|-getty(1082)
|-getty(1083)
|-getty(1085)
|-login(1387)---bash(3712)
|-master(30557)-+-pickup(60705)
| `-qmgr(2244)
|-mdadm(30240)
|-rpc.idmapd(739)
|-rpc.mountd(1218)
|-rpc.statd(863)
|-rpcbind(857)
|-rsyslogd(790)-+-{rsyslogd}(821)
| |-{rsyslogd}(822)
| `-{rsyslogd}(823)
|-sshd(1109)-+-sshd(657)---sshd(678)---bash(679)-+-bash(746)---command-not-fou(747)
| | |-sudo(745)
| | `-sudo(3005)---su(3006)---bash(3007)---pstree(3863)
| `-sshd(24325)---sshd(24345)---bash(24346)
|-sudo(7070)---su(7071)---bash(7072)---mysqld(8845)-+-{mysqld}(8846)
| |-{mysqld}(8847)
| |-{mysqld}(8848)
| |-{mysqld}(8849)
| |-{mysqld}(8850)
| |-{mysqld}(8851)
| |-{mysqld}(8852)
| |-{mysqld}(8853)
| |-{mysqld}(8854)
| |-{mysqld}(8855)
| |-{mysqld}(8856)
| |-{mysqld}(8857)
| |-{mysqld}(8859)
| |-{mysqld}(8860)
| |-{mysqld}(8861)
| |-{mysqld}(8862)
| |-{mysqld}(8863)
| |-{mysqld}(8864)
| |-{mysqld}(8865)
| |-{mysqld}(8866)
| |-{mysqld}(8867)
| |-{mysqld}(8868)
| |-{mysqld}(8869)
| |-{mysqld}(8870)
| |-{mysqld}(8871)
| |-{mysqld}(8872)
| `-{mysqld}(9058)
|-systemd-logind(788)
|-systemd-udevd(497)
|-upstart-file-br(852)
|-upstart-socket-(855)
|-upstart-udev-br(491)
|-vmtoolsd(1443)---{vmtoolsd}(3339)
`-vmware-vmblock-(1401)-+-{vmware-vmblock-}(1404)
|-{vmware-vmblock-}(1405)
|-{vmware-vmblock-}(40323)
`-{vmware-vmblock-}(41493)
root@db2a:~# pstree -p 26240
db2syscr(26240)-+-db2fmp(26788)-+-{db2fmp}(26789)
| |-{db2fmp}(26790)
| |-{db2fmp}(26791)
| `-{db2fmp}(5376)
|-db2fmp(26256)-+-{db2fmp}(26257)
| |-{db2fmp}(26258)
| `-{db2fmp}(26259)
|-db2sysc(26242)-+-{db2sysc}(26243)
| |-{db2sysc}(26244)
| |-{db2sysc}(26245)
| |-{db2sysc}(26246)
| |-{db2sysc}(26247)
| |-{db2sysc}(26251)
| |-{db2sysc}(26253)
| |-{db2sysc}(26254)
| |-{db2sysc}(26770)
| |-{db2sysc}(5377)
| |-{db2sysc}(32555)
| |-{db2sysc}(32558)
| `-{db2sysc}(35950)
|-db2syscr(26248)
|-db2syscr(26249)
|-db2syscr(26250)
|-db2vend(26252)
`-{db2syscr}(26241)
root@db2a:~# tree /tmp
/tmp
|-- 1
|-- 1.out
|-- EXAMPLE.txt
|-- Important\ image.jpg
|-- MongoDBIntro.pdf
|-- New
|-- db2cktsa.log
|-- dir2
| |-- MongoDBIntro.pdf
| |-- latch.out
| |-- latch.sh
| `-- mongodb.rpm
|-- file6
|-- fun.sh
|-- image\ \ 01.jpg
|-- image\ \ 02.jpg
|-- log2.bak -> log2
|-- lv1
| |-- dir1
| | `-- file3
| |-- file1
| |-- file2
| `-- lost+found
|-- lv2
| |-- dir1
| | `-- file3
| |-- file1
| |-- file2
| `-- lost+found
|-- mongo.tar
|-- mongo.taraa
|-- test
| |-- dir2.tar.gz
| |-- im\ age-1.jpg
| |-- mongodb.rpm
| `-- price.sh
|-- test2
| |-- dir2.tar.gz
| `-- price.sh
|-- text.pdf
|-- time_take.sh
|-- timing.log
|-- tmp.9Hs6fScHlN
|-- tmp.LY3ZvKPd6e
|-- txt
| |-- c
| | |-- count.c
| | `-- sample.c
| |-- ed\ -n\ 2,5!p\ test.txt
| |-- err.txt
| |-- fileL.txt
| `-- text.txt
|-- uniqfiles
|-- user.sh
|-- variables.sh
|-- vmware-root
| |-- vmware-apploader-1349.log
| |-- vmware-apploader-1414.log
| `-- vmware-apploader-1443.log
`-- z
15 directories, 45 files
root@db2a:~# tree -h /tmp/txt
/tmp/txt
|-- [4.0K] c
| |-- [ 0] count.c
| `-- [ 0] sample.c
|-- [ 12K] ed\ -n\ 2,5!p\ test.txt
|-- [ 27] err.txt
|-- [ 64] fileL.txt
|-- [ 64] fileU.txt
|-- [ 20] input.txt
|-- [ 12] log.txt
|-- [ 30] output.txt
|-- [ 21] test.txt
`-- [ 6] text.txt
1 directory, 11 files