当前位置:网站首页>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
边栏推荐
- 用Redis实现分布式锁
- Flink学习笔记(十)Flink容错机制
- Spark structured stream writing Hudi practice
- Jestson nano custom root file system creation (supports the smallest root file system of NVIDIA Graphics Library)
- NPM install installation dependency package error reporting solution
- Jestson Nano自定义根文件系统创建(支持NVIDIA图形库的最小根文件系统)
- [graduation season | advanced technology Er] another graduation season, I change my career as soon as I graduate, from animal science to programmer. Programmers have something to say in 10 years
- Overview of database system
- [kotlin learning] control flow of higher-order functions -- lambda return statements and anonymous functions
- Navicat, MySQL export Er graph, er graph
猜你喜欢
Flink学习笔记(九)状态编程
Flask+supervisor installation realizes background process resident
【Kotlin学习】运算符重载及其他约定——重载算术运算符、比较运算符、集合与区间的约定
[kotlin learning] classes, objects and interfaces - define class inheritance structure
Apply for domain name binding IP to open port 80 record
Vscode Arduino installation Library
Hudi learning notes (III) analysis of core concepts
Flink-CDC实践(含实操步骤与截图)
Principles of computer composition - cache, connection mapping, learning experience
Spark 概述
随机推荐
Temper cattle ranking problem
Nodemcu-esp8266 development (vscode+platformio+arduino framework): Part 1 -- establishment of engineering template -template
Jenkins learning (II) -- setting up Chinese
Matlab dichotomy to find the optimal solution
PolyWorks script development learning notes (III) -treeview advanced operation
LeetCode每日一题(985. Sum of Even Numbers After Queries)
PolyWorks script development learning notes (4) - data import and alignment using file import
[point cloud processing paper crazy reading frontier version 11] - unsupervised point cloud pre training via occlusion completion
Win10安装ELK
Hudi 快速体验使用(含操作详细步骤及截图)
Hudi learning notes (III) analysis of core concepts
unbuntu(debian)下TFTP服务器搭建及测试
Run flash demo on ECS
IDEA 中使用 Hudi
LeetCode每日一题(2115. Find All Possible Recipes from Given Supplies)
Solve POM in idea Comment top line problem in XML file
Integrated use of interlij idea and sonarqube
[graduation season | advanced technology Er] another graduation season, I change my career as soon as I graduate, from animal science to programmer. Programmers have something to say in 10 years
Utilisation de hudi dans idea
Flask+supervisor installation realizes background process resident