Linux hardware resource management and peripheral device usage, system operation mechanism and user management

Source: Internet
Author: User
Tags stdin

Linux Hardware resource Management

PCI Devices

        graphics 
             $>>DMESG |grep-i VGA
[    0.000000] Console:colour vga+ 80x25< br>[    0.262267] Vgaarb:device added:pci:0000:00:0f.0,decodes=io+mem,owns=io+mem,locks=none
[     0.262271] vgaarb:loaded
[    0.262272] Vgaarb:bridge control possible 0000:00:0f.0
[    1.969021] FBCON:SVGADRMFB (fb0) is primary device
          Network card
            $>>lscpi |grep-i ETH
02:01.0 Ethernet Controller:intel Corporation 82545EM Gigabit Ethernet Controller (Copper) (rev.)
          sound card
            $>>lspci |grep-i VGA
00:0f.0 VGA Compatible Controller:vmware SVGA II Adapter

CPU Information

View $>> Cat/proc/cpuinfo via the/proc file system

processor:0vendor_id:genuineintelcpu Family:6model:94model Name:intel (R) Core (TM) I7-6700HQ CPU @ 2.60ghzstepping:3microcode:0x6acpu mhz:2601.000cache size:6144 kbphysical Id:0siblings:1cor  E id:0cpu cores:1apicid:0initial apicid:0fpu:yesfpu_exception:yescpuid level:22wp:yesflags:fpu vme de PSE TSC MSR PAE MCE cx8 APIC Sep MTRR PGE MCA cmov Pat PSE36 clflush DTS MMX fxsr SSE SSE2 SS Syscall NX PDPE1GB rdtscp LM constant_t SC arch_perfmon pebs BTS nopl xtopology tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 FMA cx16 pcid SSE 4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer AES Xsave AVX f16c rdrand hypervisor lahf_lm ABM 3dnowprefetch Ida Arat EPB PLN pts dtherm hwp hwp_noitfy hwp_act_window hwp_epp fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 invpcid RTM rdseed AD X SMAP xsaveoptbogomips:5202.00clflush size:64cache_alignment:64address sizes:42 bits physical, bits virtualpower m Anagement: 

Memory information
$>>free-m or Cat/proc/meminfo

                      Total used        free      shared  buff/cache   availablemem:           1824         713         810         912Swap:          2047           0        2047 Total//Memory count used//number of memory used free//number of idle memory shared//Multiple processes share Total memory page cache//disk Size of the cache

Disk partition information

$>>FDISK-L//Partition status
$>>DF-H//Size condition
$>>DU-H//Use Cases

[[email protected] ~]# fdisk-ldisk/dev/sda:21.5 GB, 21474836480 bytes, 41943040 sectorsunits = sectors of 1 * 512 = Bytessector Size (logical/physical): bytes/512 bytesi/o size (minimum/optimal): bytes/512 bytesdisk Labe L type:dosdisk identifier:0x000ab2c2 Device Boot Start End Blocks Id system/dev/sda1 * 2 048 1026047 512000 linux/dev/sda2 1026048 41943039 20458496 8e Linux lvmdisk/dev/mapper/c entos-root:18.8 GB, 18756927488 bytes, 36634624 sectorsunits = sectors of 1 * = bytessector size (logical/physica L): bytes/512 bytesi/o size (minimum/optimal): bytes/512 bytesdisk/dev/mapper/centos-swap:2147 MB, 214748364 8 bytes, 4194304 sectorsunits = sectors of 1 * MB = bytessector size (logical/physical): bytes/512 bytesi/o siz E (minimum/optimal): bytes/512 bytes[[email protected] ~]# df-hfilesystem Size used Avail use% Mounted On/dev/mapper/ceNtos-root 18G 4.2G 14G 24%/devtmpfs 898M 0 898M 0%/devtmpfs 913M 100K 913M 1%/dev/shmtmpfs 913M 9.0M 904M 1%/runtmpfs 913M 0 913M 0%/sys/f S/CGROUP/DEV/SDA1 497M 157M 341M 32%/boottmpfs 183M 20K 183M 1%/run/user/1000t Mpfs 183M 0 183M 0%/run/user/0

     external Device use
        hardware devices in a Linux system exist as files Different hardware devices have different file types; The device file is in the/dev directory

[[email protected] ~]# cd/dev/[[email protected] dev]# lsagpgart crash Initctl mqueue                 Rfkill stdin tty18 tty3 tty41 tty53 tty8 vcs1 vfioautofs disk input net          RTC stdout tty19 tty30 tty42 tty54 tty9 vcs2 vga_arbiterblock dm-0 kmsg       Network_latency rtc0 TTY tty2 tty31 tty43 tty55 ttyS0 vcs3 VHOST-NETBSG dm-1 Log network_throughput SDA tty0 tty20 tty32 tty44 tty56 ttyS1 vcs4 Vmcibtrfs-control D              Mmidi loop-control null sda1 tty1 tty21 tty33 tty45 tty57 ttyS2 vcs5 Vsockbus             Dri lp0 nvram sda2 tty10 tty22 tty34 tty46 tty58 ttyS3 vcs6 zerocdrom            Fb0 LP1 oldmem sg0 tty11 tty23 tty35 tty47 tty59 uhid Vcsacentos FD LP2 port SG1 tty12 tty24 tty36 tty48 tty6 uinput VCSA1CHAR Full LP 3 PPP SHM TTY13 tty25 tty37 tty49 tty60 urandom vcsa2console Fuse MA Pper ptmx Snapshot tty14 tty26 tty38 tty5 tty61 usbmon0 vcsa3core hidraw0 MC Elog pts snd tty15 tty27 tty39 tty50 tty62 usbmon1 vcsa4cpu hpet Me M random sr0 tty16 tty28 tty4 tty51 tty63 usbmon2 vcsa5cpu_dma_latency hugepages mi Di Raw stderr tty17 tty29 tty40 tty52 tty7 vcs vcsa6


