码迷,mamicode.com
首页 > 系统相关 > 详细

【Linux】Re01

时间:2020-12-03 12:14:19      阅读:7      评论:0      收藏:0      [点我收藏+]

标签:http   fuser   pdo   hostname   图片   last   toc   cmd   ttys0   

一、三种网络模式

https://www.bilibili.com/video/BV1Sv411r7vd?p=7

1、桥接模式

该虚拟机和宿主机同一网段,和外部网络相通,但是占用网段地址资源,IP分配有限

2、NAT模式

建立了独立网路IP地址,通过宿主机代理访问外部网路,非宿主同一网段

但是外部网络无法访问该虚拟机

3、主机模式

独立的操作系统

技术图片

 

二、VmTool 文件共享

只安装终端方式的VM已经把工具弄好了

然后实现文件共享只需要把宿主机的目录挂载出来

技术图片

在Linux的挂载目录在这里:

/mnt/hgfs/share-doc

share-doc是共享的目录名

在linux这个目录中编辑一个新文件,在宿主机windows这里也会出现对应的新文件

[root@localhost hgfs]# cd share-doc
[root@localhost share-doc]# vim aa.txt
[root@localhost share-doc]# 

技术图片

 

三、目录结构:

[root@localhost /]# ll
总用量 20
lrwxrwxrwx.   1 root root    7 11月 28 10:40 bin -> usr/bin
dr-xr-xr-x.   5 root root 4096 11月 29 10:17 boot
drwxr-xr-x.  20 root root 3260 11月 29 10:23 dev
drwxr-xr-x.  82 root root 8192 11月 29 10:44 etc
drwxr-xr-x.   2 root root    6 4月  11 2018 home
lrwxrwxrwx.   1 root root    7 11月 28 10:40 lib -> usr/lib
lrwxrwxrwx.   1 root root    9 11月 28 10:40 lib64 -> usr/lib64
drwxr-xr-x.   2 root root    6 4月  11 2018 media
drwxr-xr-x.   3 root root   18 11月 28 12:13 mnt
drwxr-xr-x.   3 root root   16 11月 29 10:44 opt
dr-xr-xr-x. 153 root root    0 11月 29 10:23 proc
dr-xr-x---.   2 root root  199 11月 29 10:36 root
drwxr-xr-x.  25 root root  740 11月 29 10:44 run
lrwxrwxrwx.   1 root root    8 11月 28 10:40 sbin -> usr/sbin
drwxr-xr-x.   2 root root    6 4月  11 2018 srv
dr-xr-xr-x.  13 root root    0 11月 29 10:23 sys
drwxrwxrwt.  14 root root 4096 11月 29 10:44 tmp
drwxr-xr-x.  13 root root  155 11月 28 10:40 usr
drwxr-xr-x.  19 root root  267 11月 28 10:54 var

/bin目录 binary缩写,存放经常使用的命令脚本,我们所写的命令其实也是基于这些脚本文件实现的

