Linux 命令行基础
Posted lonelywmw
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux 命令行基础相关的知识,希望对你有一定的参考价值。
You can also open the terminal by pressing CTRL + ALT + T on your keyboard.
- $whoami
- username
- 命令行内的复制粘贴
- Ctrl+Shift+C or V
- 制表符补全
- 按 Tab
- 例如~/Documents/Odin-Project/Web-Development-101/javascript/calculator/ 可以这样操作:cd Doc[tab]O[tab]W[tab]j[tab]cal[tab]
- 进入项目目录并键入 code . 打开所有项目文件
- Home Directory (~)
- Present Working Directory (pwd)
- List Files and Directories (ls)
$ ls
$ ls /usr/local/
Listing a Different Directory$ ls -a
Listing All Files (-a), Using the -a flag we can see both “visible” and “hidden” files and directories.$ ls -l
Long Form Listing (-l)$ ls -lh
Human Readable Sizes (-h)$ ls -lhS
Sorting by Size (-S), default: sorting by name$ ls -lt
Sorting by Last Modified Time (-t)$ ls -lr
Reverse Sort (-r)
- Link
$ ln a.txt b.txt
creating a hard link$ ln -s a.txt b.txt
created a symbolic link
- Change Directories (cd)
$ cd ~/Documents
$ cd ..
Navigating Up (..)$ cd
Navigating to the Home Directory
- Creating Directories (mkdir)
$ mkdir foo
$ mkdir -p a/b/c
Create Intermediate Directories (-p)$ mkdir -v a
Verbose Output (-v)
- Copying Files (cp)
$ cp a.txt b.txt
Copying a Single File, 1: source, 2: file copy$ cp a.txt b.txt foo
Copying Multiple Files
front: source files, end: directory$ cp -v a.txt b.txt
a.txt -> b.txt$ cp -Rv foo bar
Copying Directories (-R)$ cp -f a.txt b.txt
Force Overwriting of a File (-f)$ cp -i a.txt b.txt
Confirm Overwriting of a File (-i)overwrite b.txt? (y/n [n])
- Deleting Files (rm)
$ rm -v a.txt
uses the -v flag to list files that were deleted using the rm command.
- Moving Files (mv)
$ mv -v a.txt b.txt
==
$ cp a.txt b.txt
$ rm a.txt
详见:Conquering the Command Line Chapter 1
以上是关于Linux 命令行基础的主要内容,如果未能解决你的问题,请参考以下文章