Linux常用命令

ls 查询
clear 清屏
pwd 查询目录
mkdir hello 创建文件夹(hello)
rm -rf /hello 删除文件夹(hello)

命令 条件 参数

命令用法不会可以

a. 命令 –help
如 cd –help
b. man 命令
如man ls

  1. ls 命令

a.显示当前文件夹有啥
ls
b. 列表方式显示
ls -l
c. 显示隐藏文件
ls -a
d. 结合-l -a
ls -al 或者 ll
c. 查看外设
ls /dev/tty*

4.文件夹

a. 创建文件夹
mkdir hello
b. 创建嵌套文件夹
mkdir -p a/b/c/d
c. 删除文件夹(命令删除 永久删除(回收站没有))
rm -r hello
d. 注意(删除电脑所有文件 会瘫痪 超级权限 sudo rm -r /)
rm -r /

  1. touch

a. 新建文件
touch hello.txt
b. 删除文件
rm hello.txt (永久删除)
rm -rf hello (删除文件夹 永久删除)
6. 拷贝文件 cp
cp --help
a. cp [选项]… [-T] 源文件 目标文件
cp test.txt Downlosds/
b. 同级目录下拷贝文件
cp text.txt hello.txt (拷贝text.txt,拷贝的改成hello.txt)
c. 拷贝文件夹 cp -r
cp -r test 下载/ (将test文件夹 拷贝到 下载目录)
d. 特殊拷贝(通配符的使用)
cp -r test/.md 下载/ (将test文件夹以及文件夹中的.md文件 拷贝到 下载目录)
7.移动文件 剪切 mv
a. mv test.txt
b. mv test.txt hello.txt
c. mv test 下载/ (不需要-r)
d. mv test/
下载/

8.打印输出 echo
a.在终端打印
echo “hello itcast”
b. 往文件打印 > (覆盖)
echo “hello itcast” > text.txt
c. 查看文件内容 cat
cat text.txt
d. 往文件打印 > > (追加)
echo “你好” >> text.txt
e.合并文件
cat test_1.txt test_2.txt > test.txt
9.压缩/解压 命令
tar -czvf / tar -xzvf
zip / unzip
a.打包文件
tar -czvf test.tar.gz(包名) *.txt
zip bat(包名 ) *.txt
b.打包文件夹
tar -czvf (包名) test
zip -r(包名 )test
c. 解压
tar -xzvf test.tar.gz(包名)
unzip bat(包名)
d. 解压到某个文件夹
tar -xzvf test.tar.gz(包名) -C 下载/
unzip -d test bak.zip

10.下载 wget
a. 下载
wget 网址
b.下载重命名 (图片重命名 hello)
wget -o hello.jpg 路径(网址)
c. tree
d. which (查询在哪)
which ls

11.网络命令
a.查看ip ifconfig
b.查看对方网络是否工作 ping
c.
ssh 账号名 IP地址

12用户权限 chmod(r w x )(读 写 执行)
r----4
w----2
x----1
a. 加减权限 chmod + chmod -
chmod +w
chmod -w
b.所有者u 所有者属于一个组g 其他人o 三个都 a
chmod u+w
chmod o+w
c. 可执行 x
chmod a+x test.py
d. chmod 622 test.txt (6=4+2=rw权限 2=w 写权限 1=可执行权限)
13.更改密码
a.更改密码 passwd (sudo passwd)
passwd wzy (更改wzy的密码)
b.查看当前用户
whoami
c.显示系统
uname
uname -a (显示内核)
d.发行版本(16.04 18.04等)
lsb_realease -a
e. CPU
lscpu
f. CPU 占用
top

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值