欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

linux常用命令

程序员文章站 2022-05-10 20:31:45
...

ln 创建硬连接

ln -s  创建软连接(符号连接)

示例:

aaa@qq.com:~/work/filedir$ date > date.txt
aaa@qq.com:~/work/filedir$ ln -s date.txt l_date
aaa@qq.com:~/work/filedir$ ls
a.out  bin  date.txt  include  l_date  obj  src  zieckey_fifo
aaa@qq.com:~/work/filedir$ more l_date
2018年 08月 22日 星期三 21:33:32 CST
aaa@qq.com:~/work/filedir$ 
S_ISLNK(st_mode):是否是一个连接.
S_ISREG(st_mode):是否是一个常规文件.
S_ISDIR(st_mode):是否是一个目录
S_ISCHR(st_mode):是否是一个字符设备.
S_ISBLK(st_mode):是否是一个块设备
S_ISFIFO(st_mode):是否 是一个FIFO文件.
S_ISSOCK(st_mode):是否是一个SOCKET文件 

使用方式:

一般在之前都会先调用函数stat( FileName, &fp)类函数,意味着将FileName这个文件的信息保存到了地址fp中。此时fp.st_mode就是文件FileName的模式,所以S_ISDIR(fp.st_mode)的函数功能是判断fp所指向文件(也就是FileName)是否为目录(dir)类型。

 

使用ps命令查看linux中的进程:

可以使用:ps -ef查看所有的进程,若是进程过多可以使用more进行分页显示;

ps -ef | more

 

使用:

ps -aux | more

查看系统CPU占用资源使用等情况

aaa@qq.com:~$ ps -aux | more
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.1 185416  6036 ?        Ss   17:32   0:01 /sbin/init spla
sh
root         2  0.0  0.0      0     0 ?        S    17:32   0:00 [kthreadd]
root         4  0.0  0.0      0     0 ?        I<   17:32   0:00 [kworker/0:0H]
root         6  0.0  0.0      0     0 ?        I<   17:32   0:00 [mm_percpu_wq]
root         7  0.0  0.0      0     0 ?        S    17:32   0:00 [ksoftirqd/0]
root         8  0.0  0.0      0     0 ?        I    17:32   0:04 [rcu_sched]
root         9  0.0  0.0      0     0 ?        I    17:32   0:00 [rcu_bh]
root        10  0.0  0.0      0     0 ?        S    17:32   0:00 [migration/0]
root        11  0.0  0.0      0     0 ?        S    17:32   0:00 [watchdog/0]
root        12  0.0  0.0      0     0 ?        S    17:32   0:00 [cpuhp/0]
root        13  0.0  0.0      0     0 ?        S    17:32   0:00 [cpuhp/1]
root        14  0.0  0.0      0     0 ?        S    17:32   0:00 [watchdog/1]
root        15  0.0  0.0      0     0 ?        S    17:32   0:00 [migration/1]
root        16  0.0  0.0      0     0 ?        S    17:32   0:00 [ksoftirqd/1]
root        18  0.0  0.0      0     0 ?        I<   17:32   0:00 [kworker/1:0H]
root        19  0.0  0.0      0     0 ?        S    17:32   0:00 [cpuhp/2]
root        20  0.0  0.0      0     0 ?        S    17:32   0:00 [watchdog/2]
root        21  0.0  0.0      0     0 ?        S    17:32   0:00 [migration/2]
root        22  0.0  0.0      0     0 ?        S    17:32   0:00 [ksoftirqd/2]
root        24  0.0  0.0      0     0 ?        I<   17:32   0:00 [kworker/2:0H]
root        25  0.0  0.0      0     0 ?        S    17:32   0:00 [cpuhp/3]

linux常用命令

输入:id

查看当前用户id 等信息

aaa@qq.com:~$ id
uid=1000(andrew) gid=1000(andrew) 组=1000(andrew),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),113(lpadmin),128(sambashare)

ps [选项]
下面对命令选项进行说明:
-e   显示所有进程。
-f    全格式。
-h   不显示标题。
-l    长格式。
-w  宽输出。
a    显示终端上的所有进程,包括其他用户的进程。
r    只显示正在运行的进程。

u  以用户为主的格式来显示程序状况。

