/
:根目录,整个文件系统层次结构的根目录,所有内容都位于此目录下。/bin
:存放基本的可执行的程序 (二进制文件),包括最基本的命令,如ls和cp。/boot
:包含内核引导加载程序文件。/dev
:存放设备文件。/etc
:核心系统配置目录,应该只保存配置文件。/home
:用户的主目录,保存你的文档,文件,设置等。/lib
、/lib32
、/lib64
、/libx32
:主要目的是存放特定的库,这些库是在/bin和/sbin目录里的
1.ls列出目录的内容
[09:53:27root@localhost ~]# ls #查看当前目录下的所有文件(除隐藏文件)
anaconda-ks.cfg
[09:53:31root@localhost ~]# ls -a #查看隐藏文件
. .. anaconda-ks.cfg .bash_history .bash_logout .bash_profile .bashrc .cshrc .tcshrc .viminfo .vimrc
[09:53:33root@localhost ~]# ll #查看当前目录下的所有文件的详细信息(除隐藏文件),等同于ls -l
total 4
-rw-------. 1 root root 1479 Jan 4 16:02 anaconda-ks.cfg
[09:53:59root@localhost ~]# ls -lah #查看当前目录下的所有文件的详细信息和人性化查看大小
total 36K
dr-xr-x---. 2 root root 165 Jan 4 16:27 .
dr-xr-xr-x. 20 root root 279 Jan 4 16:24 ..
-rw-------. 1 root root 1.5K Jan 4 16:02 anaconda-ks.cfg
-rw-------. 1 root root 378 Jan 4 16:14 .bash_history
-rw-r--r--. 1 root root 18 Mar 15 2021 .bash_logout
-rw-r--r--. 1 root root 176 Mar 15 2021 .bash_profile
-rw-r--r--. 1 root root 262 Jan 4 16:05 .bashrc
-rw-r--r--. 1 root root 100 Mar 15 2021 .cshrc
-rw-r--r--. 1 root root 129 Mar 15 2021 .tcshrc
-rw------- 1 root root 1006 Jan 4 16:27 .viminfo
-rw-r--r--. 1 root root 902 Jan 4 16:06 .vimrc
2.cd 更改当前工作的目录 pwd在屏幕输出当前的工作目录
[09:57:57root@localhost ~]# cd /var/ #切换目录
[09:58:32root@localhost var]# pwd #打印当前目录
/var
3. touch 创建新的空文件
[10:08:50root@localhost ~]# ls
[10:08:52root@localhost ~]# touch ll
[10:08:59root@localhost ~]# ll
total 0
-rw-r--r-- 1 root root 0 Jan 7 10:08 ll
4.mkdir 创建新的目录
[10:09:41root@localhost ~]# mkdir mul
[10:09:58root@localhost ~]# ll
total 0
-rw-r--r-- 1 root root 0 Jan 7 10:08 ll
drwxr-xr-x 2 root root 6 Jan 7 10:09 mul
[10:09:59root@localhost ~]# cd mul/
[10:10:05root@localhost mul]# pwd
/root/mul
5.cp 复制文件或者目录
[10:10:49root@localhost ~]# cp ll mul/ll
[10:10:59root@localhost ~]# ll mul/
total 0
-rw-r--r-- 1 root root 0 Jan 7 10:10 ll
[10:11:06root@localhost ~]#
7.mv可以移动文件(类似以windowns的剪切)和更改文件的名字
[10:12:10root@localhost ~]# ls
ll mul
[10:12:14root@localhost ~]# mv ll wang #更改名
[10:12:19root@localhost ~]# ls
mul wang
[10:12:24root@localhost ~]# mv wang mul/ #移动文件
[10:12:31root@localhost ~]# ls
mul
8.rm 删除文件和目录
[10:13:46root@localhost mul]# ls
ll wang
[10:13:52root@localhost mul]# rm ll
rm: remove regular empty file 'll'? y
[10:14:01root@localhost mul]# ls
wang
[10:14:02root@localhost mul]# rm -f wang
[10:14:22root@localhost mul]# ls
[10:14:25root@localhost mul]#
-f 是强制删除
-r是递归删除
9.man和help
man rm #可以查看帮助文档
OPTIONS
Remove (unlink) the FILE(s).
-f, --force
ignore nonexistent files and arguments, never prompt
-i prompt before every removal
-I prompt once before removing more than three files, or when removing recursively; less intrusive than -i, while
still giving protection against most mistakes
help
[10:20:00root@localhost mul]# cd --help #可以以看cd的帮助
cd: cd [-L|[-P [-e]] [-@]] [dir]
Change the shell working directory.
Change the current directory to DIR. The default DIR is the value of the
HOME shell variable.
The variable CDPATH defines the search path for the directory containing
DIR. Alternative directory names in CDPATH are separated by a colon (:).
A null directory name is the same as the current directory. If DIR begins
with a slash (/), then CDPATH is not used.
If the directory is not found, and the shell option `cdable_vars' is set,
the word is assumed to be a variable name. If that variable has a value,
its value is used for DIR.
Options:
-L force symbolic links to be followed: resolve symbolic
links in DIR after processing instances of `..'
-P use the physical directory structure without following
symbolic links: resolve symbolic links in DIR before
processing instances of `..'
-e if the -P option is supplied, and the current working
directory cannot be determined successfully, exit with
a non-zero status
-@ on systems that support it, present a file with extended
attributes as a directory containing the file attributes
The default is to follow symbolic links, as if `-L' were specified.
`..' is processed by removing the immediately previous pathname component
back to a slash or the beginning of DIR.
Exit Status:
Returns 0 if the directory is changed, and if $PWD is set successfully when
-P is used; non-zero otherwise.
man手册页还有对应的内容区域,每个内容区域都分配了一个数字
1 可执行程序或shell命令
2 系统调用
3 库调用
4 特殊文件
5 文件格式与约定
6 游戏
7 概览、约定及杂项
8 超级用户和系统管理员命令
9 内核例程