网络工程师电脑cmd命令大全 (电脑中常用的cmd网络类命令)

一、Windows命令

开始→运行(cmd)命令大全(绝对经典)

CMD运行指令

开始→运行→CMD→键入以下命令即可:

gpedit.msc-----组策略

sndrec32-------录音机

Nslookup-------IP地址侦测器

explorer-------打开资源管理器

logoff---------注销命令

tsshutdn-------60秒倒计时关机命令

lusrmgr.msc----本机用户和组

services.msc---本地服务设置

oobe/msoobe /a----检查XP是否激活

notepad--------打开记事本

cleanmgr-------垃圾整理

net start messenger----开始信使服务

compmgmt.msc---计算机管理

net stop messenger-----停止信使服务

conf-----------启动netmeeting

dvdplay--------DVD*放播**器

charmap--------启动字符映射表

diskmgmt.msc---磁盘管理实用程序

calc-----------启动计算器

dfrg.msc-------磁盘碎片整理程序

chkdsk*ex.e**-----Chkdsk磁盘检查

devmgmt.msc--- 设备管理器

regsvr32 /u *.dll----停止dll文件运行

drwtsn32------ 系统医生

rononce -p ----15秒关机

dxdiag---------检查DirectX信息

regedt32-------注册表编辑器

Msconfig*ex.e**---系统配置实用程序

rsop.msc-------组策略结果集

mem*ex.e**--------显示内存使用情况

regedit*ex.e**----注册表

winchat--------XP自带局域网聊天

progman--------程序管理器

winmsd---------系统信息

perfmon.msc----计算机性能监测程序

winver---------检查Windows版本

sfc /scannow-----扫描错误并复原

winipcfg-------IP配置

taskmgr-----任务管理器(2000/xp/2003)

command--------cmd

fsmgmt.msc 共享文件夹

netstat -an----查看端口

osk 屏幕键盘

install.asp----修改注册网页

eventvwr.msc 时间查看器

secpol.msc 本地安全设置

services.msc 服务

2K

accwiz*ex.e** > 辅助工具向导

acsetups*ex.e** > acs setup dcom server executable

actmovie*ex.e** > 直接显示安装工具

append*ex.e** > 允许程序打开制定目录中的数据

arp*ex.e** > 显示和更改计算机的ip与硬件物理地址的对应列表

at*ex.e** > 计划运行任务

atmadm*ex.e** > 调用管理器统计

attrib*ex.e** > 显示和更改文件和文件夹属性

autochk*ex.e** > 检测修复文件系统

autoconv*ex.e** > 在启动过程中自动转化系统

autofmt*ex.e** > 在启动过程中格式化进程

autolfn*ex.e** > 使用长文件名格式

bootok*ex.e** > boot acceptance application for registry

bootvrfy*ex.e** > 通报启动成功

cacls*ex.e** > 显示和编辑acl

calc*ex.e** > 计算器

cdplayer*ex.e** > cd*放播**器

change*ex.e** > 与终端服务器相关的查询

charmap*ex.e** > 字符映射表

chglogon*ex.e** > 启动或停用会话记录

chgport*ex.e** > 改变端口(终端服务)

chgusr*ex.e** > 改变用户(终端服务)

chkdsk*ex.e** > 磁盘检测程序

chkntfs*ex.e** > 磁盘检测程序

cidaemon*ex.e** > 组成ci文档服务

cipher*ex.e** > 在ntfs上显示或改变加密的文件或目录

cisvc*ex.e** > 索引内容

ckcnv*ex.e** > 变换cookie

cleanmgr*ex.e** > 磁盘清理

cliconfg*ex.e** > sql客户网络工具

clipbrd*ex.e** > 剪贴簿查看器

clipsrv*ex.e** > 运行clipboard服务

clspack*ex.e** > 建立系统文件列表清单

cluster*ex.e** > 显示域的集群

_cmd_*ex.e** > 没什么好说的!

cmdl32*ex.e** > 自动*载下**连接管理

cmmgr32*ex.e** > 连接管理器

cmmon32*ex.e** > 连接管理器监视

cmstp*ex.e** > 连接管理器配置文件安装程序

comclust*ex.e** > 集群