x     显示所有程序,不以终端机来区分。


ps -ef 显示出的结果:

    1.UID       用户ID
    2.PID        进程ID
    3.PPID      父进程ID
    4.C           CPU占用率
    5.STIME     开始时间
    6.TTY         开始此进程的TTY----终端设备
    7.TIME       此进程运行的总时间
    8.CMD       命令名

 

pstree命令,使用pstree命令课可以查看进程树:

systemd-+-NetworkManager-+-2*[dhclient]
        |                |-dnsmasq
        |                |-{gdbus}
        |                `-{gmain}
        |-accounts-daemon-+-{gdbus}
        |                 `-{gmain}
        |-acpid
        |-atd
        |-avahi-daemon---avahi-daemon
        |-colord-+-{gdbus}
        |        `-{gmain}
        |-cron
        |-cups-browsed-+-{gdbus}
        |              `-{gmain}
        |-cupsd---9*[dbus]
        |-dbus-daemon
        |-gnome-keyring-d-+-{dispatch}
        |                 |-{gdbus}
        |                 |-{gmain}
        |                 `-{timer}
        |-irqbalance
        |-lightdm-+-Xorg---{InputThread}
        |         |-lightdm-+-upstart-+-MindMaster-+-QtWebEngineProc---QtWebEngineProc---3*[QtWebEngineProc-+-{Chrome_ChildIOT}]
        |         |         |         |            |                                                        |-3*[{CompositorTileW}]+
        |         |         |         |            |                                                        |-{Compositor}]
        |         |         |         |            |                                                        |-{HTMLParserThrea}]
        |         |         |         |            |                                                        |-{Renderer::FILE}]
        |         |         |         |            |                                                        `-{ScriptStreamerT}]
        |         |         |         |            |-{AudioThread}
        |         |         |         |            |-{BrowserBlocking}
        |         |         |         |            |-{Chrome_CacheThr}
        |         |         |         |            |-{Chrome_ChildIOT}
        |         |         |         |            |-{Chrome_DBThread}
        |         |         |         |            |-{Chrome_FileThre}
        |         |         |         |            |-{Chrome_FileUser}
        |         |         |         |            |-{Chrome_IOThread}
        |         |         |         |            |-{Chrome_InProcGp}
        |         |         |         |            |-{Chrome_ProcessL}
        |         |         |         |            |-{CompositorTileW}
        |         |         |         |            |-{IndexedDB}
        |         |         |         |            |-{MindMaster}
        |         |         |         |            |-{NetworkChangeNo}
        |         |         |         |            |-{QDBusConnection}
        |         |         |         |            |-{QNetworkAccessM}
        |         |         |         |            |-{QXcbEventReader}
        |         |         |         |            |-{Qt bearer threa}
        |         |         |         |            |-{inotify_reader}
        |         |         |         |            |-{sandbox_ipc_thr}
        |         |         |         |            `-{threaded-ml}
        |         |         |         |-at-spi-bus-laun-+-dbus-daemon
        |         |         |         |                 |-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-at-spi2-registr-+-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-bamfdaemon-+-{dconf worker}
        |         |         |         |            |-{gdbus}
        |         |         |         |            `-{gmain}
        |         |         |         |-code-+-code-+-code-+-2*[code-+-{TaskSchedulerSe}]
        |         |         |         |      |      |      |         `-7*[{code}]]
        |         |         |         |      |      |      |-code-+-Microsoft.VSCod-+-2*[Microsoft.VSCod---7*[{Microsoft.VSCod}]]
        |         |         |         |      |      |      |      |                 `-16*[{Microsoft.VSCod}]
        |         |         |         |      |      |      |      |-{TaskSchedulerSe}
        |         |         |         |      |      |      |      `-8*[{code}]
        |         |         |         |      |      |      |-{Chrome_ChildIOT}
        |         |         |         |      |      |      |-3*[{CompositorTileW}]
        |         |         |         |      |      |      |-{Compositor}
        |         |         |         |      |      |      |-{GpuMemoryThread}
        |         |         |         |      |      |      |-{Renderer::FILE}
        |         |         |         |      |      |      |-{TaskSchedulerRe}
        |         |         |         |      |      |      |-{TaskSchedulerSe}
        |         |         |         |      |      |      `-9*[{code}]
        |         |         |         |      |      `-code-+-{Chrome_ChildIOT}
        |         |         |         |      |             |-3*[{CompositorTileW}]
        |         |         |         |      |             |-{Compositor}
        |         |         |         |      |             |-{GpuMemoryThread}
        |         |         |         |      |             |-{Renderer::FILE}
        |         |         |         |      |             |-{TaskSchedulerRe}
        |         |         |         |      |             |-{TaskSchedulerSe}
        |         |         |         |      |             `-7*[{code}]
        |         |         |         |      |-code-+-{Chrome_ChildIOT}
        |         |         |         |      |      |-{TaskSchedulerCo}
        |         |         |         |      |      |-{TaskSchedulerSe}
        |         |         |         |      |      `-{Watchdog}
        |         |         |         |      |-{AudioThread}
        |         |         |         |      |-{Chrome_IOThread}
        |         |         |         |      |-{CompositorTileW}
        |         |         |         |      |-{CrShutdownDetec}
        |         |         |         |      |-{D-Bus thread}
        |         |         |         |      |-{NetworkChangeNo}
        |         |         |         |      |-2*[{TaskSchedulerBa}]
        |         |         |         |      |-2*[{TaskSchedulerFo}]
        |         |         |         |      |-{TaskSchedulerSe}
        |         |         |         |      |-6*[{TaskSchedulerSi}]
        |         |         |         |      |-9*[{code}]
        |         |         |         |      |-{dconf worker}
        |         |         |         |      |-{gdbus}
        |         |         |         |      |-{gmain}
        |         |         |         |      |-{inotify_reader}
        |         |         |         |      |-{sandbox_ipc_thr}
        |         |         |         |      `-{threaded-ml}
        |         |         |         |-compiz-+-{dconf worker}
        |         |         |         |        |-{gdbus}
        |         |         |         |        |-{gmain}
        |         |         |         |        `-4*[{pool}]
        |         |         |         |-2*[dbus-daemon]
        |         |         |         |-dconf-service-+-{gdbus}
        |         |         |         |               `-{gmain}
        |         |         |         |-evolution-addre-+-evolution-addre-+-{dconf worker}
        |         |         |         |                 |                 |-{evolution-addre}
        |         |         |         |                 |                 |-{gdbus}
        |         |         |         |                 |                 `-{gmain}
        |         |         |         |                 |-{dconf worker}
        |         |         |         |                 |-{evolution-addre}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-evolution-calen-+-evolution-calen-+-{dconf worker}
        |         |         |         |                 |                 |-{evolution-calen}
        |         |         |         |                 |                 |-{gdbus}
        |         |         |         |                 |                 `-{gmain}
        |         |         |         |                 |-evolution-calen-+-{dconf worker}
        |         |         |         |                 |                 |-2*[{evolution-calen}]
        |         |         |         |                 |                 |-{gdbus}
        |         |         |         |                 |                 |-{gmain}
        |         |         |         |                 |                 `-{pool}
        |         |         |         |                 |-{dconf worker}
        |         |         |         |                 |-{evolution-calen}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-evolution-sourc-+-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-fcitx---2*[{fcitx}]
        |         |         |         |-fcitx-dbus-watc
        |         |         |         |-firefox-+-2*[Web Content-+-{Chrome_~dThread}]
        |         |         |         |         |                |-{DOM File}]
        |         |         |         |         |                |-{DOM Worker}]
        |         |         |         |         |                |-{HTML5 Parser}]
        |         |         |         |         |                |-{Hang Monitor}]
        |         |         |         |         |                |-{ImageBr~geChild}]
        |         |         |         |         |                |-{ImageIO}]
        |         |         |         |         |                |-{ImgDecoder #1}]
        |         |         |         |         |                |-{ImgDecoder #2}]
        |         |         |         |         |                |-4*[{JS Helper}]]
        |         |         |         |         |                |-{JS Watchdog}]
        |         |         |         |         |                |-{ProcessHangMon}]
        |         |         |         |         |                |-{ProfilerChild}]
        |         |         |         |         |                |-{Socket Thread}]
        |         |         |         |         |                |-{StyleThread#0}]
        |         |         |         |         |                |-{StyleThread#1}]
        |         |         |         |         |                |-{StyleThread#2}]
        |         |         |         |         |                |-{Timer}]
        |         |         |         |         |                |-{VideoChild}]
        |         |         |         |         |                `-{dconf worker}]
        |         |         |         |         |-Web Content-+-{Chrome_~dThread}
        |         |         |         |         |             |-{DOM File}
        |         |         |         |         |             |-{Hang Monitor}
        |         |         |         |         |             |-{ImageBr~geChild}
        |         |         |         |         |             |-{ImageIO}
        |         |         |         |         |             |-{ImgDecoder #1}
        |         |         |         |         |             |-4*[{JS Helper}]
        |         |         |         |         |             |-{JS Watchdog}
        |         |         |         |         |             |-{ProcessHangMon}
        |         |         |         |         |             |-{ProfilerChild}
        |         |         |         |         |             |-{Socket Thread}
        |         |         |         |         |             |-{Timer}
        |         |         |         |         |             |-{VideoChild}
        |         |         |         |         |             `-{dconf worker}
        |         |         |         |         |-{AudioIPC Callba}
        |         |         |         |         |-{AudioIPC Server}
        |         |         |         |         |-{Cache I/O}
        |         |         |         |         |-{Cache2 I/O}
        |         |         |         |         |-{Classif~ Update}
        |         |         |         |         |-{Compositor}
        |         |         |         |         |-{Cookie}
        |         |         |         |         |-3*[{DOM Worker}]
        |         |         |         |         |-4*[{DataStorage}]
        |         |         |         |         |-{FS Broker 12985}
        |         |         |         |         |-{FS Broker 4846}
        |         |         |         |         |-{FS Broker 4917}
        |         |         |         |         |-{FileBlockCache}
        |         |         |         |         |-{GMPThread}
        |         |         |         |         |-{Gecko_IOThread}
        |         |         |         |         |-{HTML5 Parser}
        |         |         |         |         |-{Hang Monitor}
        |         |         |         |         |-{IPDL Background}
        |         |         |         |         |-{ImageBr~geChild}
        |         |         |         |         |-{ImageIO}
        |         |         |         |         |-{ImgDecoder #1}
        |         |         |         |         |-{ImgDecoder #2}
        |         |         |         |         |-4*[{JS Helper}]
        |         |         |         |         |-{JS Watchdog}
        |         |         |         |         |-{Link Monitor}
        |         |         |         |         |-{LoadRoots}
        |         |         |         |         |-{MediaCache}
        |         |         |         |         |-{ProcessHangMon}
        |         |         |         |         |-{ProxyResolution}
        |         |         |         |         |-{QuotaManager IO}
        |         |         |         |         |-{SaveScripts}
        |         |         |         |         |-{Socket Thread}
        |         |         |         |         |-{Softwar~cThread}
        |         |         |         |         |-{StyleThread#0}
        |         |         |         |         |-{StyleThread#1}
        |         |         |         |         |-{StyleThread#2}
        |         |         |         |         |-{SysProxySetting}
        |         |         |         |         |-{Timer}
        |         |         |         |         |-{URL Classifier}
        |         |         |         |         |-{VRListener}
        |         |         |         |         |-{dconf worker}
        |         |         |         |         |-2*[{firefox}]
        |         |         |         |         |-{gdbus}
        |         |         |         |         |-{gmain}
        |         |         |         |         |-{localStorage DB}
        |         |         |         |         |-{mozStorage #1}
        |         |         |         |         |-{mozStorage #2}
        |         |         |         |         |-{mozStorage #3}
        |         |         |         |         |-{mozStorage #4}
        |         |         |         |         |-{mozStorage #5}
        |         |         |         |         |-{mozStorage #6}
        |         |         |         |         |-{mozStorage #7}
        |         |         |         |         `-{threaded-ml}
        |         |         |         |-gconfd-2
        |         |         |         |-gnome-session-b-+-deja-dup-monito-+-{dconf worker}
        |         |         |         |                 |                 |-{gdbus}
        |         |         |         |                 |                 `-{gmain}
        |         |         |         |                 |-gnome-software-+-{dconf worker}
        |         |         |         |                 |                |-{gdbus}
        |         |         |         |                 |                `-{gmain}
        |         |         |         |                 |-nautilus-+-{dconf worker}
        |         |         |         |                 |          |-{gdbus}
        |         |         |         |                 |          |-{gmain}
        |         |         |         |                 |          `-{pool}
        |         |         |         |                 |-nm-applet-+-{dconf worker}
        |         |         |         |                 |           |-{gdbus}
        |         |         |         |                 |           `-{gmain}
        |         |         |         |                 |-polkit-gnome-au-+-{dconf worker}
        |         |         |         |                 |                 |-{gdbus}
        |         |         |         |                 |                 `-{gmain}
        |         |         |         |                 |-unity-fallback--+-{dconf worker}
        |         |         |         |                 |                 |-{gdbus}
        |         |         |         |                 |                 `-{gmain}
        |         |         |         |                 |-update-notifier-+-{dconf worker}
        |         |         |         |                 |                 |-{gdbus}
        |         |         |         |                 |                 `-{gmain}
        |         |         |         |                 |-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-gnome-terminal--+-bash-+-pstree
        |         |         |         |                 |      `-vim
        |         |         |         |                 |-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-gpg-agent
        |         |         |         |-gvfs-afc-volume-+-{gdbus}
        |         |         |         |                 |-{gmain}
        |         |         |         |                 `-{gvfs-afc-volume}
        |         |         |         |-gvfs-goa-volume-+-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-gvfs-gphoto2-vo-+-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-gvfs-mtp-volume-+-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-gvfs-udisks2-vo-+-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-gvfsd-+-{gdbus}
        |         |         |         |       `-{gmain}
        |         |         |         |-gvfsd-dnssd-+-{gdbus}
        |         |         |         |             `-{gmain}
        |         |         |         |-gvfsd-fuse-+-{gdbus}
        |         |         |         |            |-{gmain}
        |         |         |         |            |-{gvfs-fuse-sub}
        |         |         |         |            `-2*[{gvfsd-fuse}]
        |         |         |         |-gvfsd-metadata-+-{gdbus}
        |         |         |         |                `-{gmain}
        |         |         |         |-gvfsd-network-+-{dconf worker}
        |         |         |         |               |-{gdbus}
        |         |         |         |               `-{gmain}
        |         |         |         |-gvfsd-smb-brows-+-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-gvfsd-trash-+-{gdbus}
        |         |         |         |             `-{gmain}
        |         |         |         |-hud-service-+-{dconf worker}
        |         |         |         |             |-{gdbus}
        |         |         |         |             `-{gmain}
        |         |         |         |-indicator-appli-+-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-indicator-bluet-+-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-indicator-datet-+-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 |-{gmain}
        |         |         |         |                 |-{indicator-datet}
        |         |         |         |                 `-{pool}
        |         |         |         |-indicator-keybo-+-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-indicator-messa-+-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-indicator-power-+-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-indicator-print-+-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-indicator-sessi-+-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-indicator-sound-+-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-netease-cloud-m-+-netease-cloud-m---netease-cloud-m-+-{Chrome_ChildIOT}
        |         |         |         |                 |                                   |-3*[{CompositorTileW}]
        |         |         |         |                 |                                   |-{Compositor}
        |         |         |         |                 |                                   |-{GpuMemoryThread}
        |         |         |         |                 |                                   |-{Media}
        |         |         |         |                 |                                   |-{Renderer::FILE}
        |         |         |         |                 |                                   |-{ScriptStreamerT}
        |         |         |         |                 |                                   |-2*[{TaskSchedulerRe}]
        |         |         |         |                 |                                   `-{TaskSchedulerSe}
        |         |         |         |                 |-{AudioThread}
        |         |         |         |                 |-{BrowserBlocking}
        |         |         |         |                 |-5*[{CachePoolWorker}]
        |         |         |         |                 |-{Chrome_CacheThr}
        |         |         |         |                 |-{Chrome_DBThread}
        |         |         |         |                 |-{Chrome_FileThre}
        |         |         |         |                 |-{Chrome_FileUser}
        |         |         |         |                 |-{Chrome_IOThread}
        |         |         |         |                 |-{Chrome_ProcessL}
        |         |         |         |                 |-{CompositorTileW}
        |         |         |         |                 |-{IndexedDB}
        |         |         |         |                 |-{NetworkChangeNo}
        |         |         |         |                 |-{QDBusConnection}
        |         |         |         |                 |-3*[{QNetworkAccessM}]
        |         |         |         |                 |-10*[{QThread}]
        |         |         |         |                 |-{QXcbEventReader}
        |         |         |         |                 |-{Qt bearer threa}
        |         |         |         |                 |-2*[{TaskSchedulerBa}]
        |         |         |         |                 |-2*[{TaskSchedulerFo}]
        |         |         |         |                 |-{TaskSchedulerSe}
        |         |         |         |                 |-2*[{WorkerPool/1272}]
        |         |         |         |                 |-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 |-{gmain}
        |         |         |         |                 |-{inotify_reader}
        |         |         |         |                 |-2*[{netease-cloud-m}]
        |         |         |         |                 |-{sandbox_ipc_thr}
        |         |         |         |                 `-2*[{threaded-ml}]
        |         |         |         |-notify-osd-+-{dconf worker}
        |         |         |         |            |-{gdbus}
        |         |         |         |            `-{gmain}
        |         |         |         |-pulseaudio-+-{alsa-sink-ALC26}
        |         |         |         |            `-{alsa-source-ALC}
        |         |         |         |-sh---zeitgeist-daemo-+-{gdbus}
        |         |         |         |                      `-{gmain}
        |         |         |         |-sogou-qimpanel-+-3*[{QInotifyFileSys}]
        |         |         |         |                |-2*[{QThread}]
        |         |         |         |                `-5*[{sogou-qimpanel}]
        |         |         |         |-sogou-qimpanel-
        |         |         |         |-unity-files-dae-+-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 |-{gmain}
        |         |         |         |                 `-4*[{pool}]
        |         |         |         |-unity-panel-ser-+-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-unity-scope-hom-+-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-unity-scope-loa-+-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 `-{gmain}
        |         |         |         |-unity-settings--+-syndaemon
        |         |         |         |                 |-{dconf worker}
        |         |         |         |                 |-{gdbus}
        |         |         |         |                 |-{gmain}
        |         |         |         |                 `-{threaded-ml}
        |         |         |         |-2*[upstart-dbus-br]
        |         |         |         |-upstart-file-br
        |         |         |         |-upstart-udev-br
        |         |         |         |-window-stack-br
        |         |         |         |-zeitgeist-datah-+-{gdbus}
        |         |         |         |                 |-{gmain}
        |         |         |         |                 `-4*[{pool}]
        |         |         |         `-zeitgeist-fts-+-{gdbus}
        |         |         |                         `-{gmain}
        |         |         |-{gdbus}
        |         |         `-{gmain}
        |         |-{gdbus}
        |         `-{gmain}
        |-nmbd
        |-plymouth
        |-plymouthd
        |-polkitd-+-{gdbus}
        |         `-{gmain}
        |-rsyslogd-+-{in:imklog}
        |          |-{in:imuxsock}
        |          `-{rs:main Q:Reg}
        |-rtkit-daemon---2*[{rtkit-daemon}]
        |-smbd---5*[smbd]
        |-snapd---9*[{snapd}]
        |-systemd---(sd-pam)
        |-systemd-journal
        |-systemd-logind
        |-systemd-timesyn---{sd-resolve}
        |-systemd-udevd
        |-thermald---{thermald}
        |-udisksd-+-{cleanup}
        |         |-{gdbus}
        |         |-{gmain}
        |         `-{probing-thread}
        |-upowerd-+-{gdbus}
        |         `-{gmain}
        |-whoopsie-+-{gdbus}
        |          `-{gmain}
        `-wpa_supplicant
kill -l
1) SIGHUP     2) SIGINT     3) SIGQUIT     4) SIGILL     5) SIGTRAP
6) SIGABRT     7) SIGBUS     8) SIGFPE     9) SIGKILL    10) SIGUSR1
11) SIGSEGV    12) SIGUSR2    13) SIGPIPE    14) SIGALRM    15) SIGTERM
16) SIGSTKFLT    17) SIGCHLD    18) SIGCONT    19) SIGSTOP    20) SIGTSTP
21) SIGTTIN    22) SIGTTOU    23) SIGURG    24) SIGXCPU    25) SIGXFSZ
26) SIGVTALRM    27) SIGPROF    28) SIGWINCH    29) SIGIO    30) SIGPWR
31) SIGSYS    34) SIGRTMIN    35) SIGRTMIN+1    36) SIGRTMIN+2    37) SIGRTMIN+3
38) SIGRTMIN+4    39) SIGRTMIN+5    40) SIGRTMIN+6    41) SIGRTMIN+7    42) SIGRTMIN+8
43) SIGRTMIN+9    44) SIGRTMIN+10    45) SIGRTMIN+11    46) SIGRTMIN+12    47) SIGRTMIN+13
48) SIGRTMIN+14    49) SIGRTMIN+15    50) SIGRTMAX-14    51) SIGRTMAX-13    52) SIGRTMAX-12
53) SIGRTMAX-11    54) SIGRTMAX-10    55) SIGRTMAX-9    56) SIGRTMAX-8    57) SIGRTMAX-7
58) SIGRTMAX-6    59) SIGRTMAX-5    60) SIGRTMAX-4    61) SIGRTMAX-3    62) SIGRTMAX-2
63) SIGRTMAX-1    64) SIGRTMAX

语法

kill [-s <信息名称或编号>][程序] 或 kill [-l <信息编号>]

参数说明

  • -l <信息编号>  若不加<信息编号>选项,则-l参数会列出全部的信息名称。
  • -s <信息名称或编号>  指定要送出的信息。
  • [程序]  [程序]可以是程序的PID或是PGID,也可以是工作编号。

杀死进程

# kill 12345

强制杀死进程

# kill -KILL 123456

发送SIGHUP信号,可以使用一下信号

# kill -HUP pid

彻底杀死进程

# kill -9 123456

NC命令

测试协议的时候若是没有数据抓包可一下linux上自己创造,比如使用:
nc 命令:
可以使用linux自带的nc命令进行聊天,再使用wireshark进行抓包;

    nc -l 1234 # Server 1
    nc 127.0.0.1 1234 # 127.0.0.1 换成 Server 1 的 IP 即可.


   打开两个终端之后,就可以直接进行相互之间的通话了,想结束聊天可以使用^D (Ctrl + D)
扫描PORT看那个Port是开放的
 

  nc -v -w 2 localhost -z 30-80

  localhost [127.0.0.1] 80 (http) open
  localhost [127.0.0.1] 53 (domain) open

传送资料

    cat filename | nc -l 9090 # 通过 9090 port 传送 filename 的档案内容
    nc localhost 9090 # 接收 9090 port 传来档案内容

档案传送

   

nc -l 1234 > filename # 接收 Server 先建立 (Port: 1234)
nc 127.0.0.1 1234 < test.txt # 传送 Server 然后建立连接并产送档案的内容. (要是使用的是其他                                    的IP将127.0.0.1换成要使用的额IP)
Server 端加密: nc localhost 1567 | mcrypt –flush –bare -F -q -d -m ecb > file.txt
Client 端解密: mcrypt –flush –bare -F -q -m ecb < file.txt | nc -l 1567

nc 与 telnet 连通

   

nc -l 1234 # 建立 1234 port socket server
telnet localhost 1234 # 連到 socket server
# 再來互相打字, 都可以相互接收
Server 直接打開一個 Shell: nc -l 1567 -e /bin/bash -i
Client 連進來: nc 172.31.100.7 1567

nc 跑影音流

      

  Server: cat video.avi | nc -l 1567
  Client: nc localhost 1567 | mplayer -vo x11 -cache 3000 -

1.iso镜像就是将文件包括文件系统本身制作成一个后后缀为iso的文件
在ubuntu上使用cat命令制作ios镜像
2.查看iso文件


1.
cat /dev/cdrom > a.iso   将cdrom中的文件制作成iso文件
想要查看一个iso文件的时候使用:
mount -t iso9660 -o loop a.iso /mnt
然后iso文件就会出现在 /mnt目录下,因为iso文件是二进制文件,因此必须加 -o 将其虚拟成回环文件