2019年12月16日星期一

常用功能的 运行 快速打开指令


常用功能的 运行 快速打开指令


sconfig.cmd   (基本控制台)

virtmgmt.msc  (Hyper-V 管理员)
ServerManager.exe   (伺服器管理员)
explorer   (文件管理器)
iexplore    (IE浏览器)
devmgmt.msc   (设备管理器)
diskmgmt.msc  (磁盘管理)
eventvwr.msc   (事件查看器)
lusrmgr.msc   (本地用户和组)
perfmon.msc   (性能监视器)
wbadmin.msc  (Windows Server 本地备份)
WF.msc   (防火墙)
wlbadmin.msc   (Windows本地备份)
CluAdmin.msc  (故障转移群集管理)
FailoverClusters.SnapInHelper.msc   (故障转移群集管理)




Open/Close the Start MenuWindows key
Open the Action center.Windows key + A
Open Cortana in listening modeWindows key + C
Fast-switch to/from the desktop - minimise allWindows key + D
Open File ExplorerWindows key + E
Open Game bar (when a game is open)Windows key + G
Open ShareWindows key + H
Open SettingsWindows key + I
Open ConnectWindows key + K
Switch accounts or lock the PCWindows key + L
Minimize all windowsWindows key + M
Open the Run dialog boxWindows key + R
Open SearchWindows key + S
Open the Ease of Access centerWindows key + U
Open the Quick Link menu, equivalent to right-clicking the Start Menu.Windows key + X
Snap app windows to the leftWindows key + left arrow key
Snap app windows to the rightWindows key + right arrow key
Maximize the appWindows key + up arrow key
Minimize the appWindows key + down arrow key
Open the app that is pinned to the taskbar in that number's positionWindows key + a number
Open a quick look at the desktopWindows key + comma
Open NarratorWindows key + Enter
Minimize all but the active desktop windowWindows key + Home
Capture a screenshot and save it to the Screenshots folderWindows key + PrtScn
Add a virtual desktopWindows key + Ctrl + D
Switch between virtual desktopsWindows key + Ctrl + left or right arrow
Close the current virtual desktopWindows key + Ctrl + F4
Stretch the desktop window to the top and bottom of the screenWindows key + Shift + Up arrow
Open Task viewWindows key + Tab
Zoom inWindows key +   +
Zoom outWindows key +   -


Admin Snap-inCommandCategory
Quality of Service Control ManagementACSsnap.mscNetwork
ADSI EditADSIedit.mscAD Configuration
Authorization managerAZman.mscSecurity
Certificates Management - Local machineCertlm.mscSecurity
Certificates Management - Current userCertmgr.mscSecurity
Certification Authority ManagementCertsrv.mscSecurity
Certificate TemplatesCerttmpl.mscSecurity
Failover cluster ManagerCluadmin.exeDisc, File
Component ServicesComexp.msc
Computer ManagementCompmgmt.msc
Device ManagerDevmgmt.mscHardware
Notifications/Start menu/policyDevModeRunAsUserConfig.msc
Disk DefragmenterDefrag.exe (formerly Dfrg.msc)Disc, File
Distributed File Service MgmtDFSmgmt.mscDisc, File
Disk ManagerDiskMgmt.mscDisc, File
DNS ManagerDNSmgmt.mscNetwork
AD Domains and TrustsDomain.mscAD Configuration
AD Users and ComputersDSA.mscSecurity
AD Sites and ServicesDSsite.mscAD Configuration
Embedded Lockdown ManagerEmbeddedLockdown.mscSecurity
Event ViewerEventvwr.msc
Shared Folders open filesFSmgmt.mscDisc, File
File Server Resource managerFSRM.mscDisc, File
Local Group Policy EditorGPedit.mscPolicy
Group Policy ManagementGPmc.mscPolicy
Group Policy Management EditorGPme.mscPolicy
Group Policy Starter GPO EditorGPTedit.mscPolicy
Local Users and Groups ManagerLUsrMgr.mscSecurity
Teminal Services RDPMSTSCRemote Access
Teminal Services RDP to ConsoleMSTSC /v:[server] /consoleRemote Access
NAP client configurationNapCLCfgNetwork
Performance MonitorPerfMon.msc
Print ManagementPrintManagement.mscPrint
Resultant Set of PolicyRSOP.mscPolicy
Local Security Settings ManagerSecPol.mscPolicy
Server Roles, FeaturesServerManager.msc
Services ManagementServices.msc
SQL Server configuration ManagerSQLServerManager11.msc
Storage MgmtStorageMgmt.mscDisc, File
Telephony ManagementTAPImgmt.mscPhone/Modem
Task SchedulerTaskSchd.msc
Trusted Platform ModuleTPM.mscSecurity
Terminal Server ManagerTSadmin.exeRemote Access
Remote DesktopTSmmc.mscRemote Access
Windows Mangement InstrumentationWmiMgmt.msc
Windows Server Backup (Local+Remote)WBadmin.mscDisc, File
Windows Local BackupWLBadmin.mscDisc, File
Windows FirewallWF.mscRemote Access


