linux基本使用--文件查看方式、硬链接和软连接

这里也是介绍一些基本的Linux使用,大家可以了解以下:

 

 

下面也是latex源码,大家可以自己编译:

\subsection{多种文件查看方式}

\par{

    \begin{itemize}

        \item 网络配置目录:cd /etc/sysconfig/network-scripts/

        \item 强制终止控制台程序:ctrl + c

        \item ping命令:ping命令通常用来作为网络可用性的检查。ping命令可以对一个网络地址发送测试数据包,看该网络地址是否有响应并统计响应时间,以此测试网络。

        \item windows下查看网络配置:ipconfig

        \item linux下查看网络配置:ifconfig

        \item cat: 从第一行开始显示文件内容,用来读文章,配置文件等,如:cat ifcfg-eth0

        \item tac:倒过来看文件,如:tac ifcfg-eth0.

        \item nl: 带行号的输出,如:nl ifcfg-eth0

        \item more:一页一页的显示内容 比如:more ifcfg-eth0 (这时候使用空格代表翻页,enter 表示向下看一行,输入:f可以看到当前所在行号)

        \item less: 和more类似,不过此时可以用上下键来上下翻页(q退出,空格翻页) ,特别的,less进入文件后,输入/set回车(表示当前路径向下查询),就可以找到所有有set的字符串,而如果使用?set回车,表示向上查询。另外用n表示向上继续找,N表示向下继续找。

        \item head:查看头几行:head -n 20 csh.login(通过-n参数,这里20就表示20行)

        \item tail:倒着看最后几行: tail -n 20 csh.login

    \end{itemize}

}

\subsection{硬链接和软链接

}

\par{

    \begin{itemize}

        \item 了解即可。

        \item linux链接分为两种:硬链接、软链接

        \item 硬链接:A -- B: 假设B是A的硬链接,那么它们两个指向同一个文件。此时删除A,B也能访问。即此时允许一个文件有多个路径,可以保险,防止误删

        \item 软链接:就是类似wendows下的快捷方式,删除了原文件,快捷方式也访问不了。

        \item 创建链接 ln命令

        \item echo: 输出字符串

        \item 举例:\begin{lstlisting}[language = { }]

[root@iZ2ze4f7ojth2fexuggrimZ /]# cd /home

[root@iZ2ze4f7ojth2fexuggrimZ home]# ls

hjc  jcstudy  redis  www

[root@iZ2ze4f7ojth2fexuggrimZ home]# touch f1 #创建一个文件

[root@iZ2ze4f7ojth2fexuggrimZ home]# ls

f1  hjc  jcstudy  redis  www

[root@iZ2ze4f7ojth2fexuggrimZ home]# ln f1 f2 #创建一个硬链接

[root@iZ2ze4f7ojth2fexuggrimZ home]# ls

f1  f2  hjc  jcstudy  redis  www

[root@iZ2ze4f7ojth2fexuggrimZ home]# ln -s f1 f3 #创建一个软链接

[root@iZ2ze4f7ojth2fexuggrimZ home]# ls

f1  f2  f3  hjc  jcstudy  redis  www

[root@iZ2ze4f7ojth2fexuggrimZ home]# ll

total 16

-rw-r--r-- 2 root  root     0 Jul  8 16:34 f1

-rw-r--r-- 2 root  root     0 Jul  8 16:34 f2

lrwxrwxrwx 1 root  root     2 Jul  8 16:34 f3 -> f1

drwxr-xr-x 2 root  root  4096 Jun 30 18:44 hjc

drwxr-xr-x 2 root  root  4096 Jul  1 15:37 jcstudy

drwx------ 2 redis redis 4096 Jun 27 18:54 redis

drwx------ 3 www   www   4096 Jun 27 18:53 www

[root@iZ2ze4f7ojth2fexuggrimZ home]# echo "i love" >> f1 #向f1中输入内容

[root@iZ2ze4f7ojth2fexuggrimZ home]# cat f1

i love

[root@iZ2ze4f7ojth2fexuggrimZ home]# cat f2

i love

[root@iZ2ze4f7ojth2fexuggrimZ home]# cat f3

i love

[root@iZ2ze4f7ojth2fexuggrimZ home]# rm -rf f1 #递归删除f1以下所有文件

[root@iZ2ze4f7ojth2fexuggrimZ home]# ls

f2  f3  hjc  jcstudy  redis  www

[root@iZ2ze4f7ojth2fexuggrimZ home]# cat f2

i love

[root@iZ2ze4f7ojth2fexuggrimZ home]# cat f3

cat: f3: No such file or directory



 

        \end{lstlisting}

    \end{itemize}

}

 

  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值