Linux
基础知识
01搭建Centos7系统
02软件管理仓库
03Shell
04查看帮助命令
05系统工作命令
06系统状态检测命令
07工作目录切换命令
08文本文件编辑命令
09文件目录管理
10打包压缩与搜索命令
11输入输出重定向
12管道符与通配符
13Vim编辑器
14Shell脚本
15shell流程控制语句
16用户管理操作
17文件权限与归属
18文件隐藏属性
19文件访问控制列表
20su与sudo
21存储结构
22物理设备命名规则
23文件系统
24挂载硬件设备
25虚拟机添加硬盘设备
26系统中操作添加硬盘设备
27添加交换分区
28磁盘容器配额
29软硬方式链接
30RAID
31LVM
32程序安装与管理
33计划任务
34日志文件分析
35测试网络联通性
36FTP服务
37操作系统基本符号
38操作系统三剑客
39shell基础
40shell语法
41DNS
42Apache概述
43Nginx概述
44集群概述
Vmware安装Ubuntu
更换源
-
+
首页
07工作目录切换命令
# 工作目录切换命令 ## pwd pwd 命令用于显示用户当前所处的工作目录,格式为“pwd [选项]”。 ```linux [test@bogon ~]$ pwd /home/test [test@bogon ~]$ ``` ## cd cd 命令用于切换工作路径,格式为“cd [目录名称]”。 可以通过 cd 命令迅速、灵活地切换到不同的工作目录。 除了常见的切换目录方式,还可以使用“cd -”命令返回到上一次所处的目录,使用“cd..”命令进入上级目录,以及使用“cd ~”命令切换到当前用户的家目录,亦或使用“cd ~username”切换到其他用户的家目录。 ```linux [test@bogon ~]$ pwd /home/test [test@bogon ~]$ cd ./test/ [test@bogon test]$ pwd /home/test/test [test@bogon test]$ cd .. [test@bogon ~]$ cd . [test@bogon ~]$ pwd /home/test [test@bogon ~]$ cd /etc/ [test@bogon etc]$ pwd /etc [test@bogon etc]$ cd - /home/test [test@bogon ~]$ pwd /home/test [test@bogon ~]$ ``` ## ls ls 命令用于显示目录中的文件信息,格式为“ls [选项] [文件] ”。 所处的工作目录不同,当前工作目录下的文件肯定也不同。使用 ls 命令的“-a”参数看到全部文件(包括隐藏文件),使用“-l”参数可以查看文件的属性、大小等详细信息。 这两个参数整合之后,再执行 ls 命令即可查看当前目录中的所有文件并输出这些文件的属性信息。 ```linux [test@bogon ~]$ ls test 公共 模板 视频 图片 文档 下载 音乐 桌面 [test@bogon ~]$ ls -l 总用量 0 drwxrwxr-x. 2 test test 6 12月 28 22:41 test drwxr-xr-x. 2 test test 6 12月 27 22:48 公共 drwxr-xr-x. 2 test test 6 12月 27 22:48 模板 drwxr-xr-x. 2 test test 6 12月 27 22:48 视频 drwxr-xr-x. 2 test test 6 12月 27 22:48 图片 drwxr-xr-x. 2 test test 6 12月 27 22:48 文档 drwxr-xr-x. 2 test test 6 12月 27 22:48 下载 drwxr-xr-x. 2 test test 6 12月 27 22:48 音乐 drwxr-xr-x. 2 test test 6 12月 27 22:48 桌面 [test@bogon ~]$ [test@bogon ~]$ ll 总用量 0 drwxrwxr-x. 2 test test 6 12月 28 22:41 test drwxr-xr-x. 2 test test 6 12月 27 22:48 公共 drwxr-xr-x. 2 test test 6 12月 27 22:48 模板 drwxr-xr-x. 2 test test 6 12月 27 22:48 视频 drwxr-xr-x. 2 test test 6 12月 27 22:48 图片 drwxr-xr-x. 2 test test 6 12月 27 22:48 文档 drwxr-xr-x. 2 test test 6 12月 27 22:48 下载 drwxr-xr-x. 2 test test 6 12月 27 22:48 音乐 drwxr-xr-x. 2 test test 6 12月 27 22:48 桌面 [test@bogon ~]$ ll -a 总用量 32 drwx------. 16 test test 4096 12月 28 22:41 . drwxr-xr-x. 3 root root 18 12月 27 22:48 .. -rw-------. 1 test test 347 12月 27 23:38 .bash_history -rw-r--r--. 1 test test 18 4月 11 2018 .bash_logout -rw-r--r--. 1 test test 193 4月 11 2018 .bash_profile -rw-r--r--. 1 test test 231 4月 11 2018 .bashrc drwx------. 13 test test 275 12月 27 22:48 .cache drwxr-xr-x. 14 test test 261 12月 27 22:48 .config drwx------. 3 test test 25 12月 27 22:48 .dbus -rw-------. 1 test test 16 12月 27 22:48 .esd_auth -rw-------. 1 test test 624 12月 28 22:22 .ICEauthority drwx------. 3 test test 19 12月 27 22:48 .local drwxr-xr-x. 4 test test 39 12月 27 21:49 .mozilla drwxrwxr-x. 2 test test 6 12月 28 22:41 test -rw-------. 1 test test 51 12月 28 22:24 .Xauthority drwxr-xr-x. 2 test test 6 12月 27 22:48 公共 drwxr-xr-x. 2 test test 6 12月 27 22:48 模板 drwxr-xr-x. 2 test test 6 12月 27 22:48 视频 drwxr-xr-x. 2 test test 6 12月 27 22:48 图片 drwxr-xr-x. 2 test test 6 12月 27 22:48 文档 drwxr-xr-x. 2 test test 6 12月 27 22:48 下载 drwxr-xr-x. 2 test test 6 12月 27 22:48 音乐 drwxr-xr-x. 2 test test 6 12月 27 22:48 桌面 ``` 如果想要查看目录属性信息,则需要额外添加一个-d 参数。 ```linux [test@bogon ~]$ ll -d /etc/ drwxr-xr-x. 134 root root 8192 12月 28 22:22 /etc/ [test@bogon ~]$ ll -d ./test/ drwxrwxr-x. 2 test test 6 12月 28 22:41 ./test/ [test@bogon ~]$ ```
毛林
2025年9月12日 20:43
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
Markdown文件
PDF文档(打印)
分享
链接
类型
密码
更新密码