DescriptionRun Command
Accessibility Optionsutilman
or
control access.cpl
Add Hardware Wizardhdwwiz
Programs and Features
(Add New Programs)
(Add Remove Windows Components)
(Set Program Access & Defaults )
appwiz.cplcontrol appwiz.cpl,,1
control appwiz.cpl,,2
control appwiz.cpl,,3
Administrative Toolscontrol admintools
Advanced User Accounts Control Panelnetplwiz
Authorization Managerazman.msc
Automatic Updatecontrol wuaucpl.cpl
Backup and Restore Utilitysdclt
Bluetooth Transfer Wizardfsquirt
Calculatorcalc
Certificate Managercertmgr.msc
Character Mapcharmap
Check Disk Utilitychkdsk
Clear Type (tune or turn off)cttune
Color Managementcolorcpl.exe
Command Promptcmd
Component Servicesdcomcnfg
or
comexp.msc
Computer ManagementCompMgmtLauncher.exe
or
compmgmt.msc
Control Panelcontrol
Credential (passwords) Backup and Restore Wizardcredwiz
Data Execution PreventionSystemPropertiesDataExecutionPrevention
Date and Time Propertiestimedate.cpl
Device Managerhdwwiz
or
devmgmt.msc
Device Pairing WizardDevicePairingWizard
Digitizer Calibration Tool (Tablets/Touch screens)tabcal
Direct X Control Panel (if installed)directx.cpl
Direct X Troubleshooterdxdiag
Disk Cleanup Utilitycleanmgr
Disk Defragmenterdfrgui
defrag
Disk Managementdiskmgmt.msc
Disk Partition Managerdiskpart
Display Color Calibrationdccw
Display DPI / Text sizedpiscaling
Display Properties (Themes, Desktop, Screensaver)control desktop
Display Properties (Resolution, Orientation)desk.cpl
Display Properties (Color & Appearance)control color
Documents (open 'My Documents' folder)documents
Downloads (open 'Downloads' folder)downloads
Driver Verifier Utilityverifier
DVD Playerdvdplay
Edit Environment Variablesrundll32.exe sysdm.cpl,EditEnvironmentVariables
Encrypting File System Wizard (EFS)rekeywiz
Event Viewereventvwr.msc
File Signature Verification Tool (Device drivers)sigverif
Files and Settings Transfer Tool%systemroot%\system32\migwiz\migwiz.exe
Firewall Control Panelfirewall.cpl
Folders Propertiescontrol folders
Fonts listcontrol fonts
Font previewfontview arial.ttf
Game Controllersjoy.cpl
Local Group Policy Editorgpedit.msc
Internet Propertiesinetcpl.cpl
IP Configurationipconfig
iSCSI Initiator configurationiscsicpl
Keyboard Propertiescontrol keyboard
Language Pack Installerlpksetup
Local Security Policysecpol.msc
Local Users and Groupslusrmgr.msc
Log outlogoff
Microsoft Malicious Software Removal Toolmrt
Microsoft Management Consolemmc
Access (Microsoft Office)msaccess
Excel (Microsoft Office)Excel
Powerpoint (Microsoft Office)powerpnt
Word (Microsoft Office)winword
Microsoft Paintmspaint
Microsoft Support Diagnostic Toolmsdt
Mouse Propertiescontrol mouse
or
main.cpl
Network Connectionscontrol netconnections
or
ncpa.cpl
Projector:
Connect to Network Projector
Switch projector display
netproj

displayswitch
Notepadnotepad
ODBC Data Source Admin
Default ODBC driver:
32-bit ODBC driver under 64-bit platform:

