linux基础操作
2016-05-06 20:18
627 查看
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
# 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
相关文章推荐
- Linux socket 初步
- Linux Kernel 4.0 RC5 发布!
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)
- Linux 信号signal处理机制
- linux下mysql添加用户
- Scientific Linux 5.5 图形安装教程
- Linux 下无损图片压缩小工具介绍