comp*ex.e** > 比较两个文件和文件集的内容*

compact*ex.e** > 显示或改变ntfs分区上文件的压缩状态

conime*ex.e** > ime控制台

control*ex.e** > 控制面板

convert*ex.e** > 转换文件系统到ntfs

convlog*ex.e** > 转换iis曰志文件格式到ncsa格式

cprofile*ex.e** > 转换显示模式

cscript*ex.e** > 较本宿主版本

csrss*ex.e** > 客户服务器runtime进程

csvde*ex.e** > 曰至格式转换程序

dbgtrace*ex.e** > 和terminal server相关

dcomcnfg*ex.e** > dcom配置属性

dcphelp*ex.e** >

dcpromo*ex.e** > ad安装向导

ddeshare*ex.e** > dde共享

ddmprxy*ex.e** >

debug*ex.e** > 就是debug啦!

dfrgfat*ex.e** > fat分区磁盘碎片整理程序

dfrgntfs*ex.e** > ntfs分区磁盘碎片整理程序

dfs_cmd_*ex.e** > 配置一个dfs树

dfsinit*ex.e** > 分布式文件系统初始化

dfssvc*ex.e** > 分布式文件系统服务器

diantz*ex.e** > 制作cab文件

diskperf*ex.e** > 磁盘性能计数器

dllhost*ex.e** > 所有com+应用软件的主进程

dllhst3g*ex.e** >

dmadmin*ex.e** > 磁盘管理服务

dmremote*ex.e** > 磁盘管理服务的一部分

dns*ex.e** > dns applications dns

doskey*ex.e** > 命令行创建宏

dosx*ex.e** > dos扩展

dplaysvr*ex.e** > 直接运行帮助

drwatson*ex.e** > 华生医生错误检测

drwtsn32*ex.e** > 华生医生显示和配置管理

dtcsetup*ex.e** > installs mdtc

dvdplay*ex.e** > dvd*放播**

dxdiag*ex.e** > direct-x诊断工具

edlin*ex.e** > 命令行的文本编辑器(历史悠久啊!)

edlin*ex.e** > 命令行的文本编辑器(历史悠久啊!)

esentutl*ex.e** > ms数据库工具

eudcedit*ex.e** > type造字程序

eventvwr*ex.e** > 事件查看器

evnt_cmd_*ex.e** > event to trap translator; configuration tool

evntwin*ex.e** > event to trap translator setup

exe2bin*ex.e** > 转换exe文件到二进制

expand*ex.e** > 解压缩

extrac32*ex.e** > 解cab工具

fastopen*ex.e** > 快速访问在内存中的硬盘文件

faxcover*ex.e** > 传真封面编辑

faxqueue*ex.e** > 显示传真队列

faxsend*ex.e** > 发送传真向导

faxsvc*ex.e** > 启动传真服务

fc*ex.e** > 比较两个文件的不同

find*ex.e** > 查找文件中的文本行

findstr*ex.e** > 查找文件中的行

finger*ex.e** > 一个用户并显示出统计结果

fixmapi*ex.e** > 修复mapi文件

flattemp*ex.e** > 允许或者禁用临时文件目录

fontview*ex.e** > 显示字体文件中的字体

forcedos*ex.e** > forces a file to start in dos mode. 强制文件在dos模式下运行

freecell*ex.e** > popular windows game 空当接龙

ftp*ex.e** > file transfer protocol used to transfer files over a network conne

ction 就是ftp了

gdi*ex.e** > graphic device interface 图形界面驱动

grovel*ex.e** >

grpconv*ex.e** > program manager group convertor 转换程序管理员组

help*ex.e** > displays help for windows 2000 commands 显示帮助

hostname*ex.e** > display hostname for machine. 显示机器的hostname

ie4uinit*ex.e** > ie5 user install tool ie5用户安装工具

ieshwiz*ex.e** > customize folder wizard 自定义文件夹向导

iexpress*ex.e** > create and setup packages for install 穿件安装包

iisreset*ex.e** > restart iis admin service 重启iis服务

internat*ex.e** > keyboard language indicator applet 键盘语言指示器

ipconfig*ex.e** > windows 2000 ip configuration. 察看ip配置

