快速入门--Linux常用指令实操(1)

操作步骤 命令示例
设置 root 密码 sudo passwd root
创建新目录 mkdir project
进入 project 目录 cd project
查看当前路径 pwd
查看目录内容 ls -l
创建 temp 目录 mkdir temp
删除空目录 temp rmdir temp
文件查看相关
分页查看文件 more hello.txt
高级分页查看 less hello.txt
查看文件结尾 tail hello.txt
编辑文件 gedit hello.txt
文件管理相关
复制文件 cp file1.txt ~/home/usr/
移动/重命名文件 mv oldname.txt newname.txt
删除文件 rm file.txt
压缩与解压
打包并压缩目录 tar -czvf project.tar.gz project
解压 tar.gz 文件 tar -xzvf project.tar.gz
系统信息相关
保存启动信息 dmesg > boot.log
查看系统内核版本 uname -a
显示系统时间 date
权限与用户管理
添加执行权限 chmod +x test.sh
更新软件列表 sudo apt update
切换到 root 用户 sudo su
Shell 脚本基础说明
创建脚本文件 使用编辑器创建 .sh 文件,如 gedit test.sh
赋予脚本执行权限 chmod +x test.sh
执行脚本 ./test.sh

你可能感兴趣的:(服务器,linux,运维)