linux基础操作

1.
# cd /home
# mkdir tmp

# chmod 644 tmp/


2.
# touch test.txt
# vi test.txt
点i开始插入内容

点击Esc推出插入模式,输入:wq!保存并退出


3.

# sed -n "5,10p" test.txt


4.
ctime Create time是在写入文件、更改所有者、权限或链接设置时随 Inode 的内容更改而更改的。
# ls -lc test.txt
atime Access time是在读取文件或者执行文件时更改的。
# ls -lu test.txt
mtime Modified time是在写入文件时随文件内容的更改而更改的。

# ls -l test.txt


5
# find /home/ -ctime -1
# find /home/ -mtime -1
# find /home/ -size +2M


6

查看/home/tmp目录的使用情况
# cd /home/tmp/
# du -h
查看系统的资源使用情况
# df -h

7.
# cd /home/tmp/
# mkdir worker

8
# cd /home/tmp/
# cp test.txt worker/test01.txt

9.
# ln test01.txt hard
# ln -s test01.txt  soft
# ll
总用量 16
drwxr-xr-x 2 root root 4096  5月  6 19:20 ./
drw-r--r-- 3 root root 4096  5月  6 19:19 ../
-rw-r--r-- 2 root root  634  5月  6 19:19 hard
lrwxrwxrwx 1 root root   10  5月  6 19:20 soft -> test01.txt
-rw-r--r-- 2 root root  634  5月  6 19:19 test01.txt

inode(index node)文件索引节点。
硬链接与原文件拥有同样的inode,是同一个文件使用了多个别名
软链接有着自己的 inode 号以及用户数据块,用户数据块中存放的是源文件的路径名
删除原文件对硬链接文件没影响,但是软链接失效。

10.

# touch 1.txt
# echo "I'm chinese" > 1.txt
# touch 2.txt
# echo "Are you OK?" > 2.txt
# cat 1.txt
I'm chinese
# cat 2.txt
Are you OK?
# cat 1.txt 2.txt -n
     1    I'm chinese
     2    Are you OK?
# cat -n 1.txt 2.txt > 3.txt

11.
# find /home/ -name *cu*
# find /home/tmp/ -type f | xargs grep "cu"

12.
# tree /usr/

13.
# chmod u+w test.txt
# chmod ug+r test.txt
# chmod u+x test.txt

14.
# ps -ef | grep sql > sql.log

15.
# tar -zcPvf /home/myfile.tar.gz /home/tmp

16.
# echo $PATH
# export PATH=/mypath/to/dir/:$PATH
# unset PATH

17.
# ping 127.0.0.1
# telnet 127.0.0.1 22

18.
# scp test.txt root@127.0.0.1:/home/
# ssh 127.0.0.1
password:
# ls /home/test.txt

19.
# ftp 127.0.0.1
username:
password:
ftp> put test.txt
ftp> get test.txt




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值