ipsecmon*ex.e** > ip security monitor ip安全监视器

ipxroute*ex.e** > ipx routing and source routing control program ipx路由和源路由

控制程序

irftp*ex.e** > setup ftp for wireless communication 无线连接

ismserv*ex.e** > intersite messaging service 安装或者删除service control manage

r中的服务

jdbgmgr*ex.e** > microsoft debugger for java 4 java4的调试器

jetconv*ex.e** > convert a jet engine database 转换jet engine数据库

jetpack*ex.e** > compact jet database. 压缩jet数据库

jview*ex.e** > command-line loader for java java的命令行装载者

krnl386*ex.e** > core component for windows 2000 2000的核心组件

label*ex.e** > change label for drives 改变驱动器的卷标

lcwiz*ex.e** > license compliance wizard for local or remote systems. 许可证符合

向导

ldifde*ex.e** > ldif cmd line manager ldif目录交换命令行管理

licmgr*ex.e** > terminal server license manager 终端服务许可协议管理

lights*ex.e** > display connection status lights 显示连接状况

llsmgr*ex.e** > windows 2000 license manager 2000许可协议管理

llssrv*ex.e** > start the license server 启动许可协议服务器

lnkstub*ex.e** >

locator*ex.e** > rpc locator 远程定位

lodctr*ex.e** > load perfmon counters 调用性能计数

logoff*ex.e** > log current user off. 注销用户

lpq*ex.e** > displays status of a remote lpd queue 显示远端的lpd打印队列的状态,

显示被送到基于unix的服务器的打印任务

lpr*ex.e** > send a print job to a network printer. 重定向打印任务到网络中的打印 机。通常用于unix客户打印机将打印任务发送给连接了打印设备的nt的打印机服务器。

lsass*ex.e** > lsa executable and server dll 运行lsa和server的dll

lserver*ex.e** > specifies the new dns domain for the default server 指定默认se

rver新的dns域

os2*ex.e** > an os/2 warp server (os2 /o) os/2

os2srv*ex.e** > an os/2 warp server os/2

os2ss*ex.e** > an os/2 warp server os/2

osk*ex.e** > on screen keyboard 屏幕键盘

packager*ex.e** > windows 2000 packager manager 对象包装程序

pathping*ex.e** > combination of ping and tracert 包含ping和tracert的程序

pax*ex.e** > is a posix program and path names used as arguments must be specif

ied in posix format. use "//c/users/default" instead of "c:usersdefault."

启动便携式存档互换 (pax) 实用程序

Pent nt*ex.e** > used to check the pentium for the floating point division error

. 检查pentium的浮点错误

perfmon*ex.e** > starts windows performance monitor 性能监视器

ping*ex.e** > packet internet groper 验证与远程计算机的连接

posix*ex.e** > used for backward compatibility with unix 用于兼容unix

print*ex.e** > cmd line used to print files 打印文本文件或显示打印队列的内容。

progman*ex.e** > program manager 程序管理器

proquota*ex.e** > profile quota program

psxss*ex.e** > posix subsystem application posix子系统应用程序

qappsrv*ex.e** > displays the available application terminal servers on the net

work

在网络上显示终端服务器可用的程序

qprocess*ex.e** > display information about processes local or remote 在本地或远

程显示进程的信息(需终端服务)

query*ex.e** > query termserver user process and sessions 查询进程和对话

quser*ex.e** > display information about a user logged on 显示用户登陆的信息(需

终端服务)

qwinsta*ex.e** > display information about terminal sessions. 显示终端服务的信息

rasadmin*ex.e** > start the remote access admin service 启动远程访问服务

rasautou*ex.e** > creates a ras connection 建立一个ras连接

rasdial*ex.e** > dial a connection 拨号连接

ras*ex.e** > starts a ras connection 运行ras连接

rcp*ex.e** > copies a file from and to a rcp service. 在 windows 2000 计算机和运

行远程外壳端口监控程序 rshd 的系统之间复制文件

rdpclip*ex.e** > rdpclip allows you to copy and paste files between a terminal

session and client console session. 再终端和本地复制和粘贴文件

recover*ex.e** > recovers readable information from a bad or defective disk 从坏