C:\windows\system32\odbcad32.exe
C:\windows\sysWOW64\odbcad32.exe
ODBC configuration - Install/configure MDAC driversodbcconf
On Screen Keyboardosk
OOB Getting Startedgettingstarted
Password - Create a Windows Password Reset Disk (USB)"C:\Windows\system32\rundll32.exe" keymgr.dll,PRShowSaveWizardExW
Pen and Touch (Tablet/Pen input configuration)tabletpc.cpl
Performance Monitorperfmon.msc
Phone and Modem Optionstelephon.cpl
Phone Dialerdialer
Power Configurationpowercfg.cpl and powercfg.exe
Presentation SettingsPresentationSettings
Problem Steps Recorderpsr
Program Access and Computer Defaults - browser / email / mediacomputerdefaults
Printers and Faxescontrol printers
Print Management (.msc)PrintManagement
Printer Migration (backup/restore)printbrmui and printbrm.exe
Printer user interface (List all printui.dll options)printui
Private Character Editoreudcedit
Regional Settings - Language, Date/Time format, keyboard locale.intl.cpl
Registry Editorregedit
Remote Assistancemsra
Remote Desktopmstsc
Resource Monitorresmon
Resultant Set of Policyrsop.msc
Settings (Windows 10)ms-settings:
Scheduled Taskscontrol schedtasks
Screenshot Snipping Toolsnippingtool
Security Centerwscui.cpl
Servicesservices.msc
Shared Folder Wizardshrpubw
Shared Foldersfsmgmt.msc
Shut Down Windowsshutdown
Software Licensing/Activationslui
Sounds and Audiommsys.cpl
Sound Recordersoundrecorder
Sound Volumesndvol
Syncronization Tool (Offline files)mobsync
System Configuration Utilitymsconfig
System File Checker Utility (Scan/Purge)sfc
System Informationmsinfo32
System Properties
sysdm.cpl SystemProperties
or
sysdm.cpl DisplaySYSDMCPL
System Properties - PerformanceSystemPropertiesPerformance
System Properties - HardwareSystemPropertiesHardware
System Properties - AdvancedSystemPropertiesAdvanced
System Repair - Create a System Repair Discrecdisc
System Restorerstrui
Task Managertaskmgr
Task Schedulertaskschd.msc
Telnet Clienttelnet
Trusted Platform Module Initialization WizardtpmInit

User Accounts (Autologon)
control userpasswords2
User Account Control (UAC) SettingsUserAccountControlSettings
User Profiles - Edit/Change typeC:\Windows\System32\rundll32.exe sysdm.cpl,EditUserProfiles
Windows Disc Image Burning Toolisoburn C:\movies\madmax.iso
Windows Explorerexplorer.exe
explorer.exe .  Will open at the current directory
Windows Featuresoptionalfeatures
Windows Firewall
Windows Firewall with Advanced Security
firewall.cpl
wf.msc
Windows Image Acquisition (scanner)wiaacmgr
Windows Magnifiermagnify
Windows Management Infrastructurewmimgmt.msc
Windows Memory Diagnostic Schedulermdsched
Windows Mobility Center (Mobile PCs only)mblctr
Windows PowerShellpowershell
Windows PowerShell ISEpowershell_ise
Windows Security Action Centerwscui.cpl
Windows Script Host(VBScript)wscript NAME_OF_SCRIPT.VBS
Windows System Security Tool. Encrypt the SAM database.
(boot password.)
syskey
Windows Updatewuapp
Windows Update Standalone Installerwusa
Windows Version (About Windows)winver
WordPadwrite


