1. su - 切换root身份
2. ls -al 查看所有文件详细的权限和指令
root@shun-Inspiron-7472:~# ls -al
总用量 40
drwx------ 7 root root 4096 12月 5 19:15 .
drwxr-xr-x 23 root root 4096 12月 5 19:23 ..
-rw------- 1 root root 104 12月 5 19:15 .bash_history
-rw-r--r-- 1 root root 3106 8月 7 06:35 .bashrc
drwx------ 4 root root 4096 12月 5 19:13 .cache
drwx------ 6 root root 4096 12月 5 19:13 .config
drwx------ 3 root root 4096 12月 5 19:13 .dbus
drwx------ 2 root root 4096 12月 5 19:13 .gvfs
drwxr-xr-x 3 root root 4096 12月 5 19:13 .local
-rw-r--r-- 1 root root 148 8月 7 06:35 .profile
root@shun-Inspiron-7472:~#
3. ls --help 或man ls 或info ls 查询ls的详细用法
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
必选参数对长短选项同时适用。
-a, --all 不隐藏任何以. 开始的项目
-A, --almost-all 列出除. 及.. 以外的任何项目
--author 与-l 同时使用时列出每个文件的作者
-b, --escape 以八进制溢出序列表示不可打印的字符
--block-size=SIZE scale sizes by SIZE before printing them; e.g.,
'--block-size=M' prints sizes in units of
1,048,576 bytes; see SIZE format below
-B, --ignore-backups do not list implied entries ending with ~
-c with -lt: sort by, and show, ctime (time of last
modification of file status information);
with -l: show ctime and sort by name;
otherwise: sort by ctime, newest first
-C list entries by columns
--color[=WHEN] colorize the output; WHEN can be 'always' (default
if omitted), 'auto', or 'never'; more info below
-d, --directory list directories themselves, not their contents
-D, --dired generate output designed for Emacs' dired mode
-f do not sort, enable -aU, disable -ls --color
-F, --classify append indicator (one of */=>@|) to entries
--file-type likewise, except do not append '*'
--format=WORD across -x, commas -m, horizontal -x, long -l,
single-column -1, verbose -l, vertical -C
--full-time like -l --time-style=full-iso
-g 类似-l,但不列出所有者
--group-directories-first
group directories before files;
can be augmented with a --sort option, but any
use of --sort=none (-U) disables grouping
-G, --no-group in a long listing, don't print group names
-h, --human-readable with -l and/or -s, print human readable sizes
(e.g., 1K 234M 2G)
--si likewise, but use powers of 1000 not 1024
-H, --dereference-command-line
follow symbolic links listed on the command line
--dereference-command-line-symlink-to-dir
follow each command line symbolic link
that points to a directory
--hide=PATTERN do not list implied entries matching shell PATTERN
(overridden by -a or -A)
--hyperlink[=WHEN] hyperlink file names; WHEN can be 'always'
(default if omitted), 'auto', or 'never'
--indicator-style=WORD append indicator with style WORD to entry names:
none (default), slash (-p),
file-type (--file-type), classify (-F)
-i, --inode print the index number of each file
-I, --ignore=PATTERN do not list implied entries matching shell PATTERN
-k, --kibibytes default to 1024-byte blocks for disk usage
-l 使用较长格式列出信息
-L, --dereference 当显示符号链接的文件信息时,显示符号链接所指示
的对象而并非符号链接本身的信息
-m 所有项目以逗号分隔,并填满整行行宽
-n, --numeric-uid-gid like -l, but list numeric user and group IDs
-N, --literal print entry names without quoting
-o like -l, but do not list group information
-p, --indicator-style=slash
append / indicator to directories
-q, --hide-control-chars print ? instead of nongraphic characters
--show-control-chars show nongraphic characters as-is (the default,
unless program is 'ls' and output is a terminal)
-Q, --quote-name enclose entry names in double quotes
--quoting-style=WORD use quoting style WORD for entry names:
literal, locale, shell, shell-always,
shell-escape, shell-escape-always, c, escape
-r, --reverse 逆序排列
-R, --recursive 递归显示子目录
-s, --size 以块数形式显示每个文件分配的尺寸
-S sort by file size, largest first
--sort=WORD sort by WORD instead of name: none (-U), size (-S),
time (-t), version (-v), extension (-X)
--time=WORD with -l, show time as WORD instead of default
modification time: atime or access or use (-u);
ctime or status (-c); also use specified time
as sort key if --sort=time (newest first)
--time-style=STYLE with -l, show times using style STYLE:
full-iso, long-iso, iso, locale, or +FORMAT;
FORMAT is interpreted like in 'date'; if FORMAT
is FORMAT1FORMAT2, then FORMAT1 applies
to non-recent files and FORMAT2 to recent files;
if STYLE is prefixed with 'posix-', STYLE
takes effect only outside the POSIX locale
-t sort by modification time, newest first
-T, --tabsize=COLS assume tab stops at each COLS instead of 8
-u with -lt: sort by, and show, access time;
with -l: show access time and sort by name;
otherwise: sort by access time, newest first
-U do not sort; list entries in directory order
-v natural sort of (version) numbers within text
-w, --width=COLS set output width to COLS. 0 means no limit
-x list entries by lines instead of by columns
-X sort alphabetically by entry extension
-Z, --context print any security context of each file
-1 list one file per line. Avoid '\n' with -q or -b
--help 显示此帮助信息并退出
--version 显示版本信息并退出
The SIZE argument is an integer and optional unit (example: 10K is 10*1024).
Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000).
使用色彩来区分文件类型的功能已被禁用,默认设置和 --color=never 同时禁用了它。
使用 --color=auto 选项,ls 只在标准输出被连至终端时才生成颜色代码。
LS_COLORS 环境变量可改变此设置,可使用 dircolors 命令来设置。
退出状态:
0 正常
1 一般问题 (例如:无法访问子文件夹)
2 严重问题 (例如:无法使用命令行参数)
GNU coreutils online help:
请向 报告ls 的翻译错误
Full documentation at:
or available locally via: info '(coreutils) ls invocation'
root@shun-Inspiron-7472:~#
4. 改变文件属性
5. 创建空的目录和文件
[root@study ~]# cd /tmp <==切换工作目录到/tmp
[root@study tmp]# mkdir testing <==创建新目录
[root@study tmp]# chmod 744 testing <==变更权限
[root@study tmp]# touch testing/testing <==创建空的文件
[root@study tmp]# chmod 600 testing/testing <==变更权限
[root@study tmp]# ls -ald testing testing/testing
drwxr--r--. 2 root root 20 Jun 3 01:00 testing
-rw-------. 1 root root 0 Jun 3 01:00 testing/testing
cd:变换目录
pwd:显示当前目录
rmdir:删除一个空的目录
mkdir -p 可创建多层目录
-m 可直接设置目录权限
mkdir+目录名 创建新目录
touch +目录+文件名 创建新的文件夹
6. 文件名称
文件名称的开头为小数点“.”时, 代表这文件名称的开头为小数点“.”时, 代表这
个文件为“隐藏文件”
? > < ; & ! [ ] | \ ’ " ` ( ) { }±最好避免
7. 三层目录
/ (root, 根目录):与开机系统有关;
/usr (unix software resource):与软件安装/执行有关;
/var (variable):与系统运行过程有关。