当前位置:网站首页>Directory and switching operation in file system
Directory and switching operation in file system
2022-07-03 09:32:00 【Technology stuff】
cd
cd
,change directory, Switch current working directory .
In addition to the specified directory , There are also the following special directories .
.
: Current working directory ...
: Parent working directory ./
: root directory .~
: home Catalog , The current user directory , You can also use environment variables$HOME
Express . Assume that the current user is shanyue, be ~ The catalogue is/Users/shanyue
(mac System ).
in addition ,cd -
To enter the last working directory , Like git checout -
Switch back to the last branch .
$ cd ~
$ cd -
$ cd $HOME
except cd
Outside , There is a small tool with powerful function to switch directories autojump.
autojump
Manual download is required .
# Switch to include foo A directory of substrings
$ j foo
Q: You know, autojump How it works , You can write a
autojump
Command line gadgets ?
pwd
pwd
,print working directory, Print current working directory .
# Print current path , The directory is react Source content
$ pwd
/Users/shanyue/Documents/react
ls
ls
, List the contents of a working directory .
ls
A single instruction will not be listed with .
Opening file , such as .git
、 .babelrc
、.eslintrc
Will not display by default . While using -a
, All documents will be listed .
In daily work , Regular use ls -lah
List the contents of the working directory .
# -l: Use long list format
# -a: List all files , Include . Opening file
# -h: Represent the file volume in readable form , such as 100M
$ ls -lah
total 2176
drwxr-xr-x 36 shanyue shanyue 1.1K 6 10 15:45 .
[email protected] 242 shanyue shanyue 7.6K 5 29 09:37 ..
drwxr-xr-x 3 shanyue shanyue 96B 6 10 15:45 .circleci
drwxr-xr-x 3 shanyue shanyue 96B 6 10 15:45 .codesandbox
-rw-r--r-- 1 shanyue shanyue 294B 5 22 2021 .editorconfig
-rw-r--r-- 1 shanyue shanyue 759B 6 10 15:45 .eslintignore
-rw-r--r-- 1 shanyue shanyue 8.4K 6 10 15:45 .eslintrc.js
drwxr-xr-x 14 shanyue shanyue 448B 6 10 15:45 .git
-rw-r--r-- 1 shanyue shanyue 12B 5 22 2021 .gitattributes
drwxr-xr-x 6 shanyue shanyue 192B 9 8 2021 .github
-rw-r--r-- 1 shanyue shanyue 881B 6 10 15:45 .gitignore
-rw-r--r-- 1 shanyue shanyue 7.6K 5 22 2021 .mailmap
-rw-r--r-- 1 shanyue shanyue 9B 6 10 15:45 .nvmrc
-rw-r--r-- 1 shanyue shanyue 546B 6 10 15:45 .prettierignore
-rw-r--r-- 1 shanyue shanyue 363B 5 22 2021 .prettierrc.js
-rw-r--r-- 1 shanyue shanyue 3B 5 22 2021 .watchmanconfig
-rw-r--r-- 1 shanyue shanyue 42K 5 22 2021 AUTHORS
-rw-r--r-- 1 shanyue shanyue 198K 6 10 15:45 CHANGELOG.md
-rw-r--r-- 1 shanyue shanyue 3.5K 5 22 2021 CODE_OF_CONDUCT.md
-rw-r--r-- 1 shanyue shanyue 216B 5 22 2021 CONTRIBUTING.md
-rw-r--r-- 1 shanyue shanyue 1.1K 5 22 2021 LICENSE
-rw-r--r-- 1 shanyue shanyue 5.1K 6 10 15:45 README.md
-rw-r--r-- 1 shanyue shanyue 1.5K 6 10 15:45 ReactVersions.js
-rw-r--r-- 1 shanyue shanyue 400B 5 22 2021 SECURITY.md
-rw-r--r-- 1 shanyue shanyue 671B 9 2 2021 appveyor.yml
-rw-r--r-- 1 shanyue shanyue 1.0K 5 22 2021 babel.config.js
drwxr-xr-x 6 shanyue shanyue 192B 9 4 2021 build
drwxr-xr-x 2 shanyue shanyue 64B 9 4 2021 build2
-rw-r--r-- 1 shanyue shanyue 7.5K 6 10 15:45 dangerfile.js
drwxr-xr-x 23 shanyue shanyue 736B 6 10 15:45 fixtures
-rw-r--r-- 1 shanyue shanyue 220B 5 22 2021 netlify.toml
drwxr-xr-x 1426 shanyue shanyue 45K 9 2 2021 node_modules
-rw-r--r-- 1 shanyue shanyue 7.2K 6 10 15:45 package.json
drwxr-xr-x 39 shanyue shanyue 1.2K 6 10 15:45 packages
drwxr-xr-x 22 shanyue shanyue 704B 9 2 2021 scripts
-rw-r--r-- 1 shanyue shanyue 733K 6 10 15:45 yarn.lock
That's in ls
What information does each line represent ? In the next section .
Q: How to configure colors to distinguish directories and files , See the screenshot below .
exa
One ls
substitute , Have more friendly colors and richer output , At the same time, more options are supported .
# Support the view git situation
$ exa -lah --git
tree
tree
, List the files in a tree view .
This command needs to be downloaded manually .
# macos
$ brew install tree
# centos
$ yum install tree
It can be done by -L
Specify the hierarchy , The following instructions can be used for normal work .
# -a: List all files
# -F: Add... To the end of the directory /, Add... To the end of the executable *
# -L: Specify the hierarchy
$ tree packages/react-dom -aF -L 2
packages/react-dom
|-- README.md
|-- client.js
|-- index.classic.fb.js
|-- index.experimental.js
|-- index.js
|-- index.modern.fb.js
|-- index.stable.js
|-- npm/
| |-- client.js
| |-- index.js
| |-- profiling.js
| |-- server.browser.js
| |-- server.js
| |-- server.node.js
| |-- test-utils.js
| `-- unstable_testing.js
|-- package.json
|-- server.browser.js
|-- server.js
|-- server.node.js
|-- src/
| |-- __tests__/
| |-- client/
| |-- events/
| |-- server/
| |-- shared/
| `-- test-utils/
|-- test-utils.js
|-- unstable_testing.classic.fb.js
|-- unstable_testing.experimental.js
|-- unstable_testing.js
|-- unstable_testing.modern.fb.js
`-- unstable_testing.stable.js
8 directories, 25 files
meanwhile , You can also use more advanced exa -T
Print tree file .
# -T: --tree, List the files in a tree view
# -L: --level, Specify the hierarchy
$ exa -lah -T -L 2 packages/react-dom
边栏推荐
- Construction and test of TFTP server under unbuntu (Debian)
- Flink学习笔记(十)Flink容错机制
- [point cloud processing paper crazy reading cutting-edge version 12] - adaptive graph revolution for point cloud analysis
- Powerdesign reverse wizard such as SQL and generates name and comment
- Serializer rewrite: update and create methods
- Arduino handles JSON data, arduinojson assistant
- Logstash+jdbc data synchronization +head display problems
- [kotlin learning] classes, objects and interfaces - define class inheritance structure
- LeetCode每日一题(985. Sum of Even Numbers After Queries)
- LeetCode每日一题(2212. Maximum Points in an Archery Competition)
猜你喜欢
Idea uses the MVN command to package and report an error, which is not available
There is no open in default browser option in the right click of the vscade editor
软件测试工程师是做什么的 通过技术测试软件程序中是否有漏洞
PolyWorks script development learning notes (I) - script development environment
一款开源的Markdown转富文本编辑器的实现原理剖析
[point cloud processing paper crazy reading frontier edition 13] - gapnet: graph attention based point neural network for exploring local feature
【点云处理之论文狂读前沿版11】—— Unsupervised Point Cloud Pre-training via Occlusion Completion
Spark 结构化流写入Hudi 实践
Just graduate student reading thesis
Hudi quick experience (including detailed operation steps and screenshots)
随机推荐
Logstash+jdbc data synchronization +head display problems
Detailed steps of windows installation redis
C language programming specification
Hudi learning notes (III) analysis of core concepts
Banner - Summary of closed group meeting
Go language - IO project
Flink-CDC实践(含实操步骤与截图)
Jenkins learning (I) -- Jenkins installation
Go language - Reflection
LeetCode每日一题(1300. Sum of Mutated Array Closest to Target)
【Kotlin学习】高阶函数的控制流——lambda的返回语句和匿名函数
Hudi quick experience (including detailed operation steps and screenshots)
[point cloud processing paper crazy reading frontier edition 13] - gapnet: graph attention based point neural network for exploring local feature
Go language - JSON processing
Apply for domain name binding IP to open port 80 record
Crawler career from scratch (3): crawl the photos of my little sister ③ (the website has been disabled)
制作jetson nano最基本的根文件系统、服务器挂载NFS文件系统
IDEA 中使用 Hudi
2022-2-13 learning xiangniuke project - version control
Spark 结构化流写入Hudi 实践