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)
N27_太极异次元N27_太极异次元
上一篇 2017-06-25
下一篇 2017-06-26

相关推荐

  • Linux 第五天: (08月01日) Linux用户组管理

    Linux 第五天: (08月01日) Linux用户组管理         管理员 root,0普通用户 1-65535系统用户 1-499(centos6), 1-999(centos7)登录用户 500(centos6)+, 1000(centos7)+   /etc/passwd 用户及属性/etc/…

    Linux干货 2016-08-08
  • Linux中磁盘管理与文件系统创建挂在

    磁盘管理 Linux中哲学思想:Linux一切皆文件,所有访问磁盘设备就如同访问一个文件一样,因此要想使用需要一个文件接口 如何向设备中输入数据?     首先将设备在系统上映射成一个文件,在此文件上进行读写操作就相当于对设备进行读写,对程序而言首先是打开一个文件open(),然后执行read()或者write(),最…

    Linux干货 2016-08-26
  • 实现NFS为lamp环境web站点提供共享存储

    1.实验需求 (1)nfs server导出/data/application/web,在目录中提供wordpress; (2)nfs client挂载nfs server导出的文件系统,至/var/www/html; (3)客户端1(lamp)部署wordpress,并让其正常访问,要确保正常发文章,上传图片。 (4)客户端2(lamp),挂载nfs se…

    Linux干货 2017-05-02
  • Linux中账号管理之权限管理(下)

    linux中的账号管理我们在前面两张已经介绍了一些用户和组的相关概念,常用的配置文件,命令的使用。现在我们来看看账号管理中最傲娇的部分就是我们的权限管理。 一、简单介绍权限的概念 以install.log这个文件为例,查看install.log的元数据,从下图可以看出,每个文件或者目录都有它的所属的主和所属组,最左边显示不仅有它所属类型,还有它的读取写入执行…

    Linux干货 2016-08-08
  • 第五周作业

    1、显示当前系统上root、fedora或user1用户的默认shell; [root@localhost ~]# egrep '^(fedora|root|user1):' /etc/passwd |cut -d: -f1,7 root:/bin/bash user1…

    Linux干货 2017-02-04
  • lamp的编译安装

    基于http的php模块模式 一、需要准备的软件:     apr-1.5.0.tar    apr-util-1.5.3.tar    httpd-2.4.9.tar        mysql-5.5.33-…

    Linux干货 2016-06-22