的或有缺陷的磁盘中恢复可读取的信息。

redir*ex.e** > starts the redirector service 运行重定向服务

regedt32*ex.e** > 32-bit register service 32位注册服务

regini*ex.e** > modify registry permissions from within a script 用脚本修改注册

许可

register*ex.e** > register a program so it can have special execution character

istics. 注册包含特殊运行字符的程序

regsvc*ex.e** >

regsvr32*ex.e** > registers and unregister’s dll’s. as to how and where it regi

ster’s them i dont know. 注册和反注册dll

regtrace*ex.e** > options to tune debug options for applications failing to dum

p trace statements

trace 设置

regwiz*ex.e** > registration wizard 注册向导

remrras*ex.e** >

replace*ex.e** > replace files 用源目录中的同名文件替换目标目录中的文件。

reset*ex.e** > reset an active section 重置活动部分

rexec*ex.e** > runs commands on remote hosts running the rexec service. 在运行

rexec 服务的远程计算机上运行命令。rexec 命令在执行指定命令前,验证远程计算机

上的用户名,只有安装了 tcp/ip 协议后才可以使用该命令。

risetup*ex.e** > starts the remote installation service wizard. 运行远程安装向导

服务

route*ex.e** > display or edit the current routing tables. 控制网络路由表

routemon*ex.e** > no longer supported 不再支持了!

router*ex.e** > router software that runs either on a dedicated dos or on an os

. 检查pentium的浮点错误

perfmon*ex.e** > starts windows performance monitor 性能监视器

ping*ex.e** > packet internet groper 验证与远程计算机的连接

posix*ex.e** > used for backward compatibility with unix 用于兼容unix

print*ex.e** > cmd line used to print files 打印文本文件或显示打印队列的内容。

progman*ex.e** > program manager 程序管理器

proquota*ex.e** > profile quota program

psxss*ex.e** > posix subsystem application posix子系统应用程序

qappsrv*ex.e** > displays the available application terminal servers on the net

work

在网络上显示终端服务器可用的程序

qprocess*ex.e** > display information about processes local or remote 在本地或远

程显示进程的信息(需终端服务)

query*ex.e** > query termserver user process and sessions 查询进程和对话

quser*ex.e** > display information about a user logged on 显示用户登陆的信息(需

终端服务)

qwinsta*ex.e** > display information about terminal sessions. 显示终端服务的信息

rasadmin*ex.e** > start the remote access admin service 启动远程访问服务

rasautou*ex.e** > creates a ras connection 建立一个ras连接

rasdial*ex.e** > dial a connection 拨号连接

ras*ex.e** > starts a ras connection 运行ras连接

rcp*ex.e** > copies a file from and to a rcp service. 在 windows 2000 计算机和运

行远程外壳端口监控程序 rshd 的系统之间复制文件

rdpclip*ex.e** > rdpclip allows you to copy and paste files between a terminal

session and client console session. 再终端和本地复制和粘贴文件

recover*ex.e** > recovers readable information from a bad or defective disk 从坏

的或有缺陷的磁盘中恢复可读取的信息。

redir*ex.e** > starts the redirector service 运行重定向服务

regedt32*ex.e** > 32-bit register service 32位注册服务

regini*ex.e** > modify registry permissions from within a script 用脚本修改注册

许可

register*ex.e** > register a program so it can have special execution character

istics. 注册包含特殊运行字符的程序

regsvc*ex.e** >

regsvr32*ex.e** > registers and unregister’s dll’s. as to how and where it regi

ster’s them i dont know. 注册和反注册dll

regtrace*ex.e** > options to tune debug options for applications failing to dum

p trace statements

trace 设置

regwiz*ex.e** > registration wizard 注册向导

remrras*ex.e** >

replace*ex.e** > replace files 用源目录中的同名文件替换目标目录中的文件。

reset*ex.e** > reset an active section 重置活动部分

rexec*ex.e** > runs commands on remote hosts running the rexec service. 在运行

rexec 服务的远程计算机上运行命令。rexec 命令在执行指定命令前,验证远程计算机

上的用户名,只有安装了 tcp/ip 协议后才可以使用该命令。

risetup*ex.e** > starts the remote installation service wizard. 运行远程安装向导