DescriptionShell: folder shortcutTypeRoaming?
Display installed Windows Updatesshell:AppUpdatesFolderSystem folder
Display links provided by your PC manufacturer (if any)shell:OEM LinksSystem folder
Open the Computer foldershell:MyComputerFolderSystem folder
Open the folder holding all user profilesshell:UserProfilesSystem folder
Open the Fonts foldershell:FontsSystem folder
Open the Games foldershell:GamesSystem folder
Open the HomeGroup foldershell:HomeGroupFolderSystem folder
Open the HomeGroup folder for the currently logged-on user (if any)shell:HomeGroupCurrentUserFolderSystem folder
Open the Network Places foldershell:NetworkPlacesFolderSystem folder
Open the Printers foldershell:PrintersFolderSystem folder
Open the Public Application Data foldershell:Common AppDataSystem folder
Open the Public Desktopshell:Common DesktopSystem folder
Open the Public Documents foldershell:Common DocumentsSystem folder
Open the Public Downloads foldershell:CommonDownloadsSystem folder
Open the Public Game Explorer foldershell:PublicGameTasksSystem folder
Open the Public ringtones folder.shell:CommonRingtonesSystem folder
Open the Public Start Menu foldershell:Common Start MenuSystem folder
Open the Public Start Menu Programs foldershell:Common ProgramsSystem folder
Open the Public Startup foldershell:Common StartupSystem folder
Open the Public Templates foldershell:Common TemplatesSystem folder
Open the Recycle Binshell:RecycleBinFolderSystem folder
Open the Users\Public folder (Shared files)shell:PublicSystem folder
Open the Windows installation folder (usually \Windows)shell:WindowsSystem folder
Open the Windows Resources folder (themes are stored here)shell:ResourceDirSystem folder
Open the Windows System foldershell:SystemSystem folder
Open the Windows System folder for 32-bit files on 64-bit Windows,
Or \Windows\System32 on 32-bit Windows
shell:Systemx86System folder
Access shortcuts pinned to the Start menu or Taskbarshell:User PinnedUser folderY
Display the user's Ringtones foldershell:RingtonesUser folder
Display further user tilesshell:Roaming TilesUser folderY
Display your user tiles (the images you can use for your account)shell:UserTilesUser folder
Open the Client Side Cache Offline Files folder, if supportedshell:CSCFolderUser folder
Open the folder where files are stored before being burned to discshell:CD BurningUser folder
Open the Public user tiles foldershell:PublicUserTilesUser folder
Open the Quick Launch folder (disabled by default)shell:Quick LaunchUser folderY
Open the Saved Games foldershell:SavedGamesUser folderY
Open the saved searches foldershell:SearchesUser folderY
Open the user‘s \Music\Playlists foldershell:PlaylistsUser folderY
Open the user‘s Application Data foldershell:AppDataUser folderY
Open the user‘s Application Data folder (same as %LOCALAPPDATA%)shell:Local AppDataUser folder
Open the user‘s certificates foldershell:SystemCertificatesUser folderY
Open the user‘s Credentials foldershell:CredentialManagerUser folderY
Open the user‘s desktop foldershell:DesktopUser folderY
Open the user‘s Documents foldershell:PersonalUser folderY
Open the user‘s downloads foldershell:DownloadsUser folderY
Open the user‘s encryption keys foldershell:CryptokeysUser folderY
Open the user‘s Game Explorer foldershell:GameTasksUser folder
Open the user‘s History foldershell:HistoryUser folder
Open the user‘s Links foldershell:LinksUser folderY
Open the user‘s Network Places foldershell:NetHoodUser folderY
Open the user‘s printer shortcuts foldershell:PrintHoodUser folderY
Open the user‘s profile folder (same as %USERPROFILE%)shell:ProfileUser folderY
Open the user‘s Send To foldershell:SendToUser folderY
Open the user‘s Start Menu foldershell:Start MenuUser folderY
Open the user‘s Start Menu Programs foldershell:ProgramsUser folderY
Open the user‘s Startup foldershell:StartupUser folderY
Open the user‘s Templates foldershell:TemplatesUser folderY
Open the user‘s Windows Contacts foldershell:ContactsUser folderY
Open the user‘s Recent Documents foldershell:RecentUser folderY
Opens the user‘s AppData\Roaming\Microsoft\Protect foldershell:DpAPIKeysUser folderY
Display 32-bit programs stored on 64-bit Windows,
or the \Program Files folder on 32-bit Windows
shell:ProgramFilesX86Internet Explorer
Display the Control Panelshell:ControlPanelFolderInternet Explorer
Open the user‘s Start Menu\Administrative Tools folder (if any)shell:Administrative ToolsInternet ExplorerY
Display Metro App shortcuts (Windows 8)shell:Immersive Application ShortcutsInternet Explorer
Open All Users Start Menu\Administrative Tools foldershell:Common Administrative ToolsInternet Explorer
Launches Internet Explorer Applets and applicationsshell:InternetFolderInternet Explorer
Open the Common Files for 32-bit programs stored on 64-bit Windows,
Or the Program Files\Common Files folder on 32-bit Windows
shell:ProgramFilesCommonX86Internet Explorer
Open the Control Panel "Install a program from the network" appletshell:AddNewProgramsFolderInternet Explorer
Open the Control Panel "Uninstall or change a program" appletshell:ChangeRemoveProgramsFolderInternet Explorer
Open the default Sidebar Gadgets foldershell:Default GadgetsInternet Explorer
Open the hidden ImplicitAppShortcuts foldershell:ImplicitAppShortcutsInternet ExplorerY
Open the Internet Explorer Cookies foldershell:CookiesInternet ExplorerY
Open the Internet Explorer Favorites foldershell:FavoritesInternet ExplorerY
Open the list of Network Connectionsshell:ConnectionsFolderInternet Explorer
Open the Program Files folder (same as %PROGRAMFILES%)shell:ProgramFilesInternet Explorer
Open the Program Files\Common Files foldershell:ProgramFilesCommonInternet Explorer
Open the Temporary Internet Files foldershell:CacheInternet Explorer
Open the user folder of downloaded Sidebar Gadgetsshell:GadgetsInternet Explorer
Open the Windows Search toolshell:SearchHomeFolderInternet Explorer
Display public libraries, if anyshell:PublicLibrariesLibrary
Display your Music libraryshell:MusicLibraryLibrary
Display your Pictures libraryshell:PicturesLibraryLibrary
Display your Videos libraryshell:VideosLibraryLibrary
Open the Documents libraryshell:DocumentsLibraryLibrary
Open the Libraries foldershell:LibrariesLibrary
Open the Windows Photo Gallery Original Images folder, if installedshell:Original ImagesMultimedia
Open the Public Music foldershell:CommonMusicMultimedia
Open the Public Pictures foldershell:CommonPicturesMultimedia
Open the Public Video foldershell:CommonVideoMultimedia
Open the Sample Music foldershell:SampleMusicMultimedia
Open the Sample Pictures foldershell:SamplePicturesMultimedia
Open the Sample Videos foldershell:SampleVideosMultimedia
Open the user‘s Music foldershell:My MusicMultimediaY
Open the user‘s Pictures foldershell:My PicturesMultimediaY
Open the user‘s Pictures\Slide Shows folder (if present)shell:PhotoAlbumsMultimediaY
Open the user‘s Videos foldershell:My VideoMultimediaY
Display Sync Centreshell:SyncCenterFolderWindows Sync Centre
Display Sync Centre Conflictsshell:ConflictFolderWindows Sync Centre
Display Sync Centre Resultsshell:SyncResultsFolderWindows Sync Centre
Open the Sync Centre Setup optionsshell:SyncSetupFolderWindows Sync Centre