System operating mechanism

System Boot Process
Post->mbr boot->grub menu, load kernel->init process initialization, login system

System Run Level
$>>cat/etc/inittab

#   0-halt (do not set Initdefault to this)//shutdown #   1-single user mode//Single user mode #   2-multiuser, without NFS (the Same as 3, if you don't have networking)//multi-user mode without network support #   3-full multiuser mode//has network-supported multi-user mode #   4-unused//reserved, not used #< c5/>5-x11//Network-supported x-windows supported multi-user mode #   6-reboot (do not set Initdefault to this)/reboot, reboot # id:5:initdefault:eg: Switch to 3rd RunLevel $>>systemctl Isolate Multi-user.target or systemctl isolate runlevel3.target eg: Switch to 5th Run level $>>systemctl Isolate Graphical.target   or Systemctl isolate Runlevel5.targeteg: Set the default third boot level $>>systemctl Set-default Multi-user.target$>>systemctl Get-default//view current run start level eg: Set default fifth boot level $>>systemctl Set-default Graphical.target

System User Management

User account Classification

User account password configuration file

/ETC/PASSWD the role of each field
Root:x:0:0:root:/root:/bin/bash
User name: Password placeholder: uid:gid: User Description: Owner directory: Shell used after login

Pseudo users in the system
The operation of any command in Linux must have a user's identity. Pseudo-users are generally associated with system or program services
Bin,daemon,shutdown,halt,linux default has these pseudo-users, pseudo-users usually do not need or unable to log on to the system, can not host directory
Common pseudo-user nobody in eg:/etc/passwd files

Add a System User

[[email protected] dev]# useradd-d,--home-dir home_dir Home directory of the new account//directory, when creating the user is specified by the owner directory-           G,--gid group name or ID of the primary group of the new account//user group, the specified user belongs to Group-G,--groups groups List of supplementary groups of the new account//user group, specifying additional groups to which the user belongs Faillog databases-m,-- Create-home Create the user's home directory//do not created the users host directory-S,--shell Shell login shell of the new account//Specifies the user's login shell-u,--uid UID user ID of the new account//specifies the subscriber number eg: Create a user name for Sam, specify the host directory as/opt/sam, log on S Hell to/bin/sh.[[email protected] dev]# useradd-d/opt/sam-s/bin/sh sam[[email protected] dev]# tail-1/etc/p ASSWDSAM:X:1001:1001::/OPT/SAM:/BIN/SHEG: Create a username of Test,uid to 2010, specify start group as root, additional group FTP, login shell as/bin/sh[[email  Protected] dev]# useradd-u 2010-g root-g ftp-s/bin/sh test[roo[email protected] dev]# tail-1/etc/passwdtest:x: 2010:0::/HOME/TEST:/BIN/SH Note: When the created user is unable toOften displayed! Copy all files under/etc/skel/to the new user's host directory [[email protected] skel]# cd/etc/skel/[[email protected] skel]# ls[[email   protected] skel]# ls-a.  ..  . bash_logout. Bash_profile. bashrc. mozilla[[email protected] skel]# ls-a/opt/sam/.  .. . bash_logout. Bash_profile. BASHRC. Mozilla

Delete User
If a user's account is no longer used, can be removed from the system, delete the user account is to/etc/passwd and other system files in the user record deletion, if necessary, delete the user host Directory

[[email protected] skel]# Userdel-  R,--remove remove home directory and                  Mail spool//Delete the user's home folder eg: delete user sam[[ Email protected] skel]# Userdel sam[[email protected] skel]# tail-1/etc/passwdtest:x:2010:0::/home/test:/bin/sh[[ Email protected] skel]# ls/opt///no-R, its home directory still exists RH  sameg: Delete user test and delete host directory [[email protected] skel]# Userdel-r test[[ Email protected] skel]# tail-1/etc/passwdenmoedu:x:1000:1000:enmoedu:/home/enmoedu:/bin/bash[[email protected] Skel ]# ls/home/enmoedu

Modify user Information
Change the user's related attributes according to the actual situation, such as user number, home directory, user group, etc., similar to Useradd

[Email protected] skel]# usermod  -D,--home home_dir           new home directory for the user account  -G,--gid group< C3/>force use Group as new primary group  -G,--groups groups           new list of supplementary groups  -A,--append
   
    append the user to the supplemental GROUPS  -S,--shell shell             New Login Shell  for the user account-U,--uid UID                 new UID for the user account
   

User Password Management

Eg: interactively configure user passwords [[email protected] skel]# useradd samcreating mailbox file:file exists[[email protected] skel]# passwd Samcha nging password for user Sam. New Password:bad password:the password is shorter than 8 Charactersretype new Password:passwd:all Authentication token s updated Successfully.eg: No interactive configuration user password [[email protected] skel]# echo 123456 | passwd--stdin samchanging password for user Sam.passwd:all authentication tokens updated successfully.

Password configuration file

/etc/shadow[[email protected] skel]# cat/etc/shadow|grep rootroot:$6$hvu.3oadtx9dhsdw$ Qq27h05p4y2klia5bteu0y7u3plxmpqjqbcqwwvsi1e6hj27jflijhhnlth/hydgacxip76poafj.g7mkylrj/::0:99999:7:::

Linux hardware resource management and peripheral device usage, system operation mechanism and user management

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.