Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 19

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 20

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 21

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 22

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/wwwroot/phxin.top/usr/themes/Joe/public/config.php on line 23
Linux常用命令 - Hello World

Linux常用命令

清歌
2022-10-05 / 0 评论 / 0 阅读 / 正在检测是否收录...

Ubuntu常用命令

TAB键可将命令补全
调出帮助
  [命令] --help
目录查看命令
ls  [选项] [目录名]
当前路径显示
pwd  [--help][--version]
--help 在线帮助。
--version 显示版本信息。
系统信息查看命令
uname  [-参数]
清屏
clear
显示文件内容
cat filename
切换用户身份
sudo 
文件拷贝
cp
切换用户
su
移动及重命名文件
mv
创建文件夹
mkdir
创建文件
touch
删除
rm
目录删除
rmdir
显示网络配置命令
ifconfig
重启
rebot
关机
poweroff
系统帮助命令
man
数据同步写入磁盘
sync
查找文件
find
查找内容
grep
文件夹大小查看
du
磁盘空间检查
df
使用gedit打开某个文件
gedit
当前的系统进程查看
ps
进程实时运行状态查看
top

Ubuntu安装软件方式

1.使用软件商店
2.使用APT命令
sudo apt-get install [软件]
3.deb软件包安装
sudo dpkg -i xxx.deb
4.自己编译源代码
一般都会有编译教程

绝对路径和相对路径

绝对路径:从根目录"/"算起的路径
相对路径:相对于当前路径文件
".":表示当前路径,也用"./"
"..":表示上一层目录,也用"../"

Ubuntu下的压缩与解压

1.gzip工具

gzip工具主要负责.gz格式的压缩包
gzip xxx 压缩xxx
gzip -d xxx.gz 解压xxx
gzip -r xxx 对文件夹进行压缩
gzip -rd xxx.gz 对文件夹进行解压

2.bzip2工具

bzip -z xxx 压缩xxx
bzip2 -d xxx.gz 解压xxx

3.tar工具(最常用)
tar [-参数] [文件或文件夹]

-f 使用归档文件
-c 压缩文件
-x 解压文件
-j 使用bzip2压缩格式
-z 使用gzip压缩格式
-v 打印出命令执行过程
tar -vxjf xxx.tar.bz2 对xxx.tar.bz2解压
tar -vxjf xxx.tar.bz2 对xxx.tar.bz2压缩
tar -vxzf xxx.tar.gz 对xxx.tar.gz解压
tar -vxjf xxx.tar.gz 对xxx.tar.gz压缩

4.rar工具

sudo apt-get install rar 安装rar
rar x xxx.rar 解压xxx.rar
rar a xxx.rar xxx 压缩xxx

  1. zip工具

zip -rf xxx.zip xxx 压缩xxx
unzip -v xxx.zip 解压xxx.zip

创建用户和用户组

1.图形化界面
sudo apt-get install gonme-system-tools
2.命令创建

adduser xxx 添加用户xxx
finger xxx 查询用户xxx
passwd xxx 修改用户密码
deluser xxx 删除用户xxx
addgroup xxx 添加用户组xxx
gruop xxx 显示用户组xxx内用户名
delgroup xxx 删除用户组xxx

文件权限

r或4 代表只读
w或2 代表只写
x或1 代表可执行
chnod 修改文件权限
chmod rwx xxx xxx权限修改为读写执行
chown 修改文件所属组
chown xxx.yyy zzz 将文件zzz改为yyy组下的xxx用户

vim编辑器

vim分为三种模式
一般模式(指令模式):默认模式 打开文件自动进入
编辑模式:按下"i、I、a、A、o、O、s、S"进入编辑模式
命令模式(底行模式):输入":、/、?"任意一种进入命令行模式
/xxx 在文件中查找xxx
vim xxx 修改或者创建xxx文件
:wq 退出并保存
:q! 退出不保存
:w 保存
:q 退出

一般模式下:

dd 删除光标所在行
u 恢复上一步
. 重复前一个操作
yy 复制光标所在行
nyy 复制光标所在向下n行
p和P p复制到光标下一行 P复制到光标上一行

0

评论 (0)

取消