Linux常用基础命令

pwd显示工作目录
  1. [root@localhost ~]# pwd
  2. /root
cd 切换回家目录,注意:bash中,~表示家目录:
  1. [root@localhost ~]# cd
  2. [root@localhost ~]#
cd ~USERNAME:切换至指定用户的家目录;cd ~切换回自己的家目录; cd -:在上一次所在目录与当前目录之间来回切换;
  1. [root@localhost ~]# cd ~goodlove007
  2. [root@localhost goodlove007]#

ls 列出指定目录下的内容
  1. ls [OPTION]... [FILE]...
ls -a 显示所有文件,包括隐藏文件
  1. [root@localhost ~]# ls -a
  2. . .bash_logout .config .lesshst
  3. .. .bash_profile .cshrc original-ks.cfg
  4. anaconda-ks.cfg .bashrc .dbus .tcshrc
  5. .bash_history .cache initial-setup-ks.cfg
ls -A 显示除.和..之外的所有文件
  1. [root@localhost ~]# ls -A
  2. anaconda-ks.cfg .bash_profile .config initial-setup-ks.cfg .tcshrc
  3. .bash_history .bashrc .cshrc .lesshst
  4. .bash_logout .cache .dbus original-ks.cfg
ls -l:–long,长格式列表,即文件的详细属性信息
  1. [root@localhost ~]# ls -l
  2. total 12
  3. -rw-------. 1 root root 2949 Jun 15 18:39 anaconda-ks.cfg
  4. -rw-r--r--. 1 root root 2964 Jun 15 11:02 initial-setup-ks.cfg
  5. -rw-------. 1 root root 2066 Jun 15 18:39 original-ks.cfg
        

  1. -rw-------. 1 root root 2949 Jun 15 18:39 anaconda-ks.cfg
    -: 文件类型,-,d,b,c,l,s,p
    rw——-
    rw-:文件属主的权限;
    —:文件属组的权限;
    —:其他用户(非属主、属组)的权限;
                        1:数字表示文件被硬链接的次数;
                        root:文件的属主;
                        root:文件的属组;
                        2949:数字表示文件的大小,单位是字节
                        Jun 15 18:39 :文件最后一次被修改的时间;
                        anaconda-ks.cfg 文件名
ls -h,–human-readable:对文件大小单位换算;换算后的结果可能会非精确值;
  1. [root@localhost ~]# ls -lh
  2. total 12K
  3. -rw-------. 1 root root 2.9K Jun 15 18:39 anaconda-ks.cfg
  4. -rw-r--r--. 1 root root 2.9K Jun 15 11:02 initial-setup-ks.cfg
  5. -rw-------. 1 root root 2.1K Jun 15 18:39 original-ks.cfg
ls -d:查看目录自身而非其内部的文件列表;

  1. [root@localhost ~]# ls -d
  2. .
ls -r:逆序显示;

  1. [root@localhost ~]# ls
  2. anaconda-ks.cfg initial-setup-ks.cfg original-ks.cfg
  3. [root@localhost ~]# ls -r
  4. original-ks.cfg initial-setup-ks.cfg anaconda-ks.cfg
ls -R:递归显示;

原创文章,作者:N27_太极异次元,如若转载,请注明出处:http://www.178linux.com/78574

(0)
上一篇 2017-06-25 23:44
下一篇 2017-06-26 08:32

相关推荐

  • rpm实现LAMP

    rpm实现LAMP部署 LAMP概述 LAMP指的Linux(操作系统)、ApacheHTTP 服务器,MySQL(有时也指MariaDB,数据库软件) 和PHP(有时也是指Perl或Python) 的第一个字母,一般用来建立web应用平台。常用来搭建动态网站或者服务器的开源软件,本身都是各自独立的程序,但是因为常被放在一起使用,拥有了越来越高的兼容度,共同…

    Linux干货 2016-11-02
  • Linux第四周总结

    1、复制/etc/skel目录为/home/tuser1, 要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。 2、编辑/etc/group文件,添加组hadoop。 3、手动编辑/etc/passwd文件新增一行,添加用户hadoop, 其基本组ID为hadoop组的id号;其家目录为/home/hadoop。 4、复制/etc/…

    2017-07-24
  • N26-第四周作业

    1、复制/etc/skel目录为/home/tuser1,要求/home/tuser1及其内部文件的属组和其它用户均没有任何访问权限。 [root@localhost ~]# cp -rfp /etc/skel/ /home/tuser1[root@localhost ~]# chmod 700 /home/tuser1 2、编辑/etc/group文件,添…

    Linux干货 2017-02-25
  • 35个强大的UI设计教程

    下面是35个非常不错的UI设计的的教程及效果图,非常不错哦。不但教你如何做一些特效,同样教你如何做UI布局和界面设计。当然,他们风格迥异,也基本上都是Web页面上的。都非常不错。希望你喜欢。(点击下面的图片可以打开相关的教程) Old Paper Layout Professional Modern Web Layout Photography portfo…

    Linux干货 2015-04-01
  • 浅述sed命令

    1、sed工作原理       sed(stream editor)是一种流编辑器,本身也是一个管道命令,可以分析编辑标准输入(standard input),包括对数据进行替换、删除、新增、选取特定行等等。运行时以行为单位,每次只处理一行的内容,因此它又被称为行编辑器。sed还可与正则表达式配合使用,从而简…

    Linux干货 2016-08-10
  • 加密与CA

    一次加密通讯流程: 1、生成数据 2、用单向加密数据生成特征码 3、用自己的私钥加密特征码放在数据后面 4、生成临时会话密钥加密特征码和数据 5、用对方的公钥加密临时密钥 2、私有CA 构建私有CA     1、生成私钥     2、自签署证书 给节点发放证书     …

    Linux干货 2017-02-13