服务

route*ex.e** > display or edit the current routing tables. 控制网络路由表

routemon*ex.e** > no longer supported 不再支持了!

router*ex.e** > router software that runs either on a dedicated dos or on an os

5 开始→运行(cmd)命令大全(绝对经典)

/2 system. route软件在 dos或者是os/2系统

rsh*ex.e** > runs commands on remote hosts running the rsh service 在运行 rsh 服

务的远程计算机上运行命令

rsm*ex.e** > mounts and configures remote system media 配置远程系统媒体

rsnotify*ex.e** > remote storage notification recall 远程存储通知回显

rsvp*ex.e** > resource reservation protocol 源预约协议

runas*ex.e** > run a program as another user 允许用户用其他权限运行指定的工具和

程序

rundll32*ex.e** > launches a 32-bit dll program 启动32位dll程序

runonce*ex.e** > causes a program to run during startup 运行程序再开始菜单中

rwinsta*ex.e** > reset the session subsystem hardware and software to known ini

tial values 重置会话子系统硬件和软件到最初的值

savedump*ex.e** > does not write to e:winntuser.dmp 不写入user.dmp中

scardsvr*ex.e** > smart card resource management server 子能卡资源管理服务器

schupgr*ex.e** > it will read the schema update files (.ldf files) and upgrade

the schema. (part of adsi) 读取计划更新文件和更新计划

secedit*ex.e** > starts security editor help 自动安全性配置管理

services*ex.e** > controls all the services 控制所有服务

sethc*ex.e** > set high contrast - changes colours and display mode logoff to s

et it back to normal 设置高对比

setreg*ex.e** > shows the software publishing state key values 显示软件发布的国

家语言

setup*ex.e** > gui box prompts you to goto control panel to configure system co

mponents 安装程序(转到控制面板)

setver*ex.e** > set version for files 设置 ms-dos 子系统向程序报告的 ms-dos 版本

sfc*ex.e** > system file checker test and check system files for integrity 系统

文件检查

sfmprint*ex.e** > print services for macintosh 打印macintosh服务

sfmpsexe*ex.e** >

sfmsvc*ex.e** >

shadow*ex.e** > monitor another terminal services session. 监控另外一台中端服务

器会话

share*ex.e** > windows 2000 和 ms-dos 子系统不使用该命令。接受该命令只是为了与

ms-dos 文件兼容

shmgrate*ex.e** >

shrpubw*ex.e** > create and share folders 建立和共享文件夹

sigverif*ex.e** > file signature verification 文件签名验证

skeys*ex.e** > serial keys utility 序列号制作工具

smlogsvc*ex.e** > performance logs and alerts 性能曰志和警报

smss*ex.e** >

sndrec32*ex.e** > starts the windows sound recorder 录音机

sndvol32*ex.e** > display the current volume information 显示声音控制信息

snmp*ex.e** > simple network management protocol used for network mangement 简单

网络管理协议

snmptrap*ex.e** > utility used with snmp snmp工具

sol*ex.e** > windows solitaire game 纸牌

二、Linux命令

1> 查看文件信息:ls

ls是英文单词list的简写,其功能为列出目录的内容,是用户最常用的命令之一,它类似于DOS下的dir命令。

Linux文件或者目录名称最长可以有265个字符,"."代表当前目录,"…"代表上一级目录,以"."开头的文件为隐藏文件,需要用 -a 参数才能显示。

ls常用参数:

windows网络常用cmd命令,常用的八个cmd网络命令

图中列出的信息含义如下图所示:

windows网络常用cmd命令,常用的八个cmd网络命令

与DOS下的文件操作类似,在Unix/Linux系统中,也同样允许使用特殊字符来同时引用多个文件名,这些特殊字符被称为通配符。

windows网络常用cmd命令,常用的八个cmd网络命令

2> 清屏:clear

clear作用为清除终端上的显示(类似于DOS的cls清屏功能),也可使用快捷键:Ctrl + l ( "l" 为字母 )。

3> 切换工作目录: cd

在使用Unix/Linux的时候,经常需要更换工作目录。cd命令可以帮助用户切换工作目录。Linux所有的目录和文件名大小写敏感

