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 -aListing All Files (-a), Using the -a flag we can see both “visible” and “hidden” files and directories.
    • $ ls -lLong Form Listing (-l)
    • $ ls -lhHuman Readable Sizes (-h)
    • $ ls -lhSSorting by Size (-S), default: sorting by name
    • $ ls -ltSorting by Last Modified Time (-t)
    • $ ls -lrReverse Sort (-r)
  • Link
    • $ ln a.txt b.txtcreating a hard link
    • $ ln -s a.txt b.txt created a symbolic link
  • Change Directories (cd)
    • $ cd ~/Documents
    • $ cd ..Navigating Up (..)
    • $ cdNavigating to the Home Directory
  • Creating Directories (mkdir)
    • $ mkdir foo
    • $ mkdir -p a/b/cCreate Intermediate Directories (-p)
    • $ mkdir -v aVerbose Output (-v)
  • Copying Files (cp)
    • $ cp a.txt b.txtCopying a Single File, 1: source, 2: file copy
    • $ cp a.txt b.txt fooCopying Multiple Files
      front: source files, end: directory
    • $ cp -v a.txt b.txta.txt -> b.txt
    • $ cp -Rv foo barCopying Directories (-R)
    • $ cp -f a.txt b.txtForce Overwriting of a File (-f)
    • $ cp -i a.txt b.txtConfirm Overwriting of a File (-i)overwrite b.txt? (y/n [n])
  • Deleting Files (rm)
    • $ rm -v a.txtuses 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 命令行基础的主要内容,如果未能解决你的问题,请参考以下文章

linux 命令行基础

Admin——Linux命令行基础

华为认证欧拉openEuler-HCIA命令行操作基础

Linux 命令行基础

2_Linux操作系统和基础命令行

命令行基础