Settings pageUri
Landing page for Settingsms-settings:
Aboutms-settings:about
Activationms-settings:activation
Apps & featuresms-settings:appsfeatures
Apps for websitesms-settings:appsforwebsites
Software Center (SCCM)softwarecenter:
AutoPlayms-settings:autoplay
Backupms-settings:backup
Recovery - Reset/Advanced startupms-settings:recovery
Battery Saverms-settings:batterysaver
Battery Saver - settingsms-settings:batterysaver-settings
Battery Saver - usagems-settings:batterysaver-usagedetails
Bluetooth Devicesms-settings:bluetooth
Shared experiencesms-settings:crossdevice
Default appsms-settings:defaultapps
For developersms-settings:developers
Displayms-settings:display
Display Screen rotationms-settings:screenrotation
Storagems-settings:storagesense
Offline Mapsms-settings:maps
Connected Devicesms-settings:connecteddevices
Touchpadms-settings:devices-touchpad
Mouse & Touchpad Devicesms-settings:mousetouchpad
Typingms-settings:typing
Find My Devicems-settings:findmydevice
USBms-settings:usb
Airplane modems-settings:network-airplanemode
Cellular Networkms-settings:network-cellular
DirectAccessms-settings:network-directaccess
Dial-up Networkms-settings:network-dialup
Ethernet Networkms-settings:network-ethernet
Proxy (Network)ms-settings:network-proxy
Network Statusms-settings:network-status
VPNms-settings:network-vpn
Wi-Fims-settings:network-wifi
Manage known Wi-Fims-settings:network-wifisettings
Sync your settingsms-settings:sync
Data Sensems-settings:datausage
Mobile Hotspotms-settings:network-mobilehotspot
Lock screenms-settings:lockscreen
Power & sleepms-settings:powersleep
Multitaskingms-settings:multitasking
Optional featuresms-settings:optionalfeatures
Personalizationms-settings:personalization
Backgroundsms-settings:personalization-background
Colorsms-settings:personalization-colors
ms-settings:colors
Start Menums-settings:personalization-start
Taskbarms-settings:taskbar
Themesms-settings:themes
Printersms-settings:printers
Proximityms-settings:proximity
Email & app accountsms-settings:emailandaccounts
Family & other usersms-settings:otherusers
Your workplacems-settings:workplace
Date & Timems-settings:dateandtime
Region & languagems-settings:regionlanguage
Sign-in optionsms-settings:signinoptions
Speechms-settings:speech
Privacyms-settings:privacy
Account info (privacy)ms-settings:privacy-accountinfo
Background apps (privacy)ms-settings:privacy-backgroundapps
App diagnostics (privacy)ms-settings:privacy-appdiagnostics
Call history (privacy)ms-settings:privacy-callhistory
Calendar (privacy)ms-settings:privacy-calendar
Contacts (privacy)ms-settings:privacy-contacts
Email (privacy)ms-settings:privacy-email
Feedback & diagnostics (privacy)ms-settings:privacy-feedback
Location (privacy)ms-settings:privacy-location
Messaging (privacy)ms-settings:privacy-messaging
Microphone (privacy)ms-settings:privacy-microphone
Motion (privacy)ms-settings:privacy-motion
Notifications and Actionsms-settings:notifications
Notifications (privacy)ms-settings:privacy-notifications
Other (privacy)ms-settings:privacy-customdevices
Radio (privacy)ms-settings:privacy-radios
Speech (privacy)ms-settings:privacy-speechtyping
Tasks (privacy)ms-settings:privacy-tasks
Webcam (privacy)ms-settings:privacy-webcam
Your info (Microsoft account)ms-settings:yourinfo
Closed Captioningms-settings:easeofaccess-closedcaptioning
High Contrastms-settings:easeofaccess-highcontrast
Keyboardms-settings:easeofaccess-keyboard
Magnifierms-settings:easeofaccess-magnifier
Mousems-settings:easeofaccess-mouse
Narratorms-settings:easeofaccess-narrator
Other optionsms-settings:easeofaccess-otheroptions
Projecting to this PCms-settings:project
Tablet modems-settings:tabletmode
Windows Defenderms-settings:windowsdefender
Windows Insider Program (beta's)ms-settings:windowsinsider
Troubleshoot - Fix Windows Updatems-settings:troubleshoot
Windows Updatems-settings:windowsupdate
WinUpdate - Check for updatesms-settings:windowsupdate-action
WinUpdate - Update historyms-settings:windowsupdate-history
WinUpdate - Advanced optionsms-settings:windowsupdate-options
WinUpdate - Restart optionsms-settings:windowsupdate-restartoptions

2019年12月15日星期日

通过cmd操作本地磁盘联机、脱机

首先打开cmd命令框,不知道怎么打开的同学同时按下windows图标键+R键,然后输入cmd回车

这时cmd命令窗口就打开了,输入diskpart命令,回车

通过cmd操作本地磁盘联机、脱机
现在是不是出现一个新的命令窗口?对就是这么神奇,接下来在新窗口中输入命令list disk 回车,你会看到你电脑当前链接的磁盘

通过cmd操作本地磁盘联机、脱机

如上图,继续输入select disk 1 回车,后面的1代表你要操作的磁盘序号,我这里暂时没有脱机的磁盘就随便选择了1。现在你已经选中了磁盘。


继续输入online disk 回车,好了你的磁盘现在已经联机了。

通过cmd操作本地磁盘联机、脱机

如果要尽行脱机只需将命令改为offline disk 回车,即可。

2019年12月14日星期六

2019年12月13日星期五

Ubuntu 调整交换分区 swap 分区的大小



一、准备工作
执行“sudo swapon -s”命令,查看是否已经存在swap file
示例:
root@ubuntu:~# sudo swapon -s
文件名                          类型            大小    已用    权限
/swap.img                               file            3992572 4128    -2

二、修改swap file
如果第一步存在swap.img则需要先禁用
sudo swapoff /swap.img

修改swap 空间的大小为512mb

sudo dd if=/dev/zero of=/swapfile bs=512MB count=1

设置文件为“swap file”类型

sudo mkswap /swap.img
示例:
root@ubuntu:~# sudo mkswap /swap.img
正在设置交换空间版本 1,大小 = 488.3 MiB (511995904  个字节)
无标签, UUID=e1d4a66c-e089-448f-8b4c-599975db6e28


启用swap.img

sudo swapon /swap.img



microsoft_hyper-v_server_2016 / 2019 使用教程


这是微软推出的一款专用虚拟化产品,没有图形界面,可以在客户机上远程操作,用起来很方便,但是要在客户端添加服务器确是相当的麻烦,绕了很多弯路,经过我的不懈努力,网上查了很多资料,结合实际操作,终于完成了远程管理的连接,本教程只涉及从客户端到服务器端建立管理连接的步骤,系统安装就不说了,过程非常简单。

1、关闭防火墙-服务端

netsh advfirewall set currentprofile state off

2、打开任务管理器,新任务,打开powershell,运行下列命令开启远程管理

Enable-PSRemoting

Enable-WSManCredSSP -role server

3、(非必须步骤)在服务器端(可以通过远程桌面)命令行执行下列命令对客户端进行授权, DESKTOP-G861A0D是客户端的名字

winrm set winrm/config/client @{TrustedHosts="DESKTOP-G861A0D"} 

4、客户端设置就比较麻烦了,第一步,右键开始,计算机管理,找到服务管理器,找到windows remote management服务,设置成自动启动,这是远程管理必须启用的服务。

5、在开始菜单里找到记事本,用管理员权限打开,文件菜单,打开,文件类型选择所有文件,

路径 c:\windows\system32\drivers\etc\   找到hosts文件,用记事本打开后在最后加上自己的服务器的ip和主机名,点击保存。如添加 192.168.1.106 hyperv  后保存。







6、控制面板,程序,启用或关闭windows功能,勾选hyperv管理工具,
下面的hyperv平台也可以根据需要勾选,那个是用来在windows10下面运行虚拟机的。

7、打开gpedit.msc组策略,找到计算机配置,管理模板,系统,凭据分配,
允许分配新的凭据用于仅NTLM服务器身份验证”,同时将“wsman/主机名” 添加到服务器列表中,我们这里就是“wsman/hyperv”,或“wsman/192.168.100.18”














8、开始菜单右键,以管理员权限运行powershell,输入下列命令,这是将服务器添加到客户端信任列表,
Enable-WSManCredSSP -Role client -DelegateComputer "hyperv"
或
Enable-WSManCredSSP -Role client -DelegateComputer "192.168.100.18"

9、在开始菜单里找到windows管理工具,hyperv管理器,打开后,
里面已经连接的是本地计算机,可以直接在本机创建虚拟机,我们这里是连接远程主机。
我们选择连接到服务器,另一台计算机,输入主机名,勾选作为另一个用户连接,
用户名是“主机名\用户名”的格式,输入密码,确定,就可以连接服务器了。

举个例子,我的客户端机计算机名是DESKTOP-G861A0D,服务器计算机名是WIN-N13NKBGUC2K,服务器用户名是Administrator,密码是123456
那么这里
用户名就应该用:
DESKTOP-G861A0D\Administrator
密码就应该用:
123456

鉴于登陆的麻烦 最好勾选“记住我的凭据”
登录成功如图,
可以新建虚拟网卡,外部网络是直接桥接物理网卡,
内部网络是主机与虚拟机之间可以互通的直连网卡,专用网络是只允许虚拟机使用的
至此,Hyper-V Server的安装就完工了,接下来可以在服务器管理器中右键启动Hyper-V管理器直接安装虚拟机。

额外的命令:
将IP为192.168.100.*的主机都加入信任列表
Set-Item  wsman:\localhost\Client\TrustedHosts -value 192.168.100.*


将Microsoft Hyper-V 2016用作文件服务器(16HVSRV01)和Windows Server 2016作为客户端服务器(16GUISRV01)。
配置步骤:


对安装好的Hyper-v Server进行基础配置:
1、切换到Powershell命令行,安装文件服务器角色,运行如下命令:
Install-WindowsFeature –Name FS-FileServer

2、使用powershell运行如下命令创建一个文件夹:
New-Item  -Type Directory -Path C:\Share -Name SMBShare

3、接下来让我们继续创建共享。由于我们有一个文件服务器的目录,我们可以使用PowerShell命令New-SmbShare。“-Name” 参数是共享名称, “- Path ”是共享目录的路径。 “-FullAccess” 意味着我们可以完全访问用户。示例命令如下:
New-SmbShare -Name SMBShare  -Path C:\Share -FullAccess Administrator


让我们来看看SMB共享是否已经在我们的2016客户端测试服务器上创建。我们可以在PowerShell中运行SmbConnection命令。

ubuntu18.04挂载示例:
1 、安装CIFS Utils包
sudo apt-get install cifs-utils
2 、创建挂载点
sudo mkdir /mnt/data
3 挂载(单次有效)
sudo mount -t cifs //192.168.100.250/Drive_E /mnt/data                               # 不需用户密码
sudo mount -t cifs -o username=Administrator //192.168.100.250/Drive_E  /mnt/data                    # 自动用户名,手动输入密码
sudo mount.cifs //192.168.100.250/Drive_E /mnt/data   -o username=Administrator,passord=123456      # 自动用户名和密码
4 写入fstab(重启后自动挂载)

192.168.100.250/Drive_E /mnt/data cifs username=Administrator,passord=123456 0 0
然后:
sudo mount -a


PowerShell 连接远程服务器
服务端
Enable-PSRemoting
winrm quickconfig   ——这个可能不需要

客户端
Set-Item wsman:\localhost\Client\Trustedhosts -value 192.168.100.*

Enter-PSSession -ComputerName 192.168.100.18 –Credential WORKGROUP\Administrator

2019年12月6日星期五

Docker删除镜像和容器


1、删除容器
1)首先需要停止所有的容器
docker stop $(docker ps -a -q)
2)删除所有的容器(只删除单个时把后面的变量改为image id即可)
docker rm $(docker ps -a -q)
2、删除镜像
1)查看host中的镜像
docker images
2)删除指定id的镜像
docker rmi
想要删除untagged images,也就是那些id为的image的话可以用
docker rmi $(docker images | grep "^" | awk "{print $3}")
3)删除全部的images
docker rmi $(docker images -q)
3、当要删除的iamges和其他的镜像有关联而无法删除时
可通过 -f 参数强制删除  docker rmi -f $(dockr images -q)