cd后面可跟绝对路径,也可以跟相对路径。如果省略目录,则默认切换到当前用户的主目录。

windows网络常用cmd命令,常用的八个cmd网络命令

注意:

如果路径是从根路径开始的,则路径的前面需要加上 " / ",如 " /mnt ",通常进入某个目录里的文件夹,前面不用加 " / "。

4> 显示当前路径:pwd

使用pwd命令可以显示当前的工作目录,该命令很简单,直接输入pwd即可,后面不带参数。

5> 创建目录:mkdir

通过mkdir命令可以创建一个新的目录。参数-p可递归创建目录。

需要注意的是新建目录的名称不能与当前目录中已有的目录或文件同名,并且目录创建者必须对当前目录具有写权限。

6> 删除文件:rm

可通过rm删除文件或目录。使用rm命令要小心,因为文件删除后不能恢复。为了防止文件误删,可以在rm后使用-i参数以逐个确认要删除的文件。

常用参数及含义如下表所示:

7> 拷贝:cp

cp命令的功能是将给出的文件或目录复制到另一个文件或目录中,相当于DOS下的copy命令。

常用选项说明:

windows网络常用cmd命令,常用的八个cmd网络命令

8> mv:移动、重命名

用户可以使用mv命令来移动文件或目录,也可以给文件或目录重命名。

常用选项说明:

9> 创建文件: touch

用户可以通过touch来创建一个空的文件,demo如下:

touch hello.txt

说明:

则会在当前路径下创建名字为hello.txt的空文件

Linux系统中没有严格的后缀(格式),所以创建文件时可以命名为任意的文件名

10. 输出重定向命令:>

Linux允许将命令执行结果重定向到一个文件,本应显示在终端上的内容保存到指定文件中。

如:ls > test.txt ( test.txt 如果不存在,则创建,存在则覆盖其内容 )

注意: >输出重定向会覆盖原来的内容,>>输出重定向则会追加到文件的尾部。

11. 分屏显示:more

查看内容时,在信息过长无法在一屏上显示时,会出现快速滚屏,使得用户无法看清文件的内容,此时可以使用more命令,每次只显示一页,按下空格键可以显示下一页,按下q键退出显示,按下h键可以获取帮助。

12. 管道:|

管道:一个命令的输出可以通过管道做为另一个命令的输入。

管道我们可以理解现实生活中的管子,管子的一头塞东西进去,另一头取出来,这里" | "的左右分为两端,左端塞东西(写),右端取东西(读)。

13. 建立链接文件:ln

Linux链接文件类似于Windows下的快捷方式。

链接文件分为软链接和硬链接。

软链接:软链接不占用磁盘空间,源文件删除则软链接失效。

硬链接:硬链接只能链接普通文件,不能链接目录。

使用格式:

ln 源文件 链接文件ln -s 源文件 链接文件

如果没有-s选项代表建立一个硬链接文件,两个文件占用相同大小的硬盘空间,即使删除了源文件,链接文件还是存在,所以-s选项是更常见的形式。

注意:如果软链接文件和源文件不在同一个目录,源文件要使用绝对路径,不能使用相对路径。

14. 查看或者合并文件内容:cat

15. 文本搜索:grep

Linux系统中grep命令是一种强大的文本搜索工具,grep允许对文本文件进行模式查找。如果找到匹配模式, grep打印包含模式的所有行。

grep一般格式为:

grep [-选项] ’搜索内容串’文件名

在grep命令中输入字符串参数时,最好引号或双引号括起来。

例如:

grep ’a’ 1.txt

常用选项说明:

windows网络常用cmd命令,常用的八个cmd网络命令

grep搜索内容串可以是正则表达式。

正则表达式是对字符串操作的一种逻辑公式,就是用事先定义好的一些特定字符、及这些特定字符的组合,组成一个"规则字符串",这个"规则字符串"用来表达对字符串的一种过滤逻辑。

grep常用正则表达式:

windows网络常用cmd命令,常用的八个cmd网络命令

16. 查找文件:find

find命令功能非常强大,通常用来在特定的目录下搜索符合条件的文件,也可以用来搜索特定用户属主的文件。

常用用法:

