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 23:44
下一篇 2017-06-26 08:32

相关推荐

  • LVS实现负载均衡wordpress

    项目构建: LVS实现基于https wordpress 组建 必需软件: nfs-utils-1.2.3-70.el6.x86_64 配置步骤: 1.在D主机设置NFS共享目录 /app/nfsdata #mkdir /app/nfsdata //最好用LVM 实现在线扩展 #chown mysql: /app/data //确认该主机mysql用户存在 …

    2017-05-12
  • shutil,csv,ini

    序列化和反序列化笔记

    2017-10-29
  • PXE网络引导系统自动化安装CentOS7

     一.PXE 注意:安装前 selinux 禁用,iptables 关闭 dhcp 服务器静态IP地址  1.PXE的工作原理:      Client向PXE Server上的DHCP发送IP地址请求消息,DHCP检测Client是否合法(主要是检测Client的网卡MAC  &nbsp…

    Linux干货 2017-07-24
  • 软链接和硬链接的区别

    软链接和硬链接的区别 什么是链接: 文件都是文件名和数据组成的,在linux中被分成两部分:数据和元数据。数据是记录文件的真实内容的地方;元数据是记录文件属性的地方:创建者、大小、创建时间等信息。元数据中的inode号这是唯一标识文件身份的属性。在linux中,文件的inode号可以通过ls –i命令查看。在linux中为了解决文件共享使用,引入了两种链接:…

    Linux干货 2016-10-20
  • linux运维

    linux运维大纲,学习路线图

    Linux干货 2017-10-21
  • Linux正则表达式及grep练习题

    Linux正则表达式及grep练习题          1、找出ifconfig命令结果中本机的所有IPv4地址         # ifconfig|grep -E -o "(([0-9]…

    Linux干货 2016-08-07