码迷,mamicode.com
首页 > 系统相关 > 详细

一. Linux 常用命令总结

时间:2016-10-27 01:19:16      阅读:305      评论:0      收藏:0      [点我收藏+]

标签:sock   move   sort   about   hmm   命令   目录   clock   命令总结   

1. linux 基础命令

who, which, basename, dirname, echo, type, hash, whatis, makewhatis, man, info, help, ls, cd,pwd, mkdir, rmdir, touch, rm, date, hwcolck, cal, shutdown, reboot, tty

1 who : Show who is logged on, print information about users who are currently logged in. 

  显示登录的用户。

2 which : Show the full path of (shell) commands

  which pwd, which shutdown

3 basename : Print name with any leading directory components removed.

  basename /usr/bin/sort , Output: sort

4 dirname : strip non-directory suffix from file name

  dirname /usr/bin/sort , Output: /usr/bin

5 命令替换

  ‘ ’ :强引用,变量不会替换;

  “ ” :若引用,变量可以替换;

  ` ` :命令应用,类似$()

6 echo : display a line of text , 回显

  echo $PATH , Output: /usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

  echo ‘$PATH‘ , Output: $PATH

  echo "zhu biao" , Output: zhu biao

  echo `date +%F`(echo $(date +%F)) , Output: 2016-10-26

7 type : Display information about command type

  type cd , Output: cd is a shell builtin

  type shutdown , Output: shutdown is /sbin/shutdown, 若shutdown已经执行过,将会添加到hash数据库,则:shutdown is hashed (/sbin/shutdown)

8 hash : Rember or display program loacations, 显示hash数据库,执行过的程序次数、位置。

9 whatis : 简洁描述某个命令的功能,该命令在manual文档中的章节

  whatis shutdown , Output:

            shutdown    (2)  - shut down part of a full-duplex connection
            shutdown    (3p)  - shut down socket send and receive operations
            shutdown    (8)  - bring the system down

10 makewhatis : Create the whatis datebase

11 shell command 分为内部命令和外部命令

  内部命令帮助:help command

  外部命令帮助:command --help, man command, info command

12 man : man [section] command , manual , 命令,配置文件格式,库调用等帮助文档

  [section]:

  1: User Commands
     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 Administrations tools and Deamons

13 info : 获取在线帮助文档,使用方法类似man

14 help : shell内部命令帮助文档

  help ls

15 {a,b} : 可展开

  {a,b}/{x,y} : a/x a/y b/x b/y

  {a,b}-heburn-{x,y} : a-heburn-x a-heburn-y b-heburn-x b-heburn-y

16 ls : list directory contents

  ls /home/zhubiao

17 cd : change the shell working directory

  cd /home/zhubiao

  cd ~ : 回到用户家目录

  cd ~zhubiao : 回到用户zhubiao家目录

  cd - : 回到上一个目录

18 pwd : Print working directory

19 mkdir : make directories

  Create directories /mnt/linux/bin, /mnt/linux/sbin, /mnt/bin, /mnt/sbin 可用如下命令:

  mkdir -pv /mnt{/linux/{bin/sbin},bin,sbin}

20 rmdir : remove empty diretories

  rmdir /mnt

  rmdir -p /a/b

21 rm : remove files or directories

  rm -rf /a/b/zhubiao

22 touch : 创建文件

23 date : print or set the system date and time

  date [MMDDhhmm[[CC]YY][.ss] :

    date 10262318 设定系统时间为10月26日 23:18,

    date 102623182016.33 设定系统时间为 2016-10-26 23:18:33

    date +%F , Output: 2016-10-26

    date +%T , Output: 23:18:33

24 hwclock : query or set the hadway clock (RTC)

  hwclock --set --date="102616 23:12:10"

  hwclock -s(--hctosys)

  hwclock -w(--systohc)

25 cal : Display a calendar

  cal , Output:

          October 2016   
      Su Mo Tu We Th Fr Sa
                         1
       2  3  4  5  6  7  8
       9 10 11 12 13 14 15
      16 17 18 19 20 21 22
      23 24 25 26 27 28 29
      30 31

26 shutdown : bring the system down

  shutdown -h now

  shutdown -r +5

27 reboot : reboot, halt, poweroff - reboot or stop the system

28 ternial

  a.虚拟终端 tty#

  b.物理终端 console

  c.伪终端 pts/#

 

 

 

 

  

 

一. Linux 常用命令总结

标签:sock   move   sort   about   hmm   命令   目录   clock   命令总结   

原文地址:http://www.cnblogs.com/zhubiao/p/6002427.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!