Linux基本命令
对OS的操作:
|
命令 |
实现功能 |
|
Shutdown –h [DIFFERING TIME] Shutdown –h now |
OS的停止 |
|
Shutdown –r [DIFFERING TIME] Shutdown –r now |
OS的再启动 |
|
Ping |
OS的状态取得 |
|
sosreport --batch --tmp-dir=[ReportDir] |
诊断情报取得 |
|
wget [URL] |
http权限确认 |
|
Top –n 1 |
取得cpu的使用率 |
|
ls -la [directoryPath] |
ファイルのby-idを取得する |
|
cat [fstabFilePath] |
挂载情况取得 |
|
cat /etc/redhat-release |
版本情况取得 |
|
ifconfig -a |
取得ipadress |
|
sosreport |
生成系统诊断报告 |
|
Wget [URL] |
确认url是否可访问 |
对账户的操作:
|
命令 |
功能 |
|
Cat /etc/passwd |
查看当前所有账户 |
|
Useradd <option> $username -g $group -e $expireDate -d $homeDir -c $comment |
增加账户 |
|
Userdel <option> $username |
删除帐户 |
|
Passwd –l $username |
账户无效化 |
|
Passwd –u $username |
账户有效化 |
|
Echo “[USERNAME]:[PASSWORD]” |chpasswd |
变更账户密码 |
|
Passwd –S [USERNAME] |
得到账户状态 |
对服务(service)的操作
|
命令 |
功能 |
|
Chkconfig --list |
查看linux的所有服务 |
|
Service [daemon] stop |
停止服务 |
|
Service [daemon] start |
启动服务 |
|
Service [daemon] status |
查看服务状态 |
|
Service [daemon] restart |
服务重启动 |
对磁盘驱动的操作
|
命令 |
功能 |
|
Df -hl |
磁盘驱动的状态 |
对文件夹(目录)的操作:
|
命令 |
功能 |
|
Mkdir [dirpath] |
创建文件夹 |
|
Rm –rf [dirpath] |
删除文件夹 |
|
Cp –r [sourcepath][destinationpath] |
复制文件夹 |
|
Mv [sourcepath][destinationpath] |
移动文件夹 |
|
Chmod [authorityValue] [dirpath] |
设定文件夹权限 |
|
Zip –q –r [compresspath] [sourcedir] |
压缩文件夹 |
|
Stat [dirpath] Du –m [dirpath] |
取得文件夹状态 |
|
Ls [dirpath] |
取得文件夹的内容列表 |
|
mount -t [FileSystem] [DirPath] [MountPoint] |
挂载文件夹 |
|
Umout [MountPoint] |
解除挂载 |
|
mount |
取得挂载状态 |
对文件的操作:
|
命令 |
功能 |
|
Echo [FileContent] >[FilePath] Touch [FilePath] |
创建文件 |
|
Rm –rf [FilePath] |
删除文件 |
|
Cp –r –f [SourceFile][DestinationPath] |
复制文件 |
|
Mv [SourceFile] [DestinationPath] |
移动文件 |
|
chmod [AuthorityValue] [FilePath] |
设置文件权限 |
|
zip -q -r [CompressPath] [SourceFile] |
压缩文件 |
|
unzip -n [CompressFile] -d [DecompressPath] |
解压文件 |
|
Stat [filepath] Du –m [filepath] |
取得文件状态 |
|
cat [FilePath] |
取得文件内容 |
查看系统的运行级别:runlevel
设置系统的运行级别:telinit 运行级别
查看所有服务各个级别的运行状态:chkconfig –list
查看某个服务的各级别运行状态:chkconfig –list [服务名]
设置某个服务的运行级别状态:chkconfig --level [运行级别] [服务名] on/off
mount -o remount,rw /boot
浙公网安备 33010602011771号