ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Linux操作系统及常见命令

Linux操作系统及常见命令

原创 Linux操作系统 作者:puyan 时间:2020-09-26 12:14:19 0 删除 编辑

  ls:List information about the FILEs (the current directory by default).

  -l:use a long listing format

  [root@master1 ~]# ls -l

  total 104

  -rw-------. 1 root root  1557 Feb 19 19:09 anaconda-ks.cfg

  drwxr-xr-x. 2 root root  4096 Feb 20 07:50 Desktop

  文件类型:

  -:普通文件

  d:目录文件

  b:块设备文件

  c:字符设备文件

  l:符号链接文件(symbolic link file)

  p:管道文件(pipe)

  s:套接字文件(socket)

  文件权限:9位,每三位一组,分别为owner,group,others,rwx(读、写、执行),如果该位没有权限用-

  引用计数:文件被硬链接的次数

  文件属主:owner

  文件属组:group

  文件大小:默认单位为字节

  文件最近修改时间:最近访问时间、最近修改时间(修改文件内容)、最近改变时间(改变文件属性)

  文件名:

  -h, --human-readable

  with -l, print sizes in human readable format (e.g., 1K 234M 2G)

  -a, --all

  do not ignore entries starting with .

  linux中以.号开头的文件为隐藏文件

  -A, --almost-all

  do not list implied . and ..

  .表示当前目录;

  ..表示当前目录的父目录;

  -d, --directory

  list directory entries instead of contents, and do not dereference symbolic links

  显示目录自身的属性,而非目录下所有文件的属性

  -i, --inode

  print the index number of each file

  -r, --reverse

  reverse order while sorting

  -R, --recursive

  list subdirectories recursively

  -S     sort by file size

  -t     sort by modification time

  -X     sort alphabetically by entry extension

  cd:Change the shell working directory.

  -L    force symbolic links to be followed

  -P    use the physical directory structure without following symbolic links

  The default is to follow symbolic links, as if `-L' were specified.

  cd:切换到当前用户的家目录($HOME)

  cd ~:切换到当前用户的家目录

  cd ~USER:切换到USER用户的家目录(仅限root用户)

  cd -:在当前目录和上一个目录间来回切换

  pwd:Print the name of the current working directory.

  Options:

  -L    print the value of $PWD if it names the current working directory

  -P    print the physical directory, without any symbolic links

  By default, `pwd' behaves as if `-L' were specified.

  type:Display information about command type.

  shell内置命令:shell builtin

  外部命令:文件系统中有与命令同名的二进制可执行程序或者脚本

  环境变量:命名的内存空间

  $PATH

  env:env - run a program in a modified environment

  printenv:printenv - print all or part of environment

  hash:Remember or display program locations. 搜索时间:o(1)

  -d        forget the remembered location of each NAME

  date:date - print or set the system date and time

  晶体振荡器,由主板上的纽扣电池供电

  rtc:real time clock

  ntp:network time protocol

  硬件时钟:clock、hwclock

  系统时钟:date

  linux开机启动后通过rtc读取硬件时钟到系统时钟,此后由内核负责维护系统时钟,当CPU任务繁忙时,系统时钟与硬件时钟会出现不同步的情况

  date [OPTION]... [+FORMAT]

  date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]

  hwclock - query and set the hardware clock (RTC)

  -s, --hctosys

  Set the System Time from the Hardware Clock.

  -w, --systohc

  Set the Hardware Clock to the current System Time.

  cal - displays a calendar

  如何获取命令的使用帮助?

  Linux命令分为内置命令和外部命令

  内置命令:

  #help COMMAND

  外部命令:

  # COMMAND --help

  # man COMMAND

  # info COMMAND

  文档:/usr/share/doc/***

  应用软件的官方文档

  google、baidu

  man:

  The standard sections of the manual include:

  1      User Commands(/bin:/usr/bin:/usr/local/bin)

  2      System Calls

  3      C Library Functions

  4      Devices and Special Files

  5      File Formats and Conventions

  6      Games et. Al.

  7      Miscellanea

  8      System Administration tools and Deamons(/sbin:/usr/sbin:/usr/local/sbin)

  <>:必选

  []:可选

  ...:可以出现多次

  |:多选一

  {}:分组

  NAME:命令名称及功能简要说明

  SYNOPSIS:用法说明,包括可用的选项

  DESCRIPTION:命令功能的详细说明,包括选项的意义

  OPTIONS:选项的意义

  FILES:与命令相关的文件

  EXAMPLES:样例

  SEE ALSO:另见

  翻屏:

  向后翻一屏:space

  向前翻一屏:b

  向后翻一行:enter

  向前翻一行:k

  查找:

  /KEYWORD:向后查找

  n:下一个

  N:上一个

  ?KEYWORD:向前查找

  n:下一个

  N:上一个

  退出:

  q

  通过whatis可以查看命令出现在哪些章节

  which

  whereis

  whatis

  apropos

  练习:

  1、echo是内部命令还是外部命令?

  type echo

  2、作用?

  echo: echo [-neE] [arg ...]

  Write arguments to the standard output.

  3、如何换行显示?

  -n    do not append a newline

  -e    enable interpretation of the following backslash escapes

  -E    explicitly suppress interpretation of backslash escapes

  `echo' interprets the following backslash-escaped characters:

  \b    backspace

  \e    escape character

  \n    new line

  \t    horizontal tab

  \v    vertical tab

  \\    backslash

  \0nnn    the character whose ASCII code is NNN (octal).  NNN can be 0 to 3 octal digits

  \xHH    the eight-bit character whose value is HH (hexadecimal).  HH can be one or two hex digits

  1、printf是内部命令还是外部命令?

  type printf

  2、作用?

  printf - format and print data

  printf FORMAT [ARGUMENT]...

  printf OPTION

  3、如何换行显示?

  \n     new line

  1、file命令及其用法

  file - determine file type


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69920922/viewspace-2724308/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2020-09-24

  • 博文量
    11
  • 访问量
    16320