2019年12月3日星期二

DLNA分享服务设置(Linux minidlna版)


DLNA分享服务设置(Linux minidlna版)

目录:

1 背景
2 安装 DLNA Server
3 限制存取设备
3.1 ebtables设置
3.2 iptables设置
4 附录
4.1 ebtables基本命令
4.1.1 查看rules列表
4.1.2 新建/删除链
4.2 新建规则
5 参考

1 背景
DLNA 是 Digital Living Network Alliance 的缩写, 它是由 Sony 为首的多家厂商所组成的联盟, 并且制定出一套这用于数字媒体分享的协议.

最近的家用数字产品, 比如说手机, 平板电脑, 数字电视等几乎都标榜它们是符合 DLNA 认证的多媒体设备.

只要家中的数码设备连接到同一个区域网路, 使用 DLNA 就可以很方便地把数字媒体分享给不同的播放设备. 比如说把手机中的影片直接送到电视上播放, 或是把照片送进印表机中列印等等.

由于可以透过无线网路进行资料传输, 不需要接上传输线也不需要额外的设定动作, 相当方便.

这篇文章会间单介绍如何在 Linux 上架设 DLNA server 来分享媒体, 同时使用 ebtables 来限制使用设备.

2 安装 DLNA Server
首先是安装 DLNA server, 我使用的是 minidlna 这个很间单的软件. 在 Debian 上只要用apt 就可以安装了.