[root@localhost /]# ls /bin
[                          cksum                               dwp                          gio-querymodules-64         infocmp            luac                nl-addr-list           perl                      rename                 sg                    shuf                            teamnl                vmware-checkvm
a2p                        clean-binary-files                  echo                         glib-compile-schemas        infokey            lz4                 nl-class-add           perl5.16.3                renice                 sg_compare_and_write  signver                         tee                   vmware-hgfsclient
abs2rel                    clear                               egrep                        gmake                       infotocap          lz4c                nl-class-delete        perlbug                   rescan-scsi-bus.sh     sg_copy_results       size                            test                  vmware-namespace-cmd
addr2line                  cmp                                 eject                        gneqn                       install            lz4cat              nl-classid-lookup      perldoc                   reset                  sg_dd                 skill                           testgdbm              vmware-rpctool
alias                      cmsutil                             elfedit                      gnroff                      ionice             machinectl          nl-class-list          perlthanks                resizecons             sg_decode_sense       slabinfo                        tic                   vmware-toolbox-cmd
alt-java                   col                                 env                          gpasswd                     ipcalc             mailq               nl-cls-add             pflags                    rev                    sg_emc_trespass       slabtop                         timedatectl           vmware-vgauth-cmd
apropos                    colcrt                              envsubst                     gpg                         ipcmk              mailq.postfix       nl-cls-delete          pgawk                     rm                     sg_format             sleep                           timeout               vmware-xferlogs
ar                         colrm                               eqn                          gpg2                        ipcrm              make                nl-cls-list            pgrep                     rmail                  sg_get_config         slogin                          tload                 vxloader
arch                       column                              ex                           gpg-agent                   ipcs               makedb              nl-fib-lookup          pic                       rmail.postfix          sg_get_lba_status     snice                           tmon                  w
as                         comm                                expand                       gpgconf                     iptables-xml       man                 nl-link-enslave        piconv                    rmdir                  sg_ident              soelim                          tnameserv             wait
aserver                    command                             expr                         gpg-connect-agent           isosize            mandb               nl-link-ifindex2name   pinentry                  rmid                   sginfo                sort                            toe                   wall
audit2allow                coredumpctl                         factor                       gpg-error                   java               manpath             nl-link-list           pinentry-curses           rmiregistry            sg_inq                sotruss                         top                   watch
audit2why                  cp                                  fallocate                    gpgparsemail                jjs                mapscrn             nl-link-name2ifindex   ping                      rpcgen                 sg_logs               splain                          touch                 watchgnupg
aulast                     cpio                                false                        gpgsplit                    jobs               mcookie             nl-link-release        ping6                     rpm                    sg_luns               split                           tput                  wc
aulastlog                  cpp                                 fc                           gpgv                        join               md5sum              nl-link-set            pinky                     rpm2cpio               sg_map                sprof                           tr                    wdctl
ausyscall                  cpupower                            fc-cache                     gpgv2                       journalctl         mesg                nl-link-stats          pk12util                  rpmdb                  sg_map26              sqlite3                         tracepath             wget
auvirt                     create-jar-links                    fc-cache-64                  gpg-zip                     jvmjar             mixartloader        nl-list-caches         pkaction                  rpmkeys                sgm_dd                ssh                             tracepath6            whatis
awk                        crlutil                             fc-cat                       gpic                        kbdinfo            mkdir               nl-list-sockets        pkcheck                   rpmquery               sg_modes              ssh-add                         troff                 whereis
base64                     crontab                             fc-conflist                  gprof                       kbd_mode           mkfifo              nl-monitor             pkexec                    rpmverify              sg_opcodes            ssh-agent                       true                  which
basename                   csplit                              fc-list                      gr2fonttest                 kbdrate            mkfontdir           nl-neigh-add           pkg-config                rsyslog-recover-qi.pl  sgp_dd                ssh-copy-id                     truncate              whiptail
bash                       csslint-0.6                         fc-match                     grep                        kdumpctl           mkfontscale         nl-neigh-delete        pkill                     runcon                 sg_persist            ssh-keygen                      trust                 who
bashbug                    curl                                fc-pattern                   groff                       kernel-install     mkinitrd            nl-neigh-list          pkla-admin-identities     run-parts              sg_prevent            ssh-keyscan                     tset                  whoami
bashbug-64                 cut                                 fc-query                     grops                       keytool            mknod               nl-neightbl-list       pkla-check-authorization  rvi                    sg_raw                ssltap                          tsort                 withsctp
bc                         cvtsudoers                          fc-scan                      grotty                      kill               mktemp              nl-pktloc-lookup       pkttyagent                rview                  sg_rbuf               stat                            ttmkfdir              write
bdftopcf                   date                                fc-validate                  groups                      kmod               modutil             nl-qdisc-add           pl2pm                     rvim                   sg_rdac               stdbuf                          tty                   x86_64
bdftruncate                db_archive                          fg                           grub2-editenv               last               more                nl-qdisc-delete        pldd                      s2p                    sg_read               strings                         turbostat             x86_64-redhat-linux-gcc
bg                         db_checkpoint                       fgconsole                    grub2-file                  lastb              mount               nl-qdisc-list          plymouth                  sandbox                sg_read_block_limits  strip                           tzselect              x86_energy_perf_policy
bond2team                  db_deadlock                         fgrep                        grub2-fstest                lastlog            mountpoint          nl-route-add           pmap                      scl                    sg_read_buffer        stty                            ucs2any               xargs
bootctl                    db_dump                             file                         grub2-glue-efi              lchfn              msgattrib           nl-route-delete        pod2html                  scl_enabled            sg_readcap            su                              udevadm               xgettext
build-classpath            db_dump185                          find                         grub2-kbdcomp               lchsh              msgcat              nl-route-get           pod2man                   scl_source             sg_read_long          sudo                            ul                    xmlcatalog
build-classpath-directory  db_hotbackup                        find2perl                    grub2-menulst2cfg           ld                 msgcmp              nl-route-list          pod2text                  scp                    sg_reassign           sudoedit                        ulockmgr_server       xmllint
build-jar-repository       db_load                             find-jar                     grub2-mkfont                ld.bfd             msgcomm             nl-rule-list           pod2usage                 script                 sg_referrals          sudoreplay                      umask                 xmlsec1
busctl                     db_log_verify                       findmnt                      grub2-mkimage               ldd                msgconv             nl-tctree-list         policytool                scriptreplay           sg_requests           sum                             umount                xmlwf
c2ph                       db_printlog                         fipscheck                    grub2-mklayout              ld.gold            msgen               nl-util-addr           post-grohtml              scsi_logging_level     sg_reset              sync                            unalias               xmvn-builddep
c89                        db_recover                          fipshmac                     grub2-mknetdir              less               msgexec             nm                     powernow-k8-decode        scsi_mandat            sg_rmsn               systemctl                       uname                 xorg-x11-fonts-update-dirs
c99                        db_replicate                        firewall-cmd                 grub2-mkpasswd-pbkdf2       lessecho           msgfilter           nmcli                  pr                        scsi_readcap           sg_rtpg               systemd-analyze                 unexpand              xsltproc
cairo-sphinx               db_stat                             firewall-offline-cmd         grub2-mkrelpath             lesskey            msgfmt              nm-online              preconv                   scsi_ready             sg_safte              systemd-ask-password            unicode_start         xxd
cal                        db_tuner                            flock                        grub2-mkrescue              lesspipe.sh        msggrep             nmtui                  pre-grohtml               scsi-rescan            sg_sanitize           systemd-cat                     unicode_stop          xz
ca-legacy                  db_upgrade                          fmt                          grub2-mkstandalone          lexgrog            msghack             nmtui-connect          printenv                  scsi_satl              sg_sat_identify       systemd-cgls                    uniq                  xzcat
captoinfo                  dbus-binding-tool                   fold                         grub2-render-label          link               msginit             nmtui-edit             printf                    scsi_start             sg_sat_phy_event      systemd-cgtop                   unlink                xzcmp
cat                        dbus-cleanup-sockets                fonttosfnt                   grub2-script-check          linux32            msgmerge            nmtui-hostname         prlimit                   scsi_stop              sg_sat_set_features   systemd-coredumpctl             unlz4                 xzdec
catchsegv                  dbus-daemon                         free                         grub2-syslinux2cfg          linux64            msgunfmt            nohup                  ps                        scsi_temperature       sg_scan               systemd-delta                   unpack200             xzdiff
catman                     dbus-monitor                        fribidi                      gsettings                   linux-boot-prober  msguniq             nproc                  psed                      sctp_darn              sg_senddiag           systemd-detect-virt             unshare               xzegrep
cc                         dbus-run-session                    fusermount                   gsoelim                     ln                 mv                  nroff                  psfaddtable               sctp_status            sg_ses                systemd-escape                  unxz                  xzfgrep
cd                         dbus-send                           gapplication                 gtar                        loadkeys           namei               nsenter                psfgettable               sctp_test              sg_start              systemd-firstboot               update-ca-trust       xzgrep
centrino-decode            dbus-test-tool                      gawk                         gtbl                        loadunimap         ndptool             nss-policy-check       psfstriptable             sdiff                  sg_stpg               systemd-hwdb                    update-gtk-immodules  xzless
certutil                   dbus-update-activation-environment  gcc                          gtk-query-immodules-2.0-64  locale             neqn                numfmt                 psfxtable                 secon                  sg_sync               systemd-inhibit                 update-mime-database  xzmore
c++filt                    dbus-uuidgen                        gcc-ar                       gtk-update-icon-cache       localectl          newaliases          objcopy                pstruct                   sed                    sg_test_rwbuf         systemd-loginctl                uptime                yes
chacl                      db_verify                           gcc-nm                       gtroff                      localedef          newaliases.postfix  objdump                ptaskset                  sedismod               sg_turs               systemd-machine-id-setup        urlgrabber            ypdomainname
chage                      dc                                  gcc-ranlib                   gunzip                      logger             newgidmap           od                     ptx                       sedispol               sg_unmap              systemd-notify                  users                 yum
chattr                     dd                                  gcov                         gzexe                       login              newgrp              oldfind                pwd                       semodule_package       sg_verify             systemd-nspawn                  usleep                zcat
chcat                      deallocvt                           gdbus                        gzip                        loginctl           newuidmap           open                   pwdx                      seq                    sg_vpd                systemd-path                    usx2yloader           zcmp
chcon                      df                                  gdk-pixbuf-query-loaders-64  h2ph                        logname            nf-ct-add           openssl                pwmake                    servertool             sg_write_buffer       systemd-run                     utmpdump              zdiff
check-binary-files         dgawk                               gdk-pixbuf-thumbnailer       hdsploader                  look               nf-ct-list          openvt                 pwscore                   setarch                sg_write_long         systemd-stdio-bridge            uuidgen               zegrep
checkmodule                diff                                gencat                       head                        ls                 nf-exp-add          orbd                   pydoc                     setfacl                sg_write_same         systemd-sysv-convert            vdir                  zfgrep
checkpolicy                diff3                               genl-ctrl-list               hexdump                     lsattr             nf-exp-delete       os-prober              python                    setfont                sg_wr_mode            systemd-tmpfiles                VGAuthService         zforce
checksctp                  diff-jars                           geqn                         hostid                      lsblk              nf-exp-list         p11-kit                python2                   setkeycodes            sg_xcopy              systemd-tty-ask-password-agent  vi                    zgrep
chfn                       dir                                 getconf                      hostname                    lscpu              nf-log              pack200                python2.7                 setleds                sh                    tabs                            view                  zless
chgrp                      dircolors                           getent                       hostnamectl                 lsinitrd           nf-monitor          page_owner_sort        ranlib                    setmetamode            sha1sum               tac                             vim                   zmore
chmem                      dirname                             getfacl                      i386                        lsipc              nf-queue            pango-list             raw                       setpriv                sha224sum             tail                            vimdiff               znew
chmod                      dmesg                               getkeycodes                  iconv                       lslocks            ngettext            pango-querymodules-64  read                      setsid                 sha256sum             tailf                           vimtutor              zsoelim
chown                      dnsdomainname                       getopt                       id                          lslogins           nice                pango-view             readelf                   setterm                sha384sum             tar                             vlock
chronyc                    domainname                          getopts                      idiag-socket-details        lsmem              nisdomainname       passwd                 readlink                  setup-nsssysinit       sha512sum             taskset                         vmhgfs-fuse
chrt                       dracut                              gettext                      idn                         lsns               nl                  paste                  realpath                  setup-nsssysinit.sh    showconsolefont       tbl                             vmstat
chsh                       du                                  gettext.sh                   igawk                       lsscsi             nl-addr-add         pathchk                rebuild-jar-repository    setvtrgb               showkey               teamd                           vm-support
chvt                       dumpkeys                            gio                          info                        lua                nl-addr-delete      pchrt                  recode-sr-latin           sftp                   shred                 teamdctl                        vmtoolsd

/sbin目录s意思superUser超级用户,存放超级管理员使用的管理程序,权限控制与安全管理相关

[root@localhost /]# ls /sbin
accessdb            bridge                chroot                e2image           fsck.minix                 grub2-probe            iprdbg            lshw          matchpathcon       nl-cls-delete               postfix           resize2fs                  semodule          telinit              vgck            xfs_admin
addgnupghome        btrfs                 clock                 e2label           fsck.xfs                   grub2-reboot           iprdump           lsmod         mkdict             nl-cls-list                 postkick          resizepart                 sendmail          thin_check           vgconvert       xfs_bmap
addpart             btrfsck               clockdiff             e2undo            fsfreeze                   grub2-rpm-sort         iprinit           lspci         mkdumprd           nl-link-list                postlock          restorecon                 sendmail.postfix  thin_delta           vgcreate        xfs_copy
adduser             btrfs-convert         consoletype           e4defrag          fstrim                     grub2-set-default      iprsos            luseradd      mke2fs             nl-pktloc-lookup            postlog           rmmod                      service           thin_dump            vgdisplay       xfs_db
agetty              btrfs-debug-tree      cracklib-check        eapol_test        fxload                     grub2-setpassword      iprupdate         luserdel      mkfs               nl-qdisc-add                postmap           routef                     sestatus          thin_ls              vgexport        xfs_estimate
alternatives        btrfs-find-root       cracklib-format       ebtables          genhomedircon              grub2-sparc64-setup    ipset             lusermod      mkfs.btrfs         nl-qdisc-delete             postmulti         routel                     setcap            thin_metadata_size   vgextend        xfs_freeze
anacron             btrfs-image           cracklib-packer       ebtables-restore  genhostid                  grubby                 iptables          lvchange      mkfs.cramfs        nl-qdisc-list               postqueue         rsyslogd                   setenforce        thin_repair          vgimport        xfs_fsr
applygnupgdefaults  btrfs-map-logical     cracklib-unpacker     ebtables-save     genl                       halt                   iptables-restore  lvconvert     mkfs.ext2          nologin                     postsuper         rtacct                     setfiles          thin_restore         vgimportclone   xfs_growfs
arpd                btrfs-select-super    create-cracklib-dict  era_check         genl-ctrl-list             hardlink               iptables-save     lvcreate      mkfs.ext3          nstat                       poweroff          rtcwake                    setpci            thin_rmap            vgmerge         xfs_info
arping              btrfstune             crond                 era_dump          getcap                     hwclock                irqbalance        lvdisplay     mkfs.ext4          ownership                   ppp-watch         rtmon                      setsebool         thin_trim            vgmknodes       xfs_io
audispd             btrfs-zero-log        ctrlaltdel            era_invalidate    getenforce                 iconvconfig            kexec             lvextend      mkfs.minix         packer                      pvchange          rtpr                       sfdisk            tracepath            vgreduce        xfs_logprint
auditctl            build-locale-archive  ctstat                era_restore       getpcaps                   iconvconfig.x86_64     killall5          lvm           mkfs.xfs           pam_console_apply           pvck              rtstat                     shutdown          tracepath6           vgremove        xfs_mdrestore
auditd              cacertdir_rehash      debugfs               ethtool           getsebool                  ifcfg                  kpartx            lvmconf       mkhomedir_helper   pam_tally2                  pvcreate          runlevel                   sln               tune2fs              vgrename        xfs_metadump
augenrules          cache_check           delpart               faillock          glibc_post_upgrade.x86_64  ifdown                 lchage            lvmconfig     mklost+found       pam_timestamp_check         pvdisplay         runuser                    smtp-sink         tuned                vgs             xfs_mkfile
aureport            cache_dump            depmod                fdformat          groupadd                   ifenslave              ldattach          lvmdiskscan   mkswap             parted                      pvmove            sasldblistusers2           smtp-source       tuned-adm            vgscan          xfs_ncheck
ausearch            cache_metadata_size   devlink               fdisk             groupdel                   ifstat                 ldconfig          lvmdump       modinfo            partprobe                   pvremove          saslpasswd2                ss                udevadm              vgsplit         xfs_quota
authconfig          cache_repair          dhclient              filefrag          groupmems                  ifup                   lgroupadd         lvmetad       modprobe           partx                       pvresize          sefcontext_compile         sshd              unix_chkpwd          vigr            xfs_repair
authconfig-tui      cache_restore         dhclient-script       findfs            groupmod                   init                   lgroupdel         lvmpolld      mount.fuse         pdata_tools                 pvs               selabel_digest             sshd-keygen       unix_update          vipw            xfs_rtcp
autrace             cache_writeback       dmeventd              firewalld         grpck                      insmod                 lgroupmod         lvmsadc       netreport          pidof                       pvscan            selabel_lookup             sulogin           update-alternatives  virt-what       xtables-multi
avcstat             capsh                 dmfilemapd            fixfiles          grpconv                    install-info           lid               lvmsar        NetworkManager     ping6                       pwck              selabel_lookup_best_match  sushell           update-pciids        visudo          zdump
badblocks           cbq                   dmidecode             fsadm             grpunconv                  installkernel          lnewusers         lvreduce      new-kernel-pkg     pivot_root                  pwconv            selabel_partial_match      swaplabel         useradd              vmcore-dmesg    zic
biosdecode          cfdisk                dmsetup               fsck              grub2-bios-setup           intel-microcode2ucode  lnstat            lvremove      newusers           plymouthd                   pwhistory_helper  selinuxconlist             swapoff           userdel              vpddecode       zramctl
biosdevname         chcpu                 dmstats               fsck.btrfs        grub2-get-kernel-settings  ip                     load_policy       lvrename      nl-class-add       plymouth-set-default-theme  pwunconv          selinuxdefcon              swapon            usermod              weak-modules
blkdeactivate       chgpasswd             dracut                fsck.cramfs       grub2-install              ip6tables              logrotate         lvresize      nl-class-delete    postalias                   rdisc             selinuxenabled             switch_root       usernetctl           wipefs
blkdiscard          chkconfig             dumpe2fs              fsck.ext2         grub2-macbless             ip6tables-restore      logsave           lvs           nl-classid-lookup  postcat                     rdma              selinuxexeccon             sysctl            vgcfgbackup          wpa_cli
blkid               chpasswd              e2freefrag            fsck.ext3         grub2-mkconfig             ip6tables-save         losetup           lvscan        nl-class-list      postconf                    readprofile       selinux_restorecon         sys-unconfig      vgcfgrestore         wpa_passphrase
blockdev            chronyd               e2fsck                fsck.ext4         grub2-ofpathname           iprconfig              lpasswd           makedumpfile  nl-cls-add         postdrop                    reboot            semanage                   tc                vgchange             wpa_supplicant

/home存放是其他用户的目录,每个用户名的目录由它的用户名称决定

[root@localhost /]# cd /home
[root@localhost home]# ls
[root@localhost home]# useradd user-01
[root@localhost home]# useradd user-02
[root@localhost home]# useradd user-03
[root@localhost home]# useradd user-04
[root@localhost home]# ls
user-01  user-02  user-03  user-04

/usr目录存放应用程序和文件,类似windows的programfiles

[root@localhost /]# ls /usr
bin  etc  games  include  lib  lib64  libexec  local  sbin  share  src  tmp

/boot目录存放系统启动需要的相关文件

[root@localhost /]# ls /boot
config-3.10.0-1127.el7.x86_64                            initramfs-3.10.0-1127.el7.x86_64.img           System.map-3.10.0-1127.el7.x86_64
config-3.10.0-1160.6.1.el7.x86_64                        initramfs-3.10.0-1127.el7.x86_64kdump.img      System.map-3.10.0-1160.6.1.el7.x86_64
efi                                                      initramfs-3.10.0-1160.6.1.el7.x86_64.img       vmlinuz-0-rescue-8cd9a0197dc14da38e07eed4a07ce8c6
grub                                                     initramfs-3.10.0-1160.6.1.el7.x86_64kdump.img  vmlinuz-3.10.0-1127.el7.x86_64
grub2                                                    symvers-3.10.0-1127.el7.x86_64.gz              vmlinuz-3.10.0-1160.6.1.el7.x86_64
initramfs-0-rescue-8cd9a0197dc14da38e07eed4a07ce8c6.img 

/proc目录映射系统内存,访问这个目录获取系统信息

改变该目录的文件可能会造成系统崩溃

[root@localhost /]# ls /proc
1     1389  19    28    3017  32    36    410  432  541  61   653  680  746  acpi       diskstats    irq         mdstat        sched_debug    sysvipc
10    1390  1966  2806  304   320   3621  411  433  550  62   655  681  757  asound     dma          kallsyms    meminfo       schedstat      timer_list
11    14    2     2807  31    321   37    424  434  57   63   668  7    762  buddyinfo  driver       kcore       misc          scsi           timer_stats
1118  16    21    2824  311   3288  38    425  435  574  64   669  704  766  bus        execdomains  keys        modules       self           tty
1120  1639  22    2829  312   33    39    426  46   575  647  674  728  78   cgroups    fb           key-users   mounts        slabinfo       uptime
1121  1645  2241  29    313   333   398   427  47   576  648  675  729  8    cmdline    filesystems  kmsg        mpt           softirqs       version
115   17    2257  299   314   34    399   428  48   578  649  676  730  804  consoles   fs           kpagecount  mtrr          stat           vmallocinfo
12    1781  23    30    315   3459  4     429  49   59   650  677  733  883  cpuinfo    interrupts   kpageflags  net           swaps          vmstat
13    1786  24    300   316   35    40    430  515  6    651  678  734  9    crypto     iomem        loadavg     pagetypeinfo  sys            zoneinfo
1382  18    26    301   317   357   41    431  537  60   652  679  739  932  devices    ioports      locks       partitions    sysrq-trigger

/srv目录 service缩写,是存放服务启动之后需要提取的数据文件

改变该目录的文件可能会造成一些服务无法启动

这里尚未安装任何程序的服务

[root@localhost /]# ls /srv
[root@localhost /]# 

/sys目录 system缩写,存放系统文件

[root@localhost /]# ls /sys
block  bus  class  dev  devices  firmware  fs  hypervisor  kernel  module  power

/tmp目录 temp缩写,存放一些临时文件

承接上面vm是自动安装的,文件都放在这里

[root@localhost /]# ls /tmp
hsperfdata_root   systemd-private-4a12f7215f734b3b93e5d83f83618bb0-chronyd.service-7StxVn  vmware-root_35621-3221043166  vmware-root_732-2999591876  yum.log
ks-script-nUDbLZ  vmware-root_35599-3178639466                                             vmware-root_729-4257135007    vmware-root_771-4256545187

/etc 存放所有系统管理所需要的配置文件和子目录

[root@localhost /]# ls /etc
adjtime                  crypttab                 gcrypt       java                      maven              ppp             rwtab.d        sudo-ldap.conf
aliases                  csh.cshrc                glvnd        jvm                       mke2fs.conf        prelink.conf.d  sasl2          sysconfig
aliases.db               csh.login                gnupg        jvm-commmon               modprobe.d         printcap        scl            sysctl.conf
alternatives             dbus-1                   GREP_COLORS  kdump.conf                modules-load.d     profile         securetty      sysctl.d
anacrontab               default                  groff        kernel                    motd               profile.d       security       systemd
asound.conf              depmod.d                 group        krb5.conf                 mtab               protocols       selinux        system-release
audisp                   dhcp                     group-       krb5.conf.d               NetworkManager     python          services       system-release-cpe
audit                    DIR_COLORS               grub2.cfg    ld.so.cache               networks           rc0.d           sestatus.conf  terminfo
bash_completion.d        DIR_COLORS.256color      grub.d       ld.so.conf                nsswitch.conf      rc1.d           shadow         tmpfiles.d
bashrc                   DIR_COLORS.lightbgcolor  gshadow      ld.so.conf.d              nsswitch.conf.bak  rc2.d           shadow-        tuned
binfmt.d                 dracut.conf              gshadow-     libaudit.conf             openldap           rc3.d           shells         udev
centos-release           dracut.conf.d            gss          libnl                     opt                rc4.d           skel           vconsole.conf
centos-release-upstream  e2fsck.conf              host.conf    libuser.conf              os-release         rc5.d           ssh            vimrc
chkconfig.d              egl                      hostname     locale.conf               pam.d              rc6.d           ssl            virc
chrony.conf              environment              hosts        localtime                 passwd             rc.d            statetab       vmware-tools
chrony.keys              ethertypes               hosts.allow  login.defs                passwd-            rc.local        statetab.d     wgetrc
cron.d                   exports                  hosts.deny   logrotate.conf            pkcs11             redhat-release  subgid         wpa_supplicant
cron.daily               favicon.png              init.d       logrotate.d               pki                resolv.conf     subgid-        X11
cron.deny                filesystems              inittab      lvm                       plymouth           rpc             subuid         xdg
cron.hourly              firewalld                inputrc      machine-id                pm                 rpm             subuid-        xinetd.d
cron.monthly             fonts                    iproute2     magic                     polkit-1           rsyslog.conf    sudo.conf      yum
crontab                  fstab                    issue        makedumpfile.conf.sample  popt.d             rsyslog.d       sudoers        yum.conf
cron.weekly              fuse.conf                issue.net    man_db.conf               postfix            rwtab           sudoers.d      yum.repos.d

/dev目录 device设备缩写,类似windows的设备管理器

所有的硬件信息以文件的形式存储在此目录中

[root@localhost /]# ls /dev
agpgart        cpu              full          mapper              port    sda2      tty0   tty19  tty29  tty39  tty49  tty59  ttyS2    vcs3   vfio
autofs         cpu_dma_latency  fuse          mcelog              ppp     sg0       tty1   tty2   tty3   tty4   tty5   tty6   ttyS3    vcs4   vga_arbiter
block          crash            hidraw0       mem                 ptmx    sg1       tty10  tty20  tty30  tty40  tty50  tty60  uhid     vcs5   vhci
bsg            disk             hpet          midi                pts     shm       tty11  tty21  tty31  tty41  tty51  tty61  uinput   vcs6   vhost-net
btrfs-control  dm-0             hugepages     mqueue              random  snapshot  tty12  tty22  tty32  tty42  tty52  tty62  urandom  vcsa   vmci
bus            dm-1             hwrng         net                 raw     snd       tty13  tty23  tty33  tty43  tty53  tty63  usbmon0  vcsa1  vsock
cdrom          dm-2             initctl       network_latency     rfkill  sr0       tty14  tty24  tty34  tty44  tty54  tty7   usbmon1  vcsa2  zero
centos         dmmidi           input         network_throughput  rtc     stderr    tty15  tty25  tty35  tty45  tty55  tty8   usbmon2  vcsa3
char           dri              kmsg          null                rtc0    stdin     tty16  tty26  tty36  tty46  tty56  tty9   vcs      vcsa4
console        fb0              log           nvram               sda     stdout    tty17  tty27  tty37  tty47  tty57  ttyS0  vcs1     vcsa5
core           fd               loop-control  oldmem              sda1    tty       tty18  tty28  tty38  tty48  tty58  ttyS1  vcs2     vcsa6

/mnt目录 用于挂载文件系统

[root@localhost /]# ls /mnt
hgfs

/media目录,媒体的意思可能不是很理解,应该说是介质,

用于识别外部接入设备,系统识别后会变成文件或目录的形式展示

[root@localhost /]# ls /media
[root@localhost /]# 

/opt目录,意思option? 存放安装软件的目录

这里存放了安装gcc8版本需要的一个目录。。。

[root@localhost /]# ls opt
rh

/usr/local目录 存放给系统额外安装程序的目录

一般这些程序是通过源码编译方式安装的

[root@localhost /]# ls /usr/local
bin  etc  games  include  lib  lib64  libexec  sbin  share  src

/var目录是存放不断写入的文件的目录,一般存放日志文件

[root@localhost /]# ls /var
adm  cache  crash  db  empty  games  gopher  kerberos  lib  local  lock  log  mail  nis  opt  preserve  run  spool  tmp  yp

/lib目录是存放系统核心库文件的地方,等同windows的dll文件库

[root@localhost /]# ls /lib
binfmt.d  firewalld   gcc         java-1.6.0  jvm          kbd     modprobe.d      os-release  sendmail          systemd     yum-plugins
cpp       firmware    grub        java-1.7.0  jvm-commmon  kdump   modules         polkit-1    sendmail.postfix  tmpfiles.d
debug     fontconfig  java        java-1.8.0  jvm-exports  kernel  modules-load.d  python2.7   sse2              tuned
dracut    games       java-1.5.0  java-ext    jvm-private  locale  NetworkManager  rpm         sysctl.d          udev

/selinux目录是子安全系统

security-enhanced linux ,该目录不会主动显示在终端中,需要设置开启访问

四、关机和重启

shutdown now 立即关机
shutdown -h now 立即关机
shutdown -h 1 一分钟后关机
halt 立即关机 【就是 -h参数的缩写】

shutdown -r now 立即重启
reboot 立即重启

sync 内存数据同步到磁盘

实际上只需要记住 halt 和 reboot即可,sync操作已经合并在这些命令之前了

五、登录和注销

su - 用户名 切换用户
logout 注销

logout只适用本机操作,远程访问无法使用此命令

一般就是su 进行用户之间的切换操作,由root切换其他用户不需要密码

但是由其他用户转向root则需要输入密码

六、用户管理

创建用户

useradd 用户名 
创建一个用户,并且在/home下创建对应用户名的目录

useradd -d 指定目录 用户名  
创建一个用户,指定所在的用户目录(非特殊使用不要这么做)

配置密码

passwd 用户名
给该用户设置密码或者重置密码

移除用户

一般建议不删除目录,历史信息需要保留

userdel 用户名
删除该用户,/home对应的目录保留

userdel -r 用户名
删除该用户,连同/home对应的目录一并删除

查看指定用户

id 用户名

演示案例
- - - - - - - - - - - - - - - - 
[root@localhost /]# id root
uid=0(root) gid=0(root) 组=0(root)
[root@localhost /]# id user1
id: user1: no such user
- - - - - - - - - - - - - - - - 

查看当前用户

whoami
查看当前使用的用户

演示案例
- - - - - - - - - - - - - - - - - - - - - - 
[root@localhost /]# whoami
root
[root@localhost /]# su user-01
[user-01@localhost /]$ whoami
user-01
- - - - - - - - - - - - - - - - - - - - - - 

who am I
查看一开始登录使用的用户信息详细

演示案例
- - - - - - - - - - - - - - - - - - - - - - 
[user-01@localhost /]$ who am I
root     pts/0        2020-11-29 10:27 (192.168.132.1)
- - - - - - - - - - - - - - - - - - - - - - 

七、用户组管理

group即对用户进行归纳,统一管理

一般用户创建没有指定组

组会默认为用户名称,因为gid 会和uid一起

 

创建组

groupadd 组名称
创建一个用户组

useradd -g 组名称 用户名称
在创建用户时指定所属的用户组

usermod -g 组名称 用户名称
修改已有的用户为其指定用户组

groupdel 组名称
移除一个用户组

八、用户信息文件

passwd文件

[root@localhost /]# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin
systemd-network:x:192:192:systemd Network Management:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
polkitd:x:999:998:User for polkitd:/:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
postfix:x:89:89::/var/spool/postfix:/sbin/nologin
chrony:x:998:996::/var/lib/chrony:/sbin/nologin
user-01:x:1000:1000::/home/user-01:/bin/bash
user-02:x:1001:1001::/home/user-02:/bin/bash
user-03:x:1002:1002::/home/user-03:/bin/bash
user-04:x:1003:1003::/home/user-04:/bin/bash

信息格式:

用户名称:口令:uid:gid:注释描述:主目录:登录shell

shadow文件

user-04:x:1003:1003::/home/user-04:/bin/bash
[root@localhost /]# cat /etc/shadow
root:$6$WnpmZjGPxd7aYR5j$5Wxq8TpQ8GR/45w2Qixc1suJvL6HuMczmjT3Q01OlvUnSWFqpHGuWHCA5lCTU10HPU5ljrrlwll7Go3Ids1e01::0:99999:7:::
bin:*:18353:0:99999:7:::
daemon:*:18353:0:99999:7:::
adm:*:18353:0:99999:7:::
lp:*:18353:0:99999:7:::
sync:*:18353:0:99999:7:::
shutdown:*:18353:0:99999:7:::
halt:*:18353:0:99999:7:::
mail:*:18353:0:99999:7:::
operator:*:18353:0:99999:7:::
games:*:18353:0:99999:7:::
ftp:*:18353:0:99999:7:::
nobody:*:18353:0:99999:7:::
systemd-network:!!:18594::::::
dbus:!!:18594::::::
polkitd:!!:18594::::::
sshd:!!:18594::::::
postfix:!!:18594::::::
chrony:!!:18594::::::
user-01:!!:18595:0:99999:7:::
user-02:!!:18595:0:99999:7:::
user-03:!!:18595:0:99999:7:::
user-04:!!:18595:0:99999:7:::

信息格式:

登录名称:加密口令:最后一次修改的时间:最小时间间隔:最大时间间隔:警告时间:不活动时间:失效时间:标志

group文件:

[root@localhost /]# cat /etc/group
root:x:0:
bin:x:1:
daemon:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mem:x:8:
kmem:x:9:
wheel:x:10:
cdrom:x:11:
mail:x:12:postfix
man:x:15:
dialout:x:18:
floppy:x:19:
games:x:20:
tape:x:33:
video:x:39:
ftp:x:50:
lock:x:54:
audio:x:63:
nobody:x:99:
users:x:100:
utmp:x:22:
utempter:x:35:
input:x:999:
systemd-journal:x:190:
systemd-network:x:192:
dbus:x:81:
polkitd:x:998:
ssh_keys:x:997:
sshd:x:74:
postdrop:x:90:
postfix:x:89:
chrony:x:996:
cgred:x:995:
user-01:x:1000:
user-02:x:1001:
user-03:x:1002:
user-04:x:1003:

信息格式:

组名称:口令:gid:组内用户列表

 

【Linux】Re01

标签:http   fuser   pdo   hostname   图片   last   toc   cmd   ttys0   

原文地址:https://www.cnblogs.com/mindzone/p/14055971.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!