linux常用命令
(一)ls(list directory contents)
-l :长格式显示(use a long listing format)
1. 文件类型(第1位)
b: 块设备文件(block)
c: 字符设备文件(character)
d: 目录文件(directory)
p: 命名管道文件(pipe)
l: 符号链接文件(symbolic link file)
s: 套接字文件(socket)
2. 文件权限(第2到10位)
3. 文件硬链接的次数
4. 文件的属主
5. 文件的属组
6. 文件大小(size)默认单位为字节
7. 文件的时间戳(timestamp)
访问时间(access)
修改时间(modify):改变文件的内容
改变时间(change):改变文件的属性
[wuhui@localhost ~]$ ls -l
total 0
drwxr-xr-x. 2 wuhui wuhui 6 Mar 5 21:45 Desktop
drwxr-xr-x. 2 wuhui wuhui 6 Mar 5 21:45 Documents
drwxr-xr-x. 2 wuhui wuhui 6 Mar 5 21:45 Downloads
drwxr-xr-x. 2 wuhui wuhui 6 Mar 5 21:45 Music
drwxrwxr-x. 2 wuhui wuhui 6 Mar 5 21:45 perl5
drwxr-xr-x. 2 wuhui wuhui 6 Mar 5 21:45 Pictures
drwxr-xr-x. 2 wuhui wuhui 6 Mar 5 21:45 Public
drwxr-xr-x. 2 wuhui wuhui 6 Mar 5 21:45 Templates
drwxr-xr-x. 2 wuhui wuhui 6 Mar 5 21:45 Videos
-h, --human-readable:以人容易懂的方式显示,主要做单位转换( with -l, print sizes in human readable format (e.g., 1K 234M 2G))
-a, --all: 显示所有文件,包括以.开头的隐藏文件(do not ignore entries starting with .)
-d, --directory: 显示目录自身属性(list directories themselves, not their contents)
-i, --inode:显示文件的索引节点号 (print the index number of each file)
· -r, --reverse:逆序显示文件(reverse order while sorting)
-R, --recursive:递归显示文件
(二)cd(Change the shell working directory.)
cd -: 在当前目录和前一目录之间切换
cd ~USERNAME: 进入指定用户的家目录,缺省状态下进入当前用户的家目录
(三)type(Display information about command type.)
命令类型:
内置命令(shell 内置)
外部命令(在文件系统的某个路径下有一个与命令名称相应的可执行文件)
(四)date( print or set the system date and time.)
linux主机上上存在两个时间,系统时间和硬件时间。我们可以通过date命令查看系统时间,clock命令查看硬件时间。硬件时间是指主板上BIOS的时间,一般是由主板上的纽扣电池供电维持的,系统在开机时读取这个时间,并根据它来设定系统时间。
hwclock -w: 将系统时间同步到硬件
hwclock -s: 将硬件时间同步到系统
(五)获取命令帮助
1) help
内部命令:help COMMAND 如:help cd
外部命令:COMMAND --help 如:ls --help
2) man (an interface to the on-line reference manuals)
man 手册一共分为8个章节
1. 用户命令(Executable programs or shell commands)
2. 系统调用(System calls (functions provided by the kernel))
3. 库调用(Library calls (functions within program libraries))
4. 特殊文件(Special files (usually found in /dev))
5. 文件格式(File formats and conventions eg /etc/passwd)
6. 游戏(Games)
7. 杂项(Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7))
8. 管理命令(System administration commands (usually only for root))
3) info(read Info documents)
(六)man(an interface to the on-line reference manuals)
特殊符号说明:
<>: 必选项
...: 可以重复多次
[]: 可选,可省
|: 多选一
{}: 分组
关键字说明:
NAME: 命令名称及功能简要
SYNOPSIS: 用法说明,包括可用的选项
DESCRIPTION:命令功能的详细说明,可能包括每一个选项的说明
OPTIONS:说明每一个选项的意义
FILES:此命令相关的配置文件
EXAMPLES:使用示例
SEE ALSO: 另外参照
使用说明:
翻页:
后翻:space
前翻:b
下一行:enter
上一行:k
查找:(默认不区分大小写)
/keyword: 从前向后
?keyword: 从后向前
n: 下一个
N: 前一个
q: 退出