sudo apt-get install minidlna
接著, 编辑 /etc/minidlna.conf 来设定分享目录:

media_dir=/srv/media
第一行会把 /srv/media 底下所有的媒体文件(照片, 影片, 音乐)分享出去. 如果想要限制媒体的种类, 可以在目录前加上 V(影片), A(声音)或 P(照片)来指定种类:

media_dir=V,/srv/video
另外也别忘了指定 port 以及 server 的名称:

port=8200
model_name=My DLNA Server
然后更新 cache

sudo service minidlna force-reload
这么一来, 支持 DLNA 的播放程序如 media player 就可以直接浏览 server 上的媒体, 并且串流播放. 当然, 平板或手机也能轻易播放分享出来的媒体.

Sony 的手机和平板多半都有附上 DLNA browser, App 名称是「已连线的设备」, 打开后便会自动搜寻区域网路中的 DLNA server. 如果你的手机或平板没有内建这类软件, 可以安装 MediaHouse UPnP/DLNA Browser. 需要注意的是, 这些 DLNA browser 的功能比较类似文件管理器, 点选媒体后它们会启动系统中的媒体播放程序 (比如说 mx player 或 poweramp). 至于 iOS 的用护则有 AirPlayer 或是 media:connect 等选择, 它们多半本身就具备了媒体播放功能.