windows网络常用cmd命令,常用的八个cmd网络命令

17. 归档管理:tar

计算机中的数据经常需要备份,tar是Unix/Linux中最常用的备份工具,此命令可以把一系列文件归档到一个大文件中,也可以把档案文件解开以恢复数据。

tar使用格式 tar [参数] 打包文件名 文件

tar命令很特殊,其参数前面可以使用"-",也可以不使用。

常用参数:

windows网络常用cmd命令,常用的八个cmd网络命令

注意:除了f需要放在参数的最后,其它参数的顺序任意。

18. 文件压缩解压:gzip

tar与gzip命令结合使用实现文件打包、压缩。 tar只负责打包文件,但不压缩,用gzip压缩tar打包后的文件,其扩展名一般用xxxx.tar.gz。

gzip使用格式如下:

gzip [选项] 被压缩文件

常用选项:

windows网络常用cmd命令,常用的八个cmd网络命令

tar这个命令并没有压缩的功能,它只是一个打包的命令,但是在tar命令中增加一个选项(-z)可以调用gzip实现了一个压缩的功能,实行一个先打包后压缩的过程。

压缩用法:tar cvzf 压缩包包名 文件1 文件2 …

-z :指定压缩包的格式为:file.tar.gz

解压用法: tar zxvf 压缩包包名

-z:指定压缩包的格式为:file.tar.gz

解压到指定目录:-C (大写字母"C")

19. 文件压缩解压:bzip2

tar与bzip2命令结合使用实现文件打包、压缩(用法和gzip一样)。

tar只负责打包文件,但不压缩,用bzip2压缩tar打包后的文件,其扩展名一般用xxxx.tar.gz2。

在tar命令中增加一个选项(-j)可以调用bzip2实现了一个压缩的功能,实行一个先打包后压缩的过程。

压缩用法:tar -jcvf 压缩包包名 文件…(tar jcvf bk.tar.bz2 *.c)

解压用法:tar -jxvf 压缩包包名 (tar jxvf bk.tar.bz2)

20. 文件压缩解压:zip、unzip

通过zip压缩文件的目标文件不需要指定扩展名,默认扩展名为zip。

压缩文件:zip [-r] 目标文件(没有扩展名) 源文件

解压文件:unzip -d 解压后目录文件 压缩文件

21. 查看命令位置:which

22. 修改文件权限:chmod

chmod 修改文件权限有两种使用格式:字母法与数字法。

字母法:chmod u/g/o/a +/-/= rwx 文件

windows网络常用cmd命令,常用的八个cmd网络命令

windows网络常用cmd命令,常用的八个cmd网络命令

windows网络常用cmd命令,常用的八个cmd网络命令

如果需要同时进行设定拥有者、同组者以及其他人的权限,参考如下:

windows网络常用cmd命令,常用的八个cmd网络命令

windows网络常用cmd命令,常用的八个cmd网络命令

数字法:"rwx" 这些权限也可以用数字来代替

windows网络常用cmd命令,常用的八个cmd网络命令

如执行:chmod u=rwx,g=rx,o=r filename 就等同于:chmod u=7,g=5,o=4 filename

chmod 751 file:

文件所有者:读、写、执行权限

同组用户:读、执行的权限

其它用户:执行的权限

注意:如果想递归所有目录加上相同权限,需要加上参数" -R "。 如:chmod 777 test/ -R 递归 test 目录下所有文件加 777 权限

23. 切换到管理员账号

Ubuntu下切换到root的简单命令:

24. 设置用户密码:passwd

在Unix/Linux中,超级用户可以使用passwd命令为普通用户设置或修改用户密码。用户也可以直接使用该命令来修改自己的密码,而无需在命令后面使用用户名。

25. 退出登录账户: exit

如果是图形界面,退出当前终端;

如果是使用ssh远程登录,退出登陆账户;

如果是切换后的登陆用户,退出则返回上一个登陆账号。

26. 查看登录用户:who

who命令用于查看当前所有登录系统的用户信息。

常用选项:

windows网络常用cmd命令,常用的八个cmd网络命令

27. 关机重启:reboot、shutdown、init

windows网络常用cmd命令,常用的八个cmd网络命令