3 限制存取设备
3.1 ebtables设置
DLNA 是设计给家庭环境使用, 它假设能够连上家用区域网路的设备都通过了某种程度的认证 (比如说拥有无线网路密码), 因此它没有认证与权限相关的设定, 所有能连上区域网路的设备都可以播放 server 上的媒体.

尽管大部份的家庭环境是这样没错, 但有时候我们还是不希望把媒体分享给所有网路上的设备, 比如说租房子时使用的网路是与其它房客共享的, 若不想把照片影片一起分享给不认识的房客, 该怎麽做呢?

常见的解法是使用 MAC address 来作为区分. 一般来说在区域网路上的设备都有一个 MAC address, 我们可以设定只有登记在白名单上的设备才能浏览媒体. 在 Linux 上, 利用 MAC address 来过滤封包的程序叫作 ebtables.

sudo apt-get install ebtables
ebtables 用起来很像 iptables, 不同的地方在于他是作用在较低阶的链路层(link layer). 首先我们把 DLNA 相关封包抽出来, 并且设定它的预设处理方式为丢弃封包:

sudo ebtables -N dlna -P DROP
sudo ebtables -A INPUT -p IPv4 --ip-proto tcp --ip-destination-port 8200 -j dlna
接著把设备的 MAC address 加进 dlna chain 中, 并且设定为接受封包:

sudo ebtables -A dlna -s XX:XX:XX:XX:XX:XX -j ACCEPT
这么一来就只有已登记 MAC address 的设备可以看到 server 上的媒体了. 不过这并不算是非常安全的保护措施, 因此较为敏感的资料, 建议还是不要使用 DLNA 分享.

3.2 iptables设置
上面ebtables设置为转载的方法, 我试了, 不起作用, 网上说ebtables需要是bridge模式, 而非bridge模式不起作用. 后来改为iptables, 起到了效果.

sudo iptables -A INPUT -p tcp --dport 8200 -m mac --mac-source 00:22:44:66:88:aa -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 8200 -j DROP
注意上面两句的顺序, 需要先设置允许, 后设置DROP, 否则如果DROP在前, ACCEPT在后, 则会先执行DROP, 后面的ACCEPT就没有效果了.

如果之后还想再加入允许, 则可以用-I, 即insert, 插入允许.

sudo iptables -I INPUT 1 -p tcp --dport 8200 -m mac --mac-source 00:22:44:66:88:bb -j ACCEPT
4 附录
4.1 ebtables基本命令
4.1.1 查看rules列表
ebtables -L
ebtables -L –Lc , 查看各rule的匹配次数以及字节数
4.1.2 新建/删除链
ebtables -N
ebtables -X
4.2 新建规则
ebtables -A [ rules ]
[rules]有几种:

-s 源MAC
-d 目标MAC
-i 入接口
-o 出接口
5 参考
http://electronic-blue.herokuapp.com/blog/2013/01/sharing-digital-media-by-dlna-on-linux/

http://www.cnblogs.com/peteryj/archive/2011/07/24/2115602.html


转自:http://www.mikewootc.com/wiki/sw_develop/multimedia/dlna_server_linux_minidlna.html#%E8%83%8C%E6%99%